Identity Module
AT Protocol identity resolution: DID documents, handle resolution, and bidirectional verification.
Supports both did:plc (via PLC directory) and did:web (via .well-known) methods.
Types
| Type | Description |
|
A resolved AT Protocol identity containing the DID and optional metadata extracted from the DID document. |
Functions and values
| Function or value |
Description
|
Full Usage:
parseDidDocument doc
Parameters:
JsonElement
-
A JSON element representing the DID document.
Returns: Result<AtprotoIdentity, string>
Ok with the parsed identity, or Error if the document is missing the required id field.
Optional fields (handle, PDS endpoint, signing key) are None if absent from the document.
|
Parse a DID document JSON into an AtprotoIdentity.
Extracts the DID, handle (from
|
Full Usage:
resolveDid agent did
Parameters:
AtpAgent
-
An AtpAgent whose HttpClient is used for the HTTP request.
did : Did
-
The DID to resolve. Must start with did:plc: (resolved via PLC directory)
or did:web: (resolved via .well-known/did.json).
Returns: Task<Result<AtprotoIdentity, IdentityError>>
Ok with the parsed identity on success, or Error with an IdentityError
on HTTP failure or unsupported DID method.
|
Resolve a DID to an AtprotoIdentity by fetching its DID document.
|
Full Usage:
resolveHandle agent handle
Parameters:
AtpAgent
-
An authenticated AtpAgent.
handle : Handle
-
The handle to resolve (e.g., my-handle.bsky.social).
Returns: Task<Result<Did, IdentityError>>
Ok with the resolved Did on success, or Error with an IdentityError
if the handle cannot be resolved.
|
Resolve a handle to its DID via
|
Full Usage:
resolveIdentity agent identifier
Parameters:
AtpAgent
-
An authenticated AtpAgent.
identifier : string
-
A DID (starting with did:) or a handle (e.g., my-handle.bsky.social).
Returns: Task<Result<AtprotoIdentity, IdentityError>>
Ok with the resolved AtprotoIdentity. If bidirectional verification
fails (the reverse lookup does not match), the Handle field is set to None
but the identity is still returned. Returns Error on resolution failure.
|
Fully resolve an AT Protocol identity with bidirectional verification. Accepts either a DID or a handle and performs the forward + reverse resolution needed to confirm the handle-DID binding.
Bidirectional verification ensures that both directions of the DID-handle binding agree:
the DID document must list the handle in
Example
union case Result.Ok: ResultValue: 'T -> Result<'T,'TError>
val id: x: 'T -> 'T
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
union case Result.Error: ErrorValue: 'TError -> Result<'T,'TError>
|