Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

identity: hack flag to skip handle resolution #854

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions atproto/identity/base_directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ type BaseDirectory struct {
SkipDNSDomainSuffixes []string
// set of fallback DNS servers (eg, domain registrars) to try as a fallback. each entry should be "ip:port", eg "8.8.8.8:53"
FallbackDNSServers []string
// Hack to skip handle resolution as part of overall identity resolution, when starting with a DID (aka, LookupDID). Always returns invalid handle in this case. This flag is only relevant to services doing things like PDS lookup, or service auth validation (neither involve handles). Longer-term plan is to refactor the directory interface/API to allow more granular DID-only (and handle-only) resolution.
SkipHandleResolution bool
}

var _ Directory = (*BaseDirectory)(nil)
Expand Down Expand Up @@ -62,6 +64,10 @@ func (d *BaseDirectory) LookupDID(ctx context.Context, did syntax.DID) (*Identit
return nil, err
}
ident := ParseIdentity(doc)
if d.SkipHandleResolution {
ident.Handle = syntax.HandleInvalid
return &ident, nil
}
declared, err := ident.DeclaredHandle()
if errors.Is(err, ErrHandleNotDeclared) {
ident.Handle = syntax.HandleInvalid
Expand Down
Loading