export type DidKeyString = `did:key:${string}`; /** * Represents a public cryptographic key */ export interface PublicKey { /** * Verifies a signature against a provided data */ verify(sig: Uint8Array, data: Uint8Array, options?: VerifyOptions): Promise; /** * Exports the public key in a specified format: * * - `did`: serialized to did:key * - `jwk`: serialized to JWK (JSON Web Key) * - `multikey`: serialized to multikey string * - `raw`: as raw bytes * - `rawHex` serialized to base16 string */ exportPublicKey(format: 'did'): Promise; exportPublicKey(format: 'jwk'): Promise; exportPublicKey(format: 'multikey'): Promise; exportPublicKey(format: 'raw'): Promise; exportPublicKey(format: 'rawHex'): Promise; } /** * Represents a private cryptographic key */ export interface PrivateKey extends PublicKey { /** * Signs provided data using the private key */ sign(data: Uint8Array): Promise; } /** * Represents an exportable private cryptographic key */ export interface PrivateKeyExportable extends PrivateKey { /** * Exports the private key in a specified format: * * - `jwk`: serialized to JWK (JSON Web Key) * - `multikey`: serialized to multikey string * - `raw`: as raw bytes * - `rawHex`: serialized to base16 string */ exportPrivateKey(format: 'jwk'): Promise; exportPrivateKey(format: 'multikey'): Promise; exportPrivateKey(format: 'raw'): Promise; exportPrivateKey(format: 'rawHex'): Promise; } export interface VerifyOptions { allowMalleableSig?: boolean; }