diff --git a/oauth.go b/oauth.go index d45c668..fb5ee1d 100644 --- a/oauth.go +++ b/oauth.go @@ -13,6 +13,7 @@ import ( "github.com/bluesky-social/indigo/atproto/atcrypto" "github.com/bluesky-social/indigo/atproto/auth/oauth" + "github.com/bluesky-social/indigo/atproto/identity" "github.com/bluesky-social/indigo/atproto/syntax" "github.com/google/go-querystring/query" "github.com/pkg/browser" @@ -37,6 +38,12 @@ type OAuthConfig struct { // AppName is an optional human-readable name included in client metadata. AppName string + + // Directory overrides the identity directory used to resolve handles and + // DIDs during the OAuth flow. If nil, indigo's default directory is used + // (which queries plc.directory and the public DNS). Set this to point at + // a test PLC (e.g. for integration tests against an ephemeral PDS). + Directory identity.Directory } // SessionInfo is returned after a successful OAuth callback. @@ -70,6 +77,9 @@ func NewOAuthApp(cfg OAuthConfig) (*OAuthApp, error) { } app := oauth.NewClientApp(&config, store) + if cfg.Directory != nil { + app.Dir = cfg.Directory + } return &OAuthApp{ app: app,