Plc Module
Client for the PLC Directory -- the public ledger for did:plc:* DIDs.
Provides read operations (resolve, audit log, export) that require no authentication,
and operation construction/signing helpers for DID document updates.
The PLC Directory is a centralized but auditable registry. All read endpoints are public
and require only an HttpClient. Write operations (creating
or updating DID documents) require signing with a rotation key, but this module does NOT
depend on FSharp.ATProto.Crypto directly -- signing is injected via a
byte[] -> byte[] function parameter.
Types
| Type | Description |
|
An entry in the PLC audit log, representing one historical operation on a DID. |
|
|
An entry in the PLC export stream. Same as AuditEntry but sourced from the global export endpoint rather than a per-DID audit log. |
|
|
A resolved DID document from the PLC Directory.
This is the W3C DID Document format returned by |
|
|
Error type for PLC Directory operations. |
|
|
A PLC operation that creates, updates, or tombstones a DID document. Operations are signed with a rotation key and submitted to the PLC Directory. |
|
|
The type of a PLC operation. |
|
|
A service endpoint entry in a PLC operation.
Maps a service identifier (e.g. |
Functions and values
| Function or value |
Description
|
Full Usage:
DefaultBaseUrl
Returns: string
|
Default PLC Directory base URL.
|
Full Usage:
createGenesisOp rotationKeys verificationMethods alsoKnownAs services
Parameters:
string list
-
The rotation keys (1-5 did:key values) that will control this DID.
verificationMethods : Map<string, string>
-
Verification methods as a map of key ID to did:key value.
alsoKnownAs : string list
-
Alternative identifiers (e.g. ["at://handle.bsky.social"]).
services : Map<string, PlcService>
-
Service endpoints keyed by service ID.
Returns: PlcOperation
An unsigned PlcOperation with prev = None and sig = None.
|
Create an unsigned genesis operation (the first operation for a new DID).
The
|
Full Usage:
createRotationOp prev rotationKeys verificationMethods alsoKnownAs services
Parameters:
string
-
The CID of the previous operation in the log.
rotationKeys : string list
-
The new rotation keys.
verificationMethods : Map<string, string>
-
The new verification methods.
alsoKnownAs : string list
-
The new alternative identifiers.
services : Map<string, PlcService>
-
The new service endpoints.
Returns: PlcOperation
An unsigned PlcOperation with the given prev CID.
|
Create an unsigned rotation (update) operation that modifies the DID document.
|
Full Usage:
createTombstoneOp prev
Parameters:
string
-
The CID of the previous operation in the log.
Returns: PlcOperation
An unsigned tombstone PlcOperation.
|
Create an unsigned tombstone operation that deactivates the DID.
|
Full Usage:
export client after count baseUrl
Parameters:
HttpClient
-
An HttpClient for making the request.
after : string option
-
Optional cursor (ISO 8601 timestamp) to resume export from.
count : int option
-
Optional maximum number of entries to return.
baseUrl : string option
-
The PLC Directory base URL. Defaults to https://plc.directory.
Returns: Task<Result<ExportEntry list, PlcError>>
A list of ExportEntry on success, or a PlcError on failure.
|
Export operations from the PLC Directory.
Calls
|
Full Usage:
getAuditLog client did baseUrl
Parameters:
HttpClient
-
An HttpClient for making the request.
did : Did
-
The DID to get the audit log for.
baseUrl : string option
-
The PLC Directory base URL. Defaults to https://plc.directory.
Returns: Task<Result<AuditEntry list, PlcError>>
A list of AuditEntry on success, or a PlcError on failure.
|
Get the audit log for a
|
Full Usage:
resolve client did baseUrl
Parameters:
HttpClient
-
An HttpClient for making the request.
did : Did
-
The DID to resolve.
baseUrl : string option
-
The PLC Directory base URL. Defaults to https://plc.directory.
Returns: Task<Result<PlcDocument, PlcError>>
The resolved PlcDocument on success, or a PlcError on failure.
|
Resolve a
|
|
Serialize a PLC operation to its canonical JSON bytes for signing.
The
|
|
Serialize a PLC operation to JSON bytes including the signature. Used for submitting to the PLC Directory.
|
Full Usage:
signOperation sign op
Parameters:
byte[] -> byte[]
-
A signing function that takes raw bytes and returns a 64-byte signature. Typically Signing.sign keyPair from the Crypto project.
op : PlcOperation
-
The unsigned operation to sign.
Returns: PlcOperation
The operation with the sig field populated.
|
Sign a PLC operation with a rotation key.
The sign function should produce a 64-byte compact ECDSA signature (r || s)
over the input bytes. The data is the canonical JSON encoding of the operation
(without the
|
Full Usage:
submitOperation client did op baseUrl
Parameters:
HttpClient
-
An HttpClient for making the request.
did : Did
-
The DID to submit the operation for.
op : PlcOperation
-
The signed operation to submit. Must have a Sig value.
baseUrl : string option
-
The PLC Directory base URL. Defaults to https://plc.directory.
Returns: Task<Result<unit, PlcError>>
Ok () on success, or a PlcError on failure.
|
Submit a signed PLC operation to the PLC Directory.
Calls
|