@ocap/mpc-hsm 0.0.0-stage → 1.33.7

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.
Files changed (74) hide show
  1. package/esm/bip39-english-wordlist.d.mts +11 -0
  2. package/esm/bip39-english-wordlist.mjs +31 -0
  3. package/esm/constants.d.mts +140 -0
  4. package/esm/constants.mjs +142 -0
  5. package/esm/dkg.d.mts +279 -0
  6. package/esm/dkg.mjs +903 -0
  7. package/esm/index.d.mts +17 -0
  8. package/esm/index.mjs +18 -0
  9. package/esm/mta.d.mts +63 -0
  10. package/esm/mta.mjs +275 -0
  11. package/esm/ocap-clear-signing.d.mts +125 -0
  12. package/esm/ocap-clear-signing.mjs +1170 -0
  13. package/esm/offline-ceremony.d.mts +127 -0
  14. package/esm/offline-ceremony.mjs +481 -0
  15. package/esm/ot.d.mts +193 -0
  16. package/esm/ot.mjs +726 -0
  17. package/esm/personal-vault.d.mts +1292 -0
  18. package/esm/personal-vault.mjs +3615 -0
  19. package/esm/personal.d.mts +10 -0
  20. package/esm/personal.mjs +11 -0
  21. package/esm/presign.d.mts +242 -0
  22. package/esm/presign.mjs +951 -0
  23. package/esm/rlp-eip1559.d.mts +75 -0
  24. package/esm/rlp-eip1559.mjs +293 -0
  25. package/esm/secp256k1-scalar.d.mts +141 -0
  26. package/esm/secp256k1-scalar.mjs +474 -0
  27. package/esm/sign.d.mts +113 -0
  28. package/esm/sign.mjs +225 -0
  29. package/esm/steel-mnemonic.d.mts +55 -0
  30. package/esm/steel-mnemonic.mjs +247 -0
  31. package/esm/tweak.d.mts +100 -0
  32. package/esm/tweak.mjs +168 -0
  33. package/esm/ves-backup.d.mts +296 -0
  34. package/esm/ves-backup.mjs +1025 -0
  35. package/esm/x402-agent-guard.d.mts +111 -0
  36. package/esm/x402-agent-guard.mjs +780 -0
  37. package/lib/bip39-english-wordlist.cjs +33 -0
  38. package/lib/bip39-english-wordlist.d.cts +11 -0
  39. package/lib/constants.cjs +264 -0
  40. package/lib/constants.d.cts +140 -0
  41. package/lib/dkg.cjs +910 -0
  42. package/lib/dkg.d.cts +279 -0
  43. package/lib/index.cjs +420 -0
  44. package/lib/index.d.cts +17 -0
  45. package/lib/mta.cjs +280 -0
  46. package/lib/mta.d.cts +63 -0
  47. package/lib/ocap-clear-signing.cjs +1176 -0
  48. package/lib/ocap-clear-signing.d.cts +125 -0
  49. package/lib/offline-ceremony.cjs +487 -0
  50. package/lib/offline-ceremony.d.cts +127 -0
  51. package/lib/ot.cjs +744 -0
  52. package/lib/ot.d.cts +193 -0
  53. package/lib/personal-vault.cjs +3725 -0
  54. package/lib/personal-vault.d.cts +1292 -0
  55. package/lib/personal.cjs +338 -0
  56. package/lib/personal.d.cts +10 -0
  57. package/lib/presign.cjs +954 -0
  58. package/lib/presign.d.cts +242 -0
  59. package/lib/rlp-eip1559.cjs +303 -0
  60. package/lib/rlp-eip1559.d.cts +75 -0
  61. package/lib/secp256k1-scalar.cjs +527 -0
  62. package/lib/secp256k1-scalar.d.cts +141 -0
  63. package/lib/sign.cjs +233 -0
  64. package/lib/sign.d.cts +113 -0
  65. package/lib/steel-mnemonic.cjs +253 -0
  66. package/lib/steel-mnemonic.d.cts +55 -0
  67. package/lib/tweak.cjs +178 -0
  68. package/lib/tweak.d.cts +100 -0
  69. package/lib/ves-backup.cjs +1053 -0
  70. package/lib/ves-backup.d.cts +296 -0
  71. package/lib/x402-agent-guard.cjs +788 -0
  72. package/lib/x402-agent-guard.d.cts +111 -0
  73. package/package.json +80 -4
  74. package/README.md +0 -3
@@ -0,0 +1,127 @@
1
+ import { RandomBytesFn } from "./secp256k1-scalar.cjs";
2
+ import { CanaryChallengeBundle, ColdShardSchnorrPok, PrintableManifestCard } from "./ves-backup.cjs";
3
+
4
+ //#region src/offline-ceremony.d.ts
5
+
6
+ /**
7
+ * Enforces that an air-gapped custodian boot/process session can decrypt AT MOST ONE guardian index
8
+ * (`design.md` §5.2(1)). Refuses any second guardian index with `SINGLE_CUSTODIAN_SESSION_VIOLATION`
9
+ * across both process-wide memory AND boot-persistent `0700`/`0600` symlink-safe lock files.
10
+ */
11
+ declare function enforceSingleCustodianDecryptPerSession(params: {
12
+ readonly guardianIndex: number;
13
+ readonly lockDir?: string;
14
+ readonly lockFilePath?: string;
15
+ }): {
16
+ readonly lockFilePath: string;
17
+ readonly lockedGuardianIndex: number;
18
+ };
19
+ interface GuardianKeypair {
20
+ readonly guardianSecretKeyBytes32: Uint8Array;
21
+ readonly guardianPublicKeyComp33: Uint8Array;
22
+ readonly guardianPublicKeyHex: string;
23
+ }
24
+ declare function generateGuardianKeypair(rng?: RandomBytesFn): GuardianKeypair;
25
+ interface DecryptToSteelResult {
26
+ readonly guardianIndex: number;
27
+ readonly plateLabel: string;
28
+ readonly words24: ReadonlyArray<string>;
29
+ readonly coldPublicShareHex: string;
30
+ readonly decoyEthAddress: string;
31
+ readonly sessionLockFilePath: string;
32
+ }
33
+ /**
34
+ * Air-gapped Custodian Step 1 (`decrypt-to-steel`):
35
+ * 1. Enforces single-index per custodian boot AND process (`SINGLE_CUSTODIAN_SESSION_VIOLATION`).
36
+ * 2. Validates `PrintableManifestCard` (`printableText` + `escapeColdWallet` + `Y_k`) against `recoveryPackageBytes`.
37
+ * 3. Decrypts ONLY `g(guardianIndex)` via `BSGS_M = 680`, checks `g(k)*G == Y_k`, and wipes `guardianSecretKeyBytes32`.
38
+ * 4. Encodes `g(guardianIndex)` into 24 standard BIP-39 words (`0` passphrases), computes the `m/44'/60'/0'/0/0`
39
+ * honeypot bait address `0xDecoy_j`, and zeroizes `coldShareBytes32` before returning.
40
+ */
41
+ declare function decryptGuardianColdShareToSteelWords24(params: {
42
+ readonly recoveryPackageBytes: Uint8Array;
43
+ readonly guardianIndex: number;
44
+ readonly guardianSecretKeyBytes32: Uint8Array;
45
+ readonly manifestCard?: PrintableManifestCard;
46
+ readonly sessionLockDir?: string;
47
+ readonly sessionLockFilePath?: string;
48
+ }): DecryptToSteelResult;
49
+ /**
50
+ * Air-gapped Clean-Session Custodian Step 2 (`prove-cold-shard`):
51
+ * - Accepts ONLY the 24 BIP-39 words retranscribed from physical `Plate j` + `clusterChallengeBundle`
52
+ * (zero raw private-key file inputs, zero passphrases, zero reconstruction).
53
+ * - Validates full `PrintableManifestCard` consistency (including ALL `nCold` `guardianColdPublicSharesHex`
54
+ * entries!) when `manifestCard` is supplied.
55
+ * - Verifies 24-word SHA-256 checksum, matches `g(j)*G == Y_j` BEFORE creating the Schnorr PoK, and wipes
56
+ * the decoded share buffer in `finally`.
57
+ */
58
+ declare function proveColdShardFromSteelWords24(params: {
59
+ readonly words24: ReadonlyArray<string> | string;
60
+ readonly challengeBundle: CanaryChallengeBundle;
61
+ readonly manifestCard?: PrintableManifestCard;
62
+ readonly expectedGuardianIndex?: number;
63
+ readonly rng?: RandomBytesFn;
64
+ }): {
65
+ readonly guardianIndex: number;
66
+ readonly plateLabel: string;
67
+ readonly shardProof: ColdShardSchnorrPok;
68
+ };
69
+ type SweepChildSpec = {
70
+ readonly tweakMode: 'untweaked';
71
+ } | {
72
+ readonly tweakMode: 'role-bound';
73
+ readonly role: string;
74
+ readonly ethChainId: bigint;
75
+ readonly tweakLabel: string;
76
+ } | {
77
+ readonly tweakMode: 'rule-bound';
78
+ readonly controllerDid: string;
79
+ readonly ethChainId: bigint;
80
+ readonly ruleHash: Uint8Array | string;
81
+ };
82
+ interface EmergencySweepSignedTx {
83
+ readonly senderEthAddress: string;
84
+ readonly escapeColdWallet: string;
85
+ readonly usedGuardianIndices: ReadonlyArray<number>;
86
+ readonly rawSignedTxBytes: Uint8Array;
87
+ readonly rawSignedTxHex: string;
88
+ readonly txHashHex: string;
89
+ readonly yParity: 0 | 1;
90
+ readonly rHex: string;
91
+ readonly sHex: string;
92
+ }
93
+ /**
94
+ * Signs an air-gapped EIP-1559 native ETH disaster-recovery sweep strictly locked to `manifest.escapeColdWallet`
95
+ * (`data = 0x` empty calldata enforced; refuses any `recipientAddress !== manifest.escapeColdWallet`).
96
+ */
97
+ declare function sweepEth(params: {
98
+ readonly manifest: PrintableManifestCard;
99
+ readonly steelPlatesWords24: ReadonlyArray<ReadonlyArray<string> | string>;
100
+ readonly recipientAddress: string;
101
+ readonly amountWei: bigint;
102
+ readonly chainId: bigint;
103
+ readonly nonce: bigint;
104
+ readonly maxPriorityFeePerGasWei: bigint;
105
+ readonly maxFeePerGasWei: bigint;
106
+ readonly gasLimit?: bigint;
107
+ readonly childSpec?: SweepChildSpec;
108
+ }): EmergencySweepSignedTx;
109
+ /**
110
+ * Signs an air-gapped EIP-1559 ERC-20 `transfer(escapeColdWallet, tokenAmount)` disaster-recovery sweep
111
+ * strictly locked to `manifest.escapeColdWallet` (`valueWei = 0n`; refuses any `recipientAddress !== manifest.escapeColdWallet`).
112
+ */
113
+ declare function sweepErc20Transfer(params: {
114
+ readonly manifest: PrintableManifestCard;
115
+ readonly steelPlatesWords24: ReadonlyArray<ReadonlyArray<string> | string>;
116
+ readonly tokenContractAddress: string;
117
+ readonly recipientAddress: string;
118
+ readonly tokenAmount: bigint;
119
+ readonly chainId: bigint;
120
+ readonly nonce: bigint;
121
+ readonly maxPriorityFeePerGasWei: bigint;
122
+ readonly maxFeePerGasWei: bigint;
123
+ readonly gasLimit?: bigint;
124
+ readonly childSpec?: SweepChildSpec;
125
+ }): EmergencySweepSignedTx;
126
+ //#endregion
127
+ export { DecryptToSteelResult, EmergencySweepSignedTx, GuardianKeypair, SweepChildSpec, decryptGuardianColdShareToSteelWords24, enforceSingleCustodianDecryptPerSession, generateGuardianKeypair, proveColdShardFromSteelWords24, sweepErc20Transfer, sweepEth };