···12121313 _ "github.com/joho/godotenv/autoload"
14141515+ "github.com/bluesky-social/indigo/atproto/atcrypto"
1516 "github.com/bluesky-social/indigo/atproto/auth/oauth"
1616- "github.com/bluesky-social/indigo/atproto/crypto"
1717 "github.com/bluesky-social/indigo/atproto/identity"
1818 "github.com/bluesky-social/indigo/atproto/syntax"
1919···101101102102 // If a client secret key is provided (as a multibase string), turn this in to a confidential client
103103 if cctx.String("client-secret-key") != "" && hostname != "" {
104104- priv, err := crypto.ParsePrivateMultibase(cctx.String("client-secret-key"))
104104+ priv, err := atcrypto.ParsePrivateMultibase(cctx.String("client-secret-key"))
105105 if err != nil {
106106 return err
107107 }
+2-2
atproto/auth/oauth/jwt_signing.go
···44 "crypto"
55 "fmt"
6677- atcrypto "github.com/bluesky-social/indigo/atproto/crypto"
77+ "github.com/bluesky-social/indigo/atproto/atcrypto"
88 "github.com/golang-jwt/jwt/v5"
99)
1010···1515 supportedAlgs []string
1616)
17171818-// Implementation of jwt.SigningMethod for the `atproto/crypto` types.
1818+// Implementation of jwt.SigningMethod for the `atproto/atcrypto` types.
1919type signingMethodAtproto struct {
2020 alg string
2121 hash crypto.Hash
+11-11
atproto/auth/oauth/oauth.go
···1111 "strings"
1212 "time"
13131414- "github.com/bluesky-social/indigo/atproto/crypto"
1414+ "github.com/bluesky-social/indigo/atproto/atcrypto"
1515 "github.com/bluesky-social/indigo/atproto/identity"
1616 "github.com/bluesky-social/indigo/atproto/syntax"
1717···4343 UserAgent string
44444545 // For confidential clients, the private client assertion key. Note that while an interface is used here, only P-256 is allowed by the current specification.
4646- PrivateKey crypto.PrivateKey
4646+ PrivateKey atcrypto.PrivateKey
47474848 // ID for current client assertion key (should be provided if PrivateKey is)
4949 KeyID *string
···112112 return config.PrivateKey != nil && config.KeyID != nil
113113}
114114115115-func (config *ClientConfig) SetClientSecret(priv crypto.PrivateKey, keyID string) error {
115115+func (config *ClientConfig) SetClientSecret(priv atcrypto.PrivateKey, keyID string) error {
116116 switch priv.(type) {
117117- case *crypto.PrivateKeyP256:
117117+ case *atcrypto.PrivateKeyP256:
118118 // pass
119119- case *crypto.PrivateKeyK256:
119119+ case *atcrypto.PrivateKeyK256:
120120 return fmt.Errorf("only P-256 (ES256) private keys supported for atproto OAuth")
121121 default:
122122 return fmt.Errorf("unknown private key type: %T", priv)
···131131// If the client does not have any keys (eg, public client), returns an empty set.
132132func (config *ClientConfig) PublicJWKS() JWKS {
133133134134- jwks := JWKS{Keys: []crypto.JWK{}}
134134+ jwks := JWKS{Keys: []atcrypto.JWK{}}
135135136136 // public client with no keys
137137 if config.PrivateKey == nil || config.KeyID == nil {
···148148 }
149149 jwk.KeyID = config.KeyID
150150151151- jwks.Keys = []crypto.JWK{*jwk}
151151+ jwks.Keys = []atcrypto.JWK{*jwk}
152152 return jwks
153153}
154154···209209 }
210210211211 // TODO: refactor this in to ClientAuthStore layer?
212212- priv, err := crypto.ParsePrivateMultibase(sd.DPoPPrivateKeyMultibase)
212212+ priv, err := atcrypto.ParsePrivateMultibase(sd.DPoPPrivateKeyMultibase)
213213 if err != nil {
214214 return nil, err
215215 }
···264264// Creates a DPoP token (JWT) for use with an OAuth Auth Server (not to be used with Resource Server). The returned JWT is not bound to an Access Token (no 'ath'), and does not indicate an issuer ('iss').
265265//
266266// This is used during initial auth request (PAR), initial token request, and subsequent refresh token requests. Note that a full [ClientSession] is not available in several of these circumstances, so this is a stand-alone function.
267267-func NewAuthDPoP(httpMethod, url, dpopNonce string, privKey crypto.PrivateKey) (string, error) {
267267+func NewAuthDPoP(httpMethod, url, dpopNonce string, privKey atcrypto.PrivateKey) (string, error) {
268268269269 claims := dpopClaims{
270270 HTTPMethod: httpMethod,
···356356 dpopServerNonce := ""
357357358358 // create new key for the session
359359- dpopPrivKey, err := crypto.GeneratePrivateKeyP256()
359359+ dpopPrivKey, err := atcrypto.GeneratePrivateKeyP256()
360360 if err != nil {
361361 return nil, err
362362 }
···447447 body.ClientAssertion = &clientAssertion
448448 }
449449450450- dpopPrivKey, err := crypto.ParsePrivateMultibase(info.DPoPPrivateKeyMultibase)
450450+ dpopPrivKey, err := atcrypto.ParsePrivateMultibase(info.DPoPPrivateKeyMultibase)
451451 if err != nil {
452452 return nil, err
453453 }