A community based topic aggregation platform built on atproto
1package identity
2
3import "context"
4
5// Resolver provides methods for resolving atProto identities
6type Resolver interface {
7 // Resolve resolves a handle or DID to complete identity information
8 // The identifier can be either:
9 // - A handle (e.g., "alice.bsky.social")
10 // - A DID (e.g., "did:plc:abc123")
11 Resolve(ctx context.Context, identifier string) (*Identity, error)
12
13 // ResolveHandle specifically resolves a handle to DID and PDS URL
14 // This is a convenience method for handle-only resolution
15 ResolveHandle(ctx context.Context, handle string) (did, pdsURL string, err error)
16
17 // ResolveDID retrieves a DID document and extracts the PDS endpoint
18 ResolveDID(ctx context.Context, did string) (*DIDDocument, error)
19
20 // Purge removes an identifier from the cache
21 // The identifier can be either a handle or DID
22 Purge(ctx context.Context, identifier string) error
23}
24
25// IdentityCache provides caching for resolved identities
26type IdentityCache interface {
27 // Get retrieves a cached identity by handle or DID
28 Get(ctx context.Context, identifier string) (*Identity, error)
29
30 // Set caches an identity with the given TTL
31 // This should cache bidirectionally (both handle and DID as keys)
32 Set(ctx context.Context, identity *Identity) error
33
34 // Delete removes a cached identity by identifier
35 Delete(ctx context.Context, identifier string) error
36
37 // Purge removes all cache entries associated with an identifier
38 // (both handle and DID if applicable)
39 Purge(ctx context.Context, identifier string) error
40}