export type KeyRole = "issuer" | "holder"; export interface AtomicKeyIdentity { readonly keyId: string; readonly publicKey: Uint8Array; } export interface AtomicSigningIdentity extends AtomicKeyIdentity { readonly role: KeyRole; } export interface KeyHandle { sign(message: Uint8Array): Uint8Array | Promise; publicKey(): Uint8Array | Promise; thumbprint(): string | Promise; keyIdentity?(): AtomicKeyIdentity | Promise; signingIdentity?(): AtomicSigningIdentity | Promise; } export type SignerErrorCode = "invalid_report" | "invalid_anchor" | "invalid_grant" | "invalid_transition" | "invalid_key_handle" | "signing_failed" | "producer_error"; export type SignerResult = { readonly ok: true; readonly value: T; } | { readonly ok: false; readonly error: SignerErrorCode; }; export declare const ok: (value: T) => SignerResult; export declare const err: (error: SignerErrorCode) => SignerResult; /** A key check over the library's own copy (width, and for Ed25519 the verifier's acceptability). */ export type KeyCheck = (key: Uint8Array) => boolean; export declare const ed25519Key: KeyCheck; export declare function resolveKeyWith(read: () => unknown, check: KeyCheck): Promise; export declare function resolveIdentityWith(read: () => unknown, check: KeyCheck): Promise; /** The C1 gate: grants require an issuer-role identity resolved atomically. */ export declare function resolveIssuerWith(read: () => unknown, check: KeyCheck): Promise; export declare function resolvePublicKey(handle: KeyHandle): Promise; export declare function resolveKeyIdentity(handle: KeyHandle): Promise; export declare function resolveIssuerIdentity(handle: KeyHandle): Promise; export type Phase = "start" | "stop" | "error"; export declare function emitter(opts: unknown, kind: K): (phase: Phase) => void;