class · Browser and Node
Controller
@toip-tools/eventlogView sourceimport { Controller } from "@toip-tools/eventlog";
Constructor
This class has no public constructor. Use its public factory methods below to create an instance.
Properties
Methods
state
state(): KeyState;
No parameters.
Returns
signers
The current signers, so the caller can keep them (sealed) after a rotation.
signers(): Signer[];
No parameters.
Returns
Signer[]kelMessages
kelMessages(): SignedMessage[];
No parameters.
Returns
headSeal
The head of the KEL as a seal {i, s, d}: what a third party can anchor.
headSeal(): {
i: Qb64;
s: string;
d: Qb64;
};
No parameters.
Returns
locked
Runs fn under the controller's lock. Internal.
locked<T>(fn: () => Promise<T>): Promise<T>;
Parameters
fnrequired() => Promise<T>
Returns
Promise<T>interact
interact(anchors: (Seal | Record<string, unknown>)[]): Promise<SignedMessage>;
Parameters
anchorsrequired(Record<string, unknown> | Seal)[]
Returns
Promise<SignedMessage>checkpointNow
A checkpoint: an ixn sealing every open trail's head.
checkpointNow(): Promise<SignedMessage>;
No parameters.
Returns
Promise<SignedMessage>afterEntry
Called by Trail after each entry.
afterEntry(): Promise<void>;
No parameters.
Returns
Promise<void>rotate
rotate(opts?: RotateOptions): Promise<SignedMessage>;
Parameters
optsoptionalRotateOptionsDefault:
{}
Returns
Promise<SignedMessage>openTrail
openTrail(purpose: string): Promise<Trail>;
Parameters
purposerequiredstring
Returns
Promise<Trail>trail
trail(id: Qb64): Trail;
Parameters
idrequiredstring
Returns
trails
trails(): Trail[];
No parameters.
Returns
Trail[]bind
Signs a DID binding and seals it via ixn.
bind(identity: Identity, replaces?: Qb64): Promise<DidBinding>;
Parameters
identityrequiredIdentityreplacesoptionalstring | undefined
Returns
Promise<DidBinding>signTrail
Signs trail messages for the current key state. Internal.
signTrail(raw: string): Promise<SignedMessage["keyRefSig"]>;
Parameters
rawrequiredstring
Returns
Promise<import("./types.js").KeyRefSig | undefined>publish
Submits messages each witness hasn't receipted, then forwards receipts round-robin.
publish(witnesses: WitnessClient[], opts?: {
timeoutMs?: number;
}): Promise<PublishReport>;
Parameters
witnessesrequiredWitnessClient[]optsoptional{ timeoutMs?: number; }Default:
{}
Returns
Promise<PublishReport>receiptCount
Number of witness receipts held for a message.
receiptCount(m: {
logId: Qb64;
s: number;
d: Qb64;
}): Promise<number>;
Parameters
Returns
Promise<number>static incept
incept(opts: InceptOptions): Promise<Controller>;
Parameters
optsrequiredInceptOptions
Returns
Promise<Controller>static load
Loads a controller from its store and re-verifies its logs. With only hot keys it can append and interact, not rotate.
load(aid: Qb64, opts: {
hot?: Signer[];
cold?: ColdKeys;
store: LogStore;
clock: Clock;
checkpoint?: InceptOptions["checkpoint"];
verify?: SigOptions;
}): Promise<Controller>;
Parameters
aidrequiredstringoptsrequired{ hot?: Signer[]; cold?: ColdKeys; store: LogStore; clock: Clock; checkpoint?: InceptOptions["checkpoint"]; verify?: SigOptions; }
Returns
Promise<Controller>