@smartledger/keys 3.0.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -515
- package/dist/cjs/browser.d.ts +16 -6
- package/dist/cjs/browser.d.ts.map +1 -1
- package/dist/cjs/browser.js +15 -10
- package/dist/cjs/browser.js.map +1 -1
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +19 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sdk.d.ts +83 -9
- package/dist/cjs/sdk.d.ts.map +1 -1
- package/dist/cjs/sdk.js +322 -87
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/cjs/types.d.ts +78 -3
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/browser.d.ts +16 -6
- package/dist/esm/browser.d.ts.map +1 -1
- package/dist/esm/browser.js +14 -10
- package/dist/esm/browser.js.map +1 -1
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/sdk.d.ts +83 -9
- package/dist/esm/sdk.d.ts.map +1 -1
- package/dist/esm/sdk.js +322 -87
- package/dist/esm/sdk.js.map +1 -1
- package/dist/esm/types.d.ts +78 -3
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/lumen-keys.js +2010 -4326
- package/dist/lumen-keys.min.js +4 -7
- package/dist/lumen-keys.min.js.map +4 -4
- package/package.json +11 -12
- package/dist/lumen-keys.js.map +0 -7
- package/dist/tsconfig.esm.tsbuildinfo +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/esm/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA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aAAa,GAAG,MAAM,EAAE,aAAa,IAAI,IAAI,sBAAsB,EAAE,CAAC;IAE5E,2CAA2C;IAC3C,EAAE;IACF,4EAA4E;IAC5E,qEAAqE;IACrE,sEAAsE;IACtE,2EAA2E;IAC3E,kEAAkE;IAClE,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC;QAC3B,aAAa,CAAC,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC,CAAC;QAC5C,aAAa,CAAC,QAAQ,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;QAC3C,aAAa,CAAC,QAAQ,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;QAC3C,aAAa,CAAC,QAAQ,CAAC,IAAI,YAAY,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,IAAI,aAAa,CAAC;QACvB,WAAW;QACX,aAAa;KACd,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * Default implementation of KeySDK.\n * \n * Integrates KeyRegistry and SignatureSuiteRegistry to provide\n * a clean, high-level API for key operations.\n */\n\nimport {\n KeyRegistry,\n SignatureSuiteRegistry,\n KeyMeta,\n Keypair,\n CryptoProfile,\n hashBytes,\n assertKeyUsable,\n isKeyUsable,\n cloneKeyMeta,\n agentIdOfKey,\n KeyAlreadyExistsError,\n BIP32Derivation,\n InMemoryKeyStorage,\n BsvEcdsaSuite,\n MlDsa44Suite,\n MlDsa65Suite,\n MlDsa87Suite,\n} from '@smartledger/crypto';\nimport {\n KeySDK,\n KeyRecord,\n CreateKeyOptions,\n AgentKeyConfig,\n MultiSignatureResult,\n MultiVerificationResult,\n SuiteSignature,\n SuiteVerificationResult,\n KeyStatusPolicy,\n VerifySignatureOptions,\n VerifyWithSuitesOptions,\n RotateAgentKeysOptions,\n WalletKeyPath,\n} from './types.js';\n\n/**\n * Configuration for DefaultKeySDK.\n */\nexport interface KeySDKConfig {\n /** Key registry instance */\n keyRegistry: KeyRegistry;\n \n /** Signature suite registry instance */\n suiteRegistry: SignatureSuiteRegistry;\n}\n\nexport { agentIdOfKey };\n\nconst COUNTER_SUFFIX = /^pk-[^:-]+-(\\d+)$/;\nconst MAX_KEY_ID_ATTEMPTS = 8;\n\nfunction assertAgentId(agentId: unknown): asserts agentId is string {\n if (typeof agentId !== 'string' || agentId.length === 0) {\n throw new Error('agentId must be a non-empty string');\n }\n}\n\nfunction toRecord(meta: KeyMeta, publicKey: Uint8Array): KeyRecord {\n // Copies, so a caller cannot reach registry state through a KeyRecord even\n // when a custom storage backend hands out its own objects.\n return { meta: cloneKeyMeta(meta), publicKey: Uint8Array.from(publicKey) };\n}\n\nfunction statusAllows(meta: KeyMeta, policy: KeyStatusPolicy): boolean {\n if (policy === 'any') return true;\n if (policy === 'not-revoked') return meta.status !== 'revoked';\n return isKeyUsable(meta);\n}\n\n/**\n * Default KeySDK implementation.\n * \n * Provides a simple, safe API for key operations while hiding complexity.\n */\nexport class DefaultKeySDK implements KeySDK {\n private keyRegistry: KeyRegistry;\n private suiteRegistry: SignatureSuiteRegistry;\n private keyCounter = new Map<string, number>(); // agentId -> counter\n private counterInitialized = new Set<string>();\n private counterInitPromises = new Map<string, Promise<void>>();\n private getOrCreateInFlight = new Map<string, Promise<KeyRecord>>();\n \n constructor(config: KeySDKConfig) {\n this.keyRegistry = config.keyRegistry;\n this.suiteRegistry = config.suiteRegistry;\n }\n \n /**\n * Create a new key for an agent.\n */\n async createKey(\n agentId: string,\n profile: CryptoProfile,\n options: CreateKeyOptions = {}\n ): Promise<KeyRecord> {\n assertAgentId(agentId);\n\n // Get suite\n const suite = this.suiteRegistry.getSuite(profile.primarySignatureSuite);\n \n // Generate keypair (with optional derivation)\n let keypair;\n \n if (options.derivationContext) {\n // Check if suite supports derivation\n if (!suite.capabilities?.derivation) {\n const available = this.getSuitesWithCapability('derivation');\n throw new Error(\n `Suite '${suite.suiteId}' does not support key derivation.\\n` +\n (available.length > 0\n ? `Suites with derivation capability: ${available.join(', ')}\\n` +\n `Consider using one of these suites or remove the derivationContext option.`\n : `No suites currently support derivation. Remove the derivationContext option.`)\n );\n }\n \n // Use derivation capability\n keypair = await suite.capabilities.derivation.deriveKeypair(options.derivationContext);\n } else {\n // Standard random key generation\n keypair = await suite.generateKeypair();\n }\n \n const meta = await this.registerUnderFreshId(agentId, profile.primarySignatureSuite, keyId =>\n this.keyRegistry.registerKey(keyId, keypair, profile.primarySignatureSuite, {\n expiresAt: options.expiresAt,\n usage: options.usage || ['signing'],\n cryptoProfileVersion: options.cryptoProfileVersion || '1.0.0',\n // Record that (and where) the key was derived. Never the seed.\n derivation: options.derivationContext\n ? { path: options.derivationContext.path ?? '' }\n : undefined,\n })\n );\n \n return toRecord(meta, keypair.publicKey);\n }\n \n /**\n * Get an existing key.\n */\n async getKey(keyId: string): Promise<KeyRecord | null> {\n const result = await this.keyRegistry.getPublicKey(keyId);\n \n if (!result) {\n return null;\n }\n \n return toRecord(result.meta, result.publicKey);\n }\n \n /**\n * Sign with a key (private key never exposed).\n *\n * @throws if the key is unknown, not active, past its `expiresAt`, or not\n * registered for signing\n */\n async signWithKey(\n keyId: string,\n message: Uint8Array\n ): Promise<Uint8Array> {\n // Get full keypair (private access)\n const result = await this.keyRegistry.getKey(keyId);\n \n if (!result) {\n throw new Error(`Key not found: ${keyId}`);\n }\n \n if (result.meta.status && result.meta.status !== 'active') {\n throw new Error(`Key is not active: ${keyId} (status: ${result.meta.status})`);\n }\n // Status alone is not enough: an expired key keeps status 'active' until\n // markExpiredKeys() runs, and used to go on signing in the meantime.\n assertKeyUsable(result.meta);\n\n if (!result.meta.usage.some(u => u === 'signing' || u === 'both')) {\n throw new Error(\n `Key is not registered for signing: ${keyId} (usage: ${result.meta.usage.join(', ')})`\n );\n }\n \n // Get suite and sign\n const suite = this.suiteRegistry.getSuite(result.meta.suiteId);\n \n // Hash the message (consistent with signAgentResponse)\n const hashAlg = this.getHashAlgorithm(result.meta.suiteId);\n const messageHash = await hashBytes(message, hashAlg);\n \n return await suite.sign(result.keypair.privateKey, messageHash);\n }\n \n /**\n * Verify a signature.\n *\n * By default this is the cryptographic check only: a signature made by a\n * key that has since been rotated, expired or revoked still verifies, which\n * is what verifying a historical signature needs. Pass `keyStatus` to also\n * require something of the key's state now.\n */\n async verifySignature(\n keyId: string,\n message: Uint8Array,\n signature: Uint8Array,\n options: VerifySignatureOptions = {}\n ): Promise<boolean> {\n const result = await this.keyRegistry.getPublicKey(keyId);\n \n if (!result) {\n return false;\n }\n\n if (!statusAllows(result.meta, options.keyStatus ?? 'any')) {\n return false;\n }\n \n return this.verifyAgainst(result.meta, result.publicKey, message, signature);\n }\n\n /** The cryptographic check alone. Anything but a strict `true` is a failure. */\n private async verifyAgainst(\n meta: KeyMeta,\n publicKey: Uint8Array,\n message: Uint8Array,\n signature: Uint8Array\n ): Promise<boolean> {\n try {\n const suite = this.suiteRegistry.getSuite(meta.suiteId);\n const hashAlg = this.getHashAlgorithm(meta.suiteId);\n const messageHash = await hashBytes(message, hashAlg);\n return (await suite.verify(publicKey, messageHash, signature)) === true;\n } catch {\n return false;\n }\n }\n \n /**\n * List keys for an agent.\n */\n async listKeysForAgent(\n agentId: string,\n activeOnly: boolean = true\n ): Promise<KeyRecord[]> {\n assertAgentId(agentId);\n\n const keys = activeOnly\n ? await this.keyRegistry.listActiveKeys()\n : await this.keyRegistry.listKeys();\n \n // Exact ownership, not a prefix match (see agentIdOfKey)\n const agentKeys = keys.filter(meta => agentIdOfKey(meta.keyId) === agentId);\n \n // Convert to KeyRecords\n const records: KeyRecord[] = [];\n \n for (const meta of agentKeys) {\n const result = await this.keyRegistry.getPublicKey(meta.keyId);\n if (result) {\n records.push(toRecord(result.meta, result.publicKey));\n }\n }\n \n return records;\n }\n \n /**\n * Get active crypto profile for an agent.\n */\n async getActiveCryptoProfile(agentId: string): Promise<CryptoProfile | null> {\n const keys = await this.listKeysForAgent(agentId, true);\n \n if (keys.length === 0) {\n return null;\n }\n \n // Group by suite\n const sorted = this.sortKeysByCreatedAt(keys);\n const suites = new Set(sorted.map(k => k.meta.suiteId));\n const suiteArray = Array.from(suites);\n \n // Assume first is primary, second is secondary\n return {\n primarySignatureSuite: suiteArray[0],\n secondarySignatureSuite: suiteArray[1],\n };\n }\n \n /**\n * Rotate all keys for an agent.\n *\n * Each replacement gets its predecessor's lifetime again, counted from now\n * (or `options.expiresAt`); it does not inherit the old expiry instant.\n *\n * A key derived from a seed cannot be re-derived here, because the SDK does\n * not keep seeds. By default the call refuses, before changing anything,\n * rather than silently swapping a recoverable key for a random one. See\n * {@link RotateAgentKeysOptions.derivedKeys}.\n */\n async rotateAgentKeys(\n agentId: string,\n options: RotateAgentKeysOptions = {}\n ): Promise<KeyRecord[]> {\n const derivedPolicy = options.derivedKeys ?? 'error';\n const activeKeys = await this.listKeysForAgent(agentId, true);\n\n // Decide everything before changing anything.\n const toRotate: KeyRecord[] = [];\n for (const keyRecord of activeKeys) {\n // Resolves the suite now, so an unknown suite fails before any rotation.\n this.suiteRegistry.getSuite(keyRecord.meta.suiteId);\n if (keyRecord.meta.derivation) {\n if (derivedPolicy === 'error') {\n throw new Error(\n `Key ${keyRecord.meta.keyId} was derived from a seed ` +\n `(path ${keyRecord.meta.derivation.path || 'unknown'}). Rotating it here would ` +\n `replace it with a random key that the mnemonic cannot recover. Derive the ` +\n `successor yourself with createKeyFromMnemonic at a new path, or pass ` +\n `{ derivedKeys: 'skip' } or { derivedKeys: 'randomize' }. No keys were rotated.`\n );\n }\n if (derivedPolicy === 'skip') continue;\n }\n toRotate.push(keyRecord);\n }\n\n // Generate every replacement before committing any, so a failing suite\n // cannot leave the agent half rotated. The commits below are then one\n // registry rotation per key; they are not a single transaction, so a\n // storage failure part-way through leaves the earlier keys rotated.\n const replacements: Keypair[] = [];\n for (const keyRecord of toRotate) {\n const suite = this.suiteRegistry.getSuite(keyRecord.meta.suiteId);\n replacements.push(await suite.generateKeypair());\n }\n\n const newKeys: KeyRecord[] = [];\n \n for (const [i, keyRecord] of toRotate.entries()) {\n const newKeypair = replacements[i];\n \n const newMeta = await this.registerUnderFreshId(agentId, keyRecord.meta.suiteId, newKeyId =>\n this.keyRegistry.rotateKey(keyRecord.meta.keyId, newKeyId, newKeypair, {\n expiresAt: options.expiresAt,\n })\n );\n \n newKeys.push(toRecord(newMeta, newKeypair.publicKey));\n }\n \n return newKeys;\n }\n \n /**\n * Get or create key (idempotent).\n *\n * Concurrent calls on this SDK instance for the same agent and suite share\n * one creation. Two SDK instances (or processes) on one storage backend can\n * still each create a key; that needs a lock in the backend.\n */\n async getOrCreateKey(\n agentId: string,\n profile: CryptoProfile,\n options: CreateKeyOptions = {}\n ): Promise<KeyRecord> {\n assertAgentId(agentId);\n const slot = JSON.stringify([agentId, profile.primarySignatureSuite]);\n\n const pending = this.getOrCreateInFlight.get(slot);\n if (pending) {\n const record = await pending;\n return toRecord(record.meta, record.publicKey);\n }\n\n const work = (async () => {\n // Check if key exists\n const existingKeys = await this.listKeysForAgent(agentId, true);\n const primaryKey = existingKeys.find(\n k => k.meta.suiteId === profile.primarySignatureSuite\n );\n \n if (primaryKey) {\n return primaryKey;\n }\n \n // Create new key\n return await this.createKey(agentId, profile, options);\n })();\n\n this.getOrCreateInFlight.set(slot, work);\n try {\n return await work;\n } finally {\n this.getOrCreateInFlight.delete(slot);\n }\n }\n\n /**\n * Create both primary and secondary keys for an agent.\n */\n async createDualSignatureKeys(\n agentId: string,\n profile: CryptoProfile,\n options: CreateKeyOptions = {}\n ): Promise<{ primaryKey: KeyRecord; secondaryKey: KeyRecord }> {\n if (!profile.secondarySignatureSuite) {\n throw new Error('secondarySignatureSuite is required to create dual signature keys');\n }\n this.assertDualProfile(profile);\n\n const primaryKey = await this.createKey(agentId, {\n primarySignatureSuite: profile.primarySignatureSuite,\n }, options);\n\n const secondaryKey = await this.createKey(agentId, {\n primarySignatureSuite: profile.secondarySignatureSuite,\n }, options);\n\n return { primaryKey, secondaryKey };\n }\n\n /**\n * Idempotent creation of both primary and secondary keys.\n */\n async getOrCreateDualSignatureKeys(\n agentId: string,\n profile: CryptoProfile,\n options: CreateKeyOptions = {}\n ): Promise<{ primaryKey: KeyRecord; secondaryKey: KeyRecord }> {\n if (!profile.secondarySignatureSuite) {\n throw new Error('secondarySignatureSuite is required to create dual signature keys');\n }\n this.assertDualProfile(profile);\n\n const primaryKey = await this.getOrCreateKey(agentId, {\n primarySignatureSuite: profile.primarySignatureSuite,\n }, options);\n\n const secondaryKey = await this.getOrCreateKey(agentId, {\n primarySignatureSuite: profile.secondarySignatureSuite,\n }, options);\n\n return { primaryKey, secondaryKey };\n }\n\n /**\n * Fail before creating either key if the pair could not be a hybrid pair:\n * an unknown suite, or the same suite twice (two ECDSA keys are not a\n * classical + post-quantum pair, whatever the profile calls them).\n */\n private assertDualProfile(profile: CryptoProfile): void {\n this.suiteRegistry.getSuite(profile.primarySignatureSuite);\n this.suiteRegistry.getSuite(profile.secondarySignatureSuite!);\n if (profile.primarySignatureSuite === profile.secondarySignatureSuite) {\n throw new Error(\n `Dual signature keys need two different suites; both are ${profile.primarySignatureSuite}`\n );\n }\n }\n\n /**\n * Sign with one or more suites for an agent.\n */\n async signWithSuites(\n agentId: string,\n message: Uint8Array,\n suites?: string[]\n ): Promise<MultiSignatureResult> {\n const activeKeys = this.sortKeysByCreatedAt(await this.listKeysForAgent(agentId, true));\n\n if (activeKeys.length === 0) {\n throw new Error(`No active keys found for agent: ${agentId}`);\n }\n\n const suitesToUse = Array.from(\n new Set(suites?.length ? suites : activeKeys.map(k => k.meta.suiteId))\n );\n const signatures: SuiteSignature[] = [];\n\n for (const suiteId of suitesToUse) {\n const key = activeKeys.find(k => k.meta.suiteId === suiteId);\n if (!key) {\n throw new Error(`No active key for suite '${suiteId}' and agent '${agentId}'`);\n }\n\n const signature = await this.signWithKey(key.meta.keyId, message);\n signatures.push({ suiteId, keyId: key.meta.keyId, signature });\n }\n\n return { signatures };\n }\n\n /**\n * Verify a set of signatures as a hybrid (multi-suite) signature by `agentId`.\n *\n * `allValid` is true only when ALL of these hold:\n * - at least one signature was supplied;\n * - every supplied signature is by a key that belongs to `agentId`, names\n * that key's real suite, passes the key-status policy, and verifies;\n * - every REQUIRED suite has such a signature.\n *\n * The required suites come from the verifier: `options.requiredSuites`, or\n * by default the suites of the agent's currently usable keys in this SDK's\n * registry. They are never read from `signatures`. The check walks the\n * required suites and looks each one up among the valid signatures, so an\n * empty list, or one that merely omits the post-quantum signature, is\n * refused instead of passing because everything in it happens to be valid.\n */\n async verifyWithSuites(\n agentId: string,\n message: Uint8Array,\n signatures: SuiteSignature[],\n options: VerifyWithSuitesOptions = {}\n ): Promise<MultiVerificationResult> {\n assertAgentId(agentId);\n const keyStatus = options.keyStatus ?? 'not-revoked';\n\n const requiredSuites = Array.from(\n new Set(\n options.requiredSuites ??\n (await this.listKeysForAgent(agentId, true)).map(k => k.meta.suiteId)\n )\n );\n\n const refuse = (error: string, results: SuiteVerificationResult[] = []): MultiVerificationResult => ({\n results,\n allValid: false,\n requiredSuites,\n missingSuites: requiredSuites.filter(s => !results.some(r => r.valid && r.suiteId === s)),\n error,\n });\n\n if (!Array.isArray(signatures)) {\n return refuse('signatures must be an array');\n }\n\n const results: SuiteVerificationResult[] = [];\n\n for (const entry of signatures) {\n const suiteId = String(entry?.suiteId);\n const keyId = String(entry?.keyId);\n const fail = (error: string) => results.push({ suiteId, keyId, valid: false, error });\n\n try {\n if (agentIdOfKey(keyId) !== agentId) {\n fail(`Key does not belong to agent '${agentId}'`);\n continue;\n }\n const key = await this.keyRegistry.getPublicKey(keyId);\n if (!key) {\n fail('Key not found');\n continue;\n }\n if (key.meta.suiteId !== suiteId) {\n fail(`Suite mismatch: key is ${key.meta.suiteId}, signature claims ${suiteId}`);\n continue;\n }\n if (!statusAllows(key.meta, keyStatus)) {\n fail(`Key status not accepted (status: ${key.meta.status ?? 'active'}, policy: ${keyStatus})`);\n continue;\n }\n if (!(entry.signature instanceof Uint8Array)) {\n fail('Signature must be a Uint8Array');\n continue;\n }\n const valid = await this.verifyAgainst(key.meta, key.publicKey, message, entry.signature);\n if (valid) {\n results.push({ suiteId, keyId, valid: true });\n } else {\n fail('Signature verification failed');\n }\n } catch (error) {\n fail(error instanceof Error ? error.message : String(error));\n }\n }\n\n if (requiredSuites.length === 0) {\n return refuse(\n `No required suites: agent '${agentId}' has no usable keys and options.requiredSuites was not given`,\n results\n );\n }\n if (results.length === 0) {\n return refuse('No signatures supplied', results);\n }\n\n // Walk the REQUIRED suites and look each up among the valid signatures.\n const missingSuites = requiredSuites.filter(\n required => !results.some(r => r.valid && r.suiteId === required)\n );\n const everySuppliedValid = results.every(r => r.valid === true);\n\n return {\n results,\n allValid: everySuppliedValid && missingSuites.length === 0,\n requiredSuites,\n missingSuites,\n ...(missingSuites.length > 0\n ? { error: `No valid signature for required suite(s): ${missingSuites.join(', ')}` }\n : {}),\n };\n }\n \n /**\n * Generate a new BIP39 mnemonic phrase.\n * \n * @param strength 128 (12 words) or 256 (24 words)\n * @returns Mnemonic phrase\n */\n generateMnemonic(strength: 128 | 256 = 256): string {\n const bip32 = new BIP32Derivation();\n return bip32.generateMnemonic(strength);\n }\n \n /**\n * Create a key from a BIP39 mnemonic using HD derivation.\n * \n * Only works with suites that support BIP32 derivation (e.g., bsv-ecdsa-secp256k1).\n * \n * @param agentId Agent identifier\n * @param profile Crypto profile (must use derivation-capable suite)\n * @param mnemonic BIP39 mnemonic phrase (words and checksum are validated)\n * @param path BIP32 derivation path (default: \"m/44'/0'/0'/0/0\")\n * @param passphrase Optional BIP39 passphrase\n * @param options Additional key creation options\n * @returns KeyRecord with derived key\n * @throws if the mnemonic has an unknown word, a wrong word count or a bad checksum\n */\n async createKeyFromMnemonic(\n agentId: string,\n profile: CryptoProfile,\n mnemonic: string,\n path: string = BIP32Derivation.bitcoinPath(0, 0, 0),\n passphrase?: string,\n options: CreateKeyOptions = {}\n ): Promise<KeyRecord> {\n const bip32 = new BIP32Derivation();\n const seed = bip32.mnemonicToSeed(mnemonic, passphrase);\n \n try {\n return await this.createKey(agentId, profile, {\n ...options,\n derivationContext: {\n seed,\n path,\n },\n });\n } finally {\n // The seed is the root of every key in the wallet; do not leave it behind.\n seed.fill(0);\n }\n }\n \n /**\n * Get available capabilities for a specific suite.\n * \n * @param suiteId Suite identifier\n * @returns Array of capability names\n */\n getCapabilities(suiteId: string): string[] {\n const suite = this.suiteRegistry.getSuite(suiteId);\n const caps: string[] = [];\n \n if (suite.capabilities?.derivation) caps.push('derivation');\n if ((suite.capabilities as any)?.encryption) caps.push('encryption');\n if ((suite.capabilities as any)?.threshold) caps.push('threshold');\n \n return caps;\n }\n \n /**\n * Get all suite IDs that support a specific capability.\n * \n * @param capability Capability name\n * @returns Array of suite IDs\n */\n getSuitesWithCapability(capability: 'derivation' | 'encryption' | 'threshold'): string[] {\n const allSuites = this.suiteRegistry.getAllSuites();\n return allSuites\n .filter(suite => !!(suite.capabilities as any)?.[capability])\n .map(suite => suite.suiteId);\n }\n\n /**\n * Create a wallet key from a mnemonic at an explicit BIP44 coin type:\n * `m/44'/coinType'/account'/change/index`.\n *\n * The coin type is required and has no default. It decides which wallets\n * will find the key again: Bitcoin (BTC) is 0, Bitcoin SV is 236.\n *\n * @param agentId Agent identifier\n * @param mnemonic BIP39 mnemonic phrase (words and checksum are validated)\n * @param path Coin type and position in the BIP44 tree\n * @param options Additional key creation options\n * @returns KeyRecord with the derived secp256k1 key\n */\n async createWalletKey(\n agentId: string,\n mnemonic: string,\n path: WalletKeyPath,\n options: CreateKeyOptions = {}\n ): Promise<KeyRecord> {\n if (!path || typeof path.coinType !== 'number') {\n throw new Error(\n 'createWalletKey requires path.coinType (SLIP-44: Bitcoin is 0, Bitcoin SV is 236)'\n );\n }\n const derivationPath = BIP32Derivation.bip44Path(\n path.coinType,\n path.account ?? 0,\n path.change ? 1 : 0,\n path.index ?? 0\n );\n return this.createKeyFromMnemonic(\n agentId,\n { primarySignatureSuite: 'bsv-ecdsa-secp256k1' },\n mnemonic,\n derivationPath,\n path.passphrase,\n options\n );\n }\n \n /**\n * Create a wallet key from mnemonic at the Bitcoin (BTC) BIP44 path:\n * m/44'/0'/account'/change/addressIndex\n *\n * NOTE: coin type 0 is BTC. A Bitcoin SV wallet restoring the same mnemonic\n * looks under coin type 236 and will not find this key. The path is left\n * as it is because changing it would move every key already created with\n * this method. For new code use {@link createWalletKey}, which makes the\n * coin type explicit.\n * \n * @deprecated Use createWalletKey(agentId, mnemonic, { coinType, ... }).\n * @param agentId Agent identifier\n * @param mnemonic BIP39 mnemonic phrase\n * @param accountIndex Account index (default: 0)\n * @param addressIndex Address index (default: 0)\n * @param isChange Use change address path (default: false)\n * @param options Additional key creation options\n * @returns KeyRecord with Bitcoin-compatible key\n */\n async createBitcoinWalletKey(\n agentId: string,\n mnemonic: string,\n accountIndex: number = 0,\n addressIndex: number = 0,\n isChange: boolean = false,\n options: CreateKeyOptions = {}\n ): Promise<KeyRecord> {\n const path = BIP32Derivation.bitcoinPath(accountIndex, isChange ? 1 : 0, addressIndex);\n \n return this.createKeyFromMnemonic(\n agentId,\n { primarySignatureSuite: 'bsv-ecdsa-secp256k1' },\n mnemonic,\n path,\n undefined,\n options\n );\n }\n \n /**\n * Helper: Get hash algorithm for a suite.\n */\n private getHashAlgorithm(suiteId: string): 'sha256' | 'sha3-256' | 'sha512' {\n if (suiteId.startsWith('ml-dsa')) {\n return 'sha3-256';\n }\n return 'sha256';\n }\n\n /**\n * Helper: register a key under the agent's next free key ID.\n *\n * The counter is cached per SDK instance, so another instance (or process)\n * on the same storage can have taken the ID already. The registry refuses\n * to overwrite; on that refusal the counter is re-read from storage and the\n * next ID is tried. Before, the second writer silently replaced the first\n * writer's private key.\n */\n private async registerUnderFreshId(\n agentId: string,\n suiteId: string,\n register: (keyId: string) => Promise<KeyMeta>\n ): Promise<KeyMeta> {\n // 'ml' for every ml-dsa suite, 'bsv' for bsv-ecdsa-secp256k1\n const suiteName = suiteId.split('-')[0].replace(/[^A-Za-z0-9]/g, '') || 'key';\n\n for (let attempt = 0; attempt < MAX_KEY_ID_ATTEMPTS; attempt++) {\n const counter = await this.getNextCounter(agentId);\n const keyId = `${agentId}:pk-${suiteName}-${counter}`;\n try {\n return await register(keyId);\n } catch (error) {\n if (!(error instanceof KeyAlreadyExistsError)) throw error;\n // Someone else holds that ID: forget the cached counter and re-read.\n this.counterInitialized.delete(agentId);\n this.keyCounter.delete(agentId);\n }\n }\n throw new Error(\n `Could not allocate a key ID for agent '${agentId}' after ${MAX_KEY_ID_ATTEMPTS} attempts`\n );\n }\n \n /**\n * Helper: Get next counter for an agent.\n */\n private async getNextCounter(agentId: string): Promise<number> {\n if (!this.counterInitialized.has(agentId)) {\n if (!this.counterInitPromises.has(agentId)) {\n const initPromise = (async () => {\n try {\n const existing = await this.keyRegistry.listKeys();\n const max = existing.reduce((acc, meta) => {\n if (agentIdOfKey(meta.keyId) !== agentId) return acc;\n const local = meta.keyId.slice(agentId.length + 1);\n const match = COUNTER_SUFFIX.exec(local);\n if (!match) return acc;\n const num = parseInt(match[1], 10);\n return Number.isSafeInteger(num) ? Math.max(acc, num) : acc;\n }, 0);\n // A counter handed out while this scan ran must not be reused.\n this.keyCounter.set(agentId, Math.max(max, this.keyCounter.get(agentId) || 0));\n this.counterInitialized.add(agentId);\n } finally {\n this.counterInitPromises.delete(agentId);\n }\n })();\n this.counterInitPromises.set(agentId, initPromise);\n }\n\n const pendingInit = this.counterInitPromises.get(agentId);\n if (pendingInit) {\n await pendingInit;\n }\n }\n\n const current = this.keyCounter.get(agentId) || 0;\n const next = current + 1;\n this.keyCounter.set(agentId, next);\n return next;\n }\n\n /**\n * Helper: sort keys deterministically by createdAt then keyId.\n */\n private sortKeysByCreatedAt(keys: KeyRecord[]): KeyRecord[] {\n return [...keys].sort((a, b) => {\n const aTime = new Date(a.meta.createdAt).getTime();\n const bTime = new Date(b.meta.createdAt).getTime();\n if (aTime !== bTime) return aTime - bTime;\n const priorityDiff = this.getSuitePriority(a.meta.suiteId) - this.getSuitePriority(b.meta.suiteId);\n if (priorityDiff !== 0) return priorityDiff;\n return a.meta.keyId.localeCompare(b.meta.keyId);\n });\n }\n\n private getSuitePriority(suiteId: string): number {\n if (suiteId.startsWith('ml-dsa')) return 0;\n if (suiteId.includes('ecdsa')) return 1;\n return 2;\n }\n}\n\n/**\n * Create a KeySDK instance with default configuration\n * \n * Uses in-memory storage and registers both ECDSA and ML-DSA suites.\n * For custom storage or different suites, instantiate DefaultKeySDK directly.\n * \n * @example\n * ```typescript\n * import { createKeySDK } from '@smartledger/keys';\n * \n * const sdk = createKeySDK();\n * const key = await sdk.createKey('my-agent', { primarySignatureSuite: 'ml-dsa-87' });\n * ```\n */\nexport function createKeySDK(config?: Partial<KeySDKConfig>): KeySDK {\n const keyRegistry = config?.keyRegistry || new KeyRegistry(new InMemoryKeyStorage());\n const suiteRegistry = config?.suiteRegistry || new SignatureSuiteRegistry();\n \n // Register default suites if not provided.\n //\n // All three ML-DSA levels are registered, not just 87. The README documents\n // ml-dsa-65 as the recommended default and ml-dsa-44 for constrained\n // devices; registering only 87 made every one of those examples throw\n // `Unknown signature suite` at runtime, with no way for a caller to fix it\n // -- SignatureSuiteRegistry is not re-exported from this package.\n if (!config?.suiteRegistry) {\n suiteRegistry.register(new BsvEcdsaSuite());\n suiteRegistry.register(new MlDsa44Suite());\n suiteRegistry.register(new MlDsa65Suite());\n suiteRegistry.register(new MlDsa87Suite());\n }\n \n return new DefaultKeySDK({\n keyRegistry,\n suiteRegistry,\n });\n}\n"]}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -47,7 +47,78 @@ export interface SuiteVerificationResult {
|
|
|
47
47
|
/** Aggregate verification outcome across suites. */
|
|
48
48
|
export interface MultiVerificationResult {
|
|
49
49
|
results: SuiteVerificationResult[];
|
|
50
|
+
/**
|
|
51
|
+
* True only if at least one signature was supplied, EVERY supplied
|
|
52
|
+
* signature is valid, and EVERY required suite has a valid signature by a
|
|
53
|
+
* key of the named agent. Never true for an empty or incomplete set.
|
|
54
|
+
*/
|
|
50
55
|
allValid: boolean;
|
|
56
|
+
/** The suites this verification required. */
|
|
57
|
+
requiredSuites: string[];
|
|
58
|
+
/** Required suites for which no valid signature was supplied. */
|
|
59
|
+
missingSuites: string[];
|
|
60
|
+
/** Set when the set was refused for a reason no single signature explains. */
|
|
61
|
+
error?: string;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Which key states a verification accepts.
|
|
65
|
+
* - `'any'`: the signature is checked cryptographically and nothing else.
|
|
66
|
+
* Right for historical signatures; says nothing about the key today.
|
|
67
|
+
* - `'not-revoked'`: additionally refuse keys whose status is `revoked`.
|
|
68
|
+
* - `'usable'`: additionally require the key to be active and unexpired now.
|
|
69
|
+
*/
|
|
70
|
+
export type KeyStatusPolicy = 'any' | 'not-revoked' | 'usable';
|
|
71
|
+
/** Options for {@link KeySDK.verifySignature}. */
|
|
72
|
+
export interface VerifySignatureOptions {
|
|
73
|
+
/** Default: `'any'`. */
|
|
74
|
+
keyStatus?: KeyStatusPolicy;
|
|
75
|
+
}
|
|
76
|
+
/** Options for {@link KeySDK.verifyWithSuites}. */
|
|
77
|
+
export interface VerifyWithSuitesOptions {
|
|
78
|
+
/**
|
|
79
|
+
* Suites that must each have a valid signature. This is the VERIFIER's
|
|
80
|
+
* policy and must come from the verifier's own configuration, never from
|
|
81
|
+
* the signature bundle being checked.
|
|
82
|
+
*
|
|
83
|
+
* Default: the suites of the agent's currently usable keys in this SDK's
|
|
84
|
+
* registry, so an agent holding ML-DSA and ECDSA keys requires both.
|
|
85
|
+
*/
|
|
86
|
+
requiredSuites?: string[];
|
|
87
|
+
/** Default: `'not-revoked'`. */
|
|
88
|
+
keyStatus?: KeyStatusPolicy;
|
|
89
|
+
}
|
|
90
|
+
/** Options for {@link KeySDK.rotateAgentKeys}. */
|
|
91
|
+
export interface RotateAgentKeysOptions {
|
|
92
|
+
/**
|
|
93
|
+
* What to do with a key that was derived from a seed. Its replacement can
|
|
94
|
+
* only be generated at random here, because the SDK does not keep seeds, so
|
|
95
|
+
* the new key would NOT be recoverable from the mnemonic.
|
|
96
|
+
* - `'error'` (default): refuse, and rotate nothing.
|
|
97
|
+
* - `'skip'`: leave derived keys as they are and rotate the rest.
|
|
98
|
+
* - `'randomize'`: replace them with random keys anyway.
|
|
99
|
+
*/
|
|
100
|
+
derivedKeys?: 'error' | 'skip' | 'randomize';
|
|
101
|
+
/**
|
|
102
|
+
* Expiry for the new keys. Omitted: each new key gets its predecessor's
|
|
103
|
+
* lifetime again, counted from now. `null`: no expiry.
|
|
104
|
+
*/
|
|
105
|
+
expiresAt?: string | null;
|
|
106
|
+
}
|
|
107
|
+
/** Where in a BIP44 tree a wallet key lives. */
|
|
108
|
+
export interface WalletKeyPath {
|
|
109
|
+
/**
|
|
110
|
+
* SLIP-44 coin type. Required, with no default, because it decides which
|
|
111
|
+
* wallets will find the key again: Bitcoin (BTC) is 0, Bitcoin SV is 236.
|
|
112
|
+
*/
|
|
113
|
+
coinType: number;
|
|
114
|
+
/** Account index (default: 0) */
|
|
115
|
+
account?: number;
|
|
116
|
+
/** Address index (default: 0) */
|
|
117
|
+
index?: number;
|
|
118
|
+
/** Use the internal/change chain (default: false) */
|
|
119
|
+
change?: boolean;
|
|
120
|
+
/** Optional BIP39 passphrase */
|
|
121
|
+
passphrase?: string;
|
|
51
122
|
}
|
|
52
123
|
/**
|
|
53
124
|
* Key SDK - Single interface for all key operations.
|
|
@@ -91,9 +162,12 @@ export interface KeySDK {
|
|
|
91
162
|
* @param keyId Which key to verify with
|
|
92
163
|
* @param message Original message
|
|
93
164
|
* @param signature Signature to verify
|
|
165
|
+
* @param options `keyStatus` decides whether a revoked or expired key is
|
|
166
|
+
* refused. By default only the cryptographic check is made, so a
|
|
167
|
+
* signature by a since-revoked key still returns true.
|
|
94
168
|
* @returns true if valid
|
|
95
169
|
*/
|
|
96
|
-
verifySignature(keyId: string, message: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
170
|
+
verifySignature(keyId: string, message: Uint8Array, signature: Uint8Array, options?: VerifySignatureOptions): Promise<boolean>;
|
|
97
171
|
/**
|
|
98
172
|
* List all keys for an agent.
|
|
99
173
|
*
|
|
@@ -117,9 +191,10 @@ export interface KeySDK {
|
|
|
117
191
|
* Generates new keypairs for all active keys, marks old ones as rotated.
|
|
118
192
|
*
|
|
119
193
|
* @param agentId Agent identifier
|
|
194
|
+
* @param options How to treat seed-derived keys, and the new keys' expiry
|
|
120
195
|
* @returns Array of new KeyRecords
|
|
121
196
|
*/
|
|
122
|
-
rotateAgentKeys(agentId: string): Promise<KeyRecord[]>;
|
|
197
|
+
rotateAgentKeys(agentId: string, options?: RotateAgentKeysOptions): Promise<KeyRecord[]>;
|
|
123
198
|
/**
|
|
124
199
|
* Create key if it doesn't exist, otherwise return existing.
|
|
125
200
|
*
|
|
@@ -153,7 +228,7 @@ export interface KeySDK {
|
|
|
153
228
|
/**
|
|
154
229
|
* Verify multiple signatures for an agent.
|
|
155
230
|
*/
|
|
156
|
-
verifyWithSuites(agentId: string, message: Uint8Array, signatures: SuiteSignature[]): Promise<MultiVerificationResult>;
|
|
231
|
+
verifyWithSuites(agentId: string, message: Uint8Array, signatures: SuiteSignature[], options?: VerifyWithSuitesOptions): Promise<MultiVerificationResult>;
|
|
157
232
|
/**
|
|
158
233
|
* Generate a new BIP39 mnemonic phrase.
|
|
159
234
|
*
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,UAAU,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,uCAAuC;IACvC,KAAK,CAAC,E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GAAG,MAAM,EAAE,CAAC;IAE3C;;;;;OAKG;IACH,uBAAuB,CAAC,UAAU,EAAE,YAAY,GAAG,YAAY,GAAG,WAAW,GAAG,MAAM,EAAE,CAAC;CAC1F;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,aAAa,CAAC;CAC9B"}
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * @smartledger/keys - Key Management SDK\n * \n * Single source of truth for cryptographic key operations.\n * Provides a clean API that hides complexity and ensures consistency.\n */\n\nimport { KeyMeta, CryptoProfile, DerivationContext } from '@smartledger/crypto';\n\n/**\n * Public key record (safe to expose, no private key).\n */\nexport interface KeyRecord {\n meta: KeyMeta;\n publicKey: Uint8Array;\n}\n\n/**\n * Key creation options.\n */\nexport interface CreateKeyOptions {\n /** Optional expiration date (ISO 8601) */\n expiresAt?: string;\n \n /** Key usage (default: ['signing']) */\n usage?: Array<'signing' | 'encryption' | 'both'>;\n \n /** Crypto profile version (default: '1.0.0') */\n cryptoProfileVersion?: string;\n \n /** Optional derivation context for deterministic key generation */\n derivationContext?: DerivationContext;\n}\n\n/**\n * Signature generated by a specific suite/key combination.\n */\nexport interface SuiteSignature {\n suiteId: string;\n keyId: string;\n signature: Uint8Array;\n}\n\n/** Result of signing with one or more suites. */\nexport interface MultiSignatureResult {\n signatures: SuiteSignature[];\n}\n\n/** Per-suite verification outcome. */\nexport interface SuiteVerificationResult {\n suiteId: string;\n keyId: string;\n valid: boolean;\n error?: string;\n}\n\n/** Aggregate verification outcome across suites. */\nexport interface MultiVerificationResult {\n results: SuiteVerificationResult[];\n /**\n * True only if at least one signature was supplied, EVERY supplied\n * signature is valid, and EVERY required suite has a valid signature by a\n * key of the named agent. Never true for an empty or incomplete set.\n */\n allValid: boolean;\n /** The suites this verification required. */\n requiredSuites: string[];\n /** Required suites for which no valid signature was supplied. */\n missingSuites: string[];\n /** Set when the set was refused for a reason no single signature explains. */\n error?: string;\n}\n\n/**\n * Which key states a verification accepts.\n * - `'any'`: the signature is checked cryptographically and nothing else.\n * Right for historical signatures; says nothing about the key today.\n * - `'not-revoked'`: additionally refuse keys whose status is `revoked`.\n * - `'usable'`: additionally require the key to be active and unexpired now.\n */\nexport type KeyStatusPolicy = 'any' | 'not-revoked' | 'usable';\n\n/** Options for {@link KeySDK.verifySignature}. */\nexport interface VerifySignatureOptions {\n /** Default: `'any'`. */\n keyStatus?: KeyStatusPolicy;\n}\n\n/** Options for {@link KeySDK.verifyWithSuites}. */\nexport interface VerifyWithSuitesOptions {\n /**\n * Suites that must each have a valid signature. This is the VERIFIER's\n * policy and must come from the verifier's own configuration, never from\n * the signature bundle being checked.\n *\n * Default: the suites of the agent's currently usable keys in this SDK's\n * registry, so an agent holding ML-DSA and ECDSA keys requires both.\n */\n requiredSuites?: string[];\n /** Default: `'not-revoked'`. */\n keyStatus?: KeyStatusPolicy;\n}\n\n/** Options for {@link KeySDK.rotateAgentKeys}. */\nexport interface RotateAgentKeysOptions {\n /**\n * What to do with a key that was derived from a seed. Its replacement can\n * only be generated at random here, because the SDK does not keep seeds, so\n * the new key would NOT be recoverable from the mnemonic.\n * - `'error'` (default): refuse, and rotate nothing.\n * - `'skip'`: leave derived keys as they are and rotate the rest.\n * - `'randomize'`: replace them with random keys anyway.\n */\n derivedKeys?: 'error' | 'skip' | 'randomize';\n /**\n * Expiry for the new keys. Omitted: each new key gets its predecessor's\n * lifetime again, counted from now. `null`: no expiry.\n */\n expiresAt?: string | null;\n}\n\n/** Where in a BIP44 tree a wallet key lives. */\nexport interface WalletKeyPath {\n /**\n * SLIP-44 coin type. Required, with no default, because it decides which\n * wallets will find the key again: Bitcoin (BTC) is 0, Bitcoin SV is 236.\n */\n coinType: number;\n /** Account index (default: 0) */\n account?: number;\n /** Address index (default: 0) */\n index?: number;\n /** Use the internal/change chain (default: false) */\n change?: boolean;\n /** Optional BIP39 passphrase */\n passphrase?: string;\n}\n\n/**\n * Key SDK - Single interface for all key operations.\n * \n * Design principles:\n * - Hide private keys from most callers\n * - Single source of truth for suite selection\n * - Crypto-agnostic API (suite is config, not code)\n * - Easy to audit (all key operations go through this)\n */\nexport interface KeySDK {\n /**\n * Create a new key for an agent/module.\n * \n * @param agentId Agent identifier (e.g. 'agent-resonance')\n * @param profile Crypto configuration (which suites to use)\n * @param options Optional expiration, usage, etc.\n * @returns KeyRecord with metadata and public key\n */\n createKey(\n agentId: string,\n profile: CryptoProfile,\n options?: CreateKeyOptions\n ): Promise<KeyRecord>;\n \n /**\n * Get an existing key by ID.\n * \n * @param keyId Key identifier\n * @returns KeyRecord or null if not found\n */\n getKey(keyId: string): Promise<KeyRecord | null>;\n \n /**\n * Sign a message with a key.\n * \n * Private key never leaves the SDK.\n * \n * @param keyId Which key to sign with\n * @param message Message to sign (will be hashed internally)\n * @returns Signature bytes\n */\n signWithKey(\n keyId: string,\n message: Uint8Array\n ): Promise<Uint8Array>;\n \n /**\n * Verify a signature against a public key.\n * \n * @param keyId Which key to verify with\n * @param message Original message\n * @param signature Signature to verify\n * @param options `keyStatus` decides whether a revoked or expired key is\n * refused. By default only the cryptographic check is made, so a\n * signature by a since-revoked key still returns true.\n * @returns true if valid\n */\n verifySignature(\n keyId: string,\n message: Uint8Array,\n signature: Uint8Array,\n options?: VerifySignatureOptions\n ): Promise<boolean>;\n \n /**\n * List all keys for an agent.\n * \n * @param agentId Agent identifier\n * @param activeOnly If true, only return active keys (default: true)\n * @returns Array of KeyRecords\n */\n listKeysForAgent(\n agentId: string,\n activeOnly?: boolean\n ): Promise<KeyRecord[]>;\n \n /**\n * Get the active crypto profile for an agent.\n * \n * Looks up the most recent active keys and infers the profile.\n * \n * @param agentId Agent identifier\n * @returns CryptoProfile or null if no keys found\n */\n getActiveCryptoProfile(agentId: string): Promise<CryptoProfile | null>;\n \n /**\n * Rotate an agent's keys.\n * \n * Generates new keypairs for all active keys, marks old ones as rotated.\n * \n * @param agentId Agent identifier\n * @param options How to treat seed-derived keys, and the new keys' expiry\n * @returns Array of new KeyRecords\n */\n rotateAgentKeys(agentId: string, options?: RotateAgentKeysOptions): Promise<KeyRecord[]>;\n \n /**\n * Create key if it doesn't exist, otherwise return existing.\n * \n * Idempotent key creation for agent setup.\n * \n * @param agentId Agent identifier\n * @param profile Crypto configuration\n * @param options Creation options\n * @returns KeyRecord (new or existing)\n */\n getOrCreateKey(\n agentId: string,\n profile: CryptoProfile,\n options?: CreateKeyOptions\n ): Promise<KeyRecord>;\n\n /**\n * Create both primary and secondary keys in a single call.\n * Requires profile.secondarySignatureSuite to be set.\n */\n createDualSignatureKeys(\n agentId: string,\n profile: CryptoProfile,\n options?: CreateKeyOptions\n ): Promise<{ primaryKey: KeyRecord; secondaryKey: KeyRecord }>;\n\n /**\n * Idempotent dual-key creation; returns existing active keys when present.\n */\n getOrCreateDualSignatureKeys(\n agentId: string,\n profile: CryptoProfile,\n options?: CreateKeyOptions\n ): Promise<{ primaryKey: KeyRecord; secondaryKey: KeyRecord }>;\n\n /**\n * Sign with one or more suites. If suites not provided, uses active profile.\n */\n signWithSuites(\n agentId: string,\n message: Uint8Array,\n suites?: string[]\n ): Promise<MultiSignatureResult>;\n\n /**\n * Verify multiple signatures for an agent.\n */\n verifyWithSuites(\n agentId: string,\n message: Uint8Array,\n signatures: SuiteSignature[],\n options?: VerifyWithSuitesOptions\n ): Promise<MultiVerificationResult>;\n \n /**\n * Generate a new BIP39 mnemonic phrase.\n * \n * @param strength 128 (12 words) or 256 (24 words)\n * @returns Mnemonic phrase\n */\n generateMnemonic(strength?: 128 | 256): string;\n \n /**\n * Create a key from a BIP39 mnemonic using HD derivation.\n * \n * @param agentId Agent identifier\n * @param profile Crypto profile (must use derivation-capable suite)\n * @param mnemonic BIP39 mnemonic phrase\n * @param path BIP32 derivation path\n * @param passphrase Optional BIP39 passphrase\n * @param options Additional key creation options\n * @returns KeyRecord with derived key\n */\n createKeyFromMnemonic(\n agentId: string,\n profile: CryptoProfile,\n mnemonic: string,\n path?: string,\n passphrase?: string,\n options?: CreateKeyOptions\n ): Promise<KeyRecord>;\n \n /**\n * Get available capabilities for a specific suite.\n * \n * @param suiteId Suite identifier\n * @returns Array of capability names\n */\n getCapabilities(suiteId: string): string[];\n \n /**\n * Find suites that support a specific capability.\n * \n * @param capability Capability name\n * @returns Array of suite IDs\n */\n getSuitesWithCapability(capability: 'derivation' | 'encryption' | 'threshold'): string[];\n}\n\n/**\n * Agent metadata with crypto configuration.\n */\nexport interface AgentKeyConfig {\n agentId: string;\n version: string;\n cryptoProfile: CryptoProfile;\n}\n"]}
|