@ocap/mpc-hsm 1.33.6 → 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.
- package/esm/bip39-english-wordlist.d.mts +11 -0
- package/esm/bip39-english-wordlist.mjs +31 -0
- package/esm/constants.d.mts +66 -2
- package/esm/constants.mjs +65 -1
- package/esm/dkg.mjs +2 -2
- package/esm/index.d.mts +11 -3
- package/esm/index.mjs +11 -3
- package/esm/ocap-clear-signing.d.mts +125 -0
- package/esm/ocap-clear-signing.mjs +1170 -0
- package/esm/offline-ceremony.d.mts +127 -0
- package/esm/offline-ceremony.mjs +481 -0
- package/esm/ot.d.mts +7 -1
- package/esm/ot.mjs +149 -16
- package/esm/personal-vault.d.mts +1292 -0
- package/esm/personal-vault.mjs +3615 -0
- package/esm/personal.d.mts +10 -0
- package/esm/personal.mjs +11 -0
- package/esm/presign.mjs +1 -1
- package/esm/rlp-eip1559.d.mts +75 -0
- package/esm/rlp-eip1559.mjs +293 -0
- package/esm/secp256k1-scalar.d.mts +1 -1
- package/esm/secp256k1-scalar.mjs +14 -5
- package/esm/steel-mnemonic.d.mts +55 -0
- package/esm/steel-mnemonic.mjs +247 -0
- package/esm/ves-backup.d.mts +296 -0
- package/esm/ves-backup.mjs +1025 -0
- package/esm/x402-agent-guard.d.mts +111 -0
- package/esm/x402-agent-guard.mjs +780 -0
- package/lib/bip39-english-wordlist.cjs +33 -0
- package/lib/bip39-english-wordlist.d.cts +11 -0
- package/lib/constants.cjs +128 -0
- package/lib/constants.d.cts +66 -2
- package/lib/dkg.cjs +2 -2
- package/lib/index.cjs +249 -0
- package/lib/index.d.cts +11 -3
- package/lib/ocap-clear-signing.cjs +1176 -0
- package/lib/ocap-clear-signing.d.cts +125 -0
- package/lib/offline-ceremony.cjs +487 -0
- package/lib/offline-ceremony.d.cts +127 -0
- package/lib/ot.cjs +150 -15
- package/lib/ot.d.cts +7 -1
- package/lib/personal-vault.cjs +3725 -0
- package/lib/personal-vault.d.cts +1292 -0
- package/lib/personal.cjs +338 -0
- package/lib/personal.d.cts +10 -0
- package/lib/presign.cjs +1 -1
- package/lib/rlp-eip1559.cjs +303 -0
- package/lib/rlp-eip1559.d.cts +75 -0
- package/lib/secp256k1-scalar.cjs +14 -5
- package/lib/steel-mnemonic.cjs +253 -0
- package/lib/steel-mnemonic.d.cts +55 -0
- package/lib/ves-backup.cjs +1053 -0
- package/lib/ves-backup.d.cts +296 -0
- package/lib/x402-agent-guard.cjs +788 -0
- package/lib/x402-agent-guard.d.cts +111 -0
- package/package.json +6 -1
|
@@ -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 };
|
package/lib/ot.cjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const require_constants = require('./constants.cjs');
|
|
2
2
|
const require_secp256k1_scalar = require('./secp256k1-scalar.cjs');
|
|
3
|
-
let node_crypto = require("node:crypto");
|
|
4
3
|
let _noble_hashes_sha2_js = require("@noble/hashes/sha2.js");
|
|
5
4
|
let _noble_hashes_sha3_js = require("@noble/hashes/sha3.js");
|
|
6
5
|
let _noble_hashes_utils_js = require("@noble/hashes/utils.js");
|
|
@@ -176,24 +175,158 @@ function baseOtSenderStep3(params) {
|
|
|
176
175
|
require_secp256k1_scalar.zeroizeBytes(pending.yScalarBytes32);
|
|
177
176
|
}
|
|
178
177
|
}
|
|
179
|
-
|
|
178
|
+
function gf256Xtime(x) {
|
|
179
|
+
return (x << 1 ^ (x >>> 7 & 1) * 27) & 255;
|
|
180
|
+
}
|
|
181
|
+
function gf256Mul(a, b) {
|
|
182
|
+
let p = 0;
|
|
183
|
+
let curA = a & 255;
|
|
184
|
+
let curB = b & 255;
|
|
185
|
+
for (let i = 0; i < 8; i++) {
|
|
186
|
+
const mask = -(curB & 1) & 255;
|
|
187
|
+
p ^= curA & mask;
|
|
188
|
+
curA = gf256Xtime(curA);
|
|
189
|
+
curB >>>= 1;
|
|
190
|
+
}
|
|
191
|
+
return p & 255;
|
|
192
|
+
}
|
|
193
|
+
function buildAesSbox256() {
|
|
194
|
+
const sbox = new Uint8Array(256);
|
|
195
|
+
for (let x = 0; x < 256; x++) {
|
|
196
|
+
let inv = x === 0 ? 0 : 1;
|
|
197
|
+
if (x !== 0) {
|
|
198
|
+
let base = x;
|
|
199
|
+
let exp = 254;
|
|
200
|
+
while (exp > 0) {
|
|
201
|
+
if ((exp & 1) === 1) inv = gf256Mul(inv, base);
|
|
202
|
+
base = gf256Mul(base, base);
|
|
203
|
+
exp >>>= 1;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const rot1 = (inv << 1 | inv >>> 7) & 255;
|
|
207
|
+
const rot2 = (inv << 2 | inv >>> 6) & 255;
|
|
208
|
+
const rot3 = (inv << 3 | inv >>> 5) & 255;
|
|
209
|
+
const rot4 = (inv << 4 | inv >>> 4) & 255;
|
|
210
|
+
sbox[x] = (inv ^ rot1 ^ rot2 ^ rot3 ^ rot4 ^ 99) & 255;
|
|
211
|
+
}
|
|
212
|
+
return sbox;
|
|
213
|
+
}
|
|
214
|
+
const AES_SBOX = buildAesSbox256();
|
|
215
|
+
const AES_RCON = [
|
|
216
|
+
16777216,
|
|
217
|
+
33554432,
|
|
218
|
+
67108864,
|
|
219
|
+
134217728,
|
|
220
|
+
268435456,
|
|
221
|
+
536870912,
|
|
222
|
+
1073741824
|
|
223
|
+
];
|
|
224
|
+
function aesSubWord(word) {
|
|
225
|
+
return (AES_SBOX[word >>> 24 & 255] << 24 | AES_SBOX[word >>> 16 & 255] << 16 | AES_SBOX[word >>> 8 & 255] << 8 | AES_SBOX[word & 255]) >>> 0;
|
|
226
|
+
}
|
|
227
|
+
function aesRotWord(word) {
|
|
228
|
+
return (word << 8 | word >>> 24) >>> 0;
|
|
229
|
+
}
|
|
230
|
+
function expandAes256RoundKeys(key32, outWords60) {
|
|
231
|
+
if (key32.length !== 32) throw new require_constants.MpcProtocolError("INVALID_PARAMETER", `AES-256 key must be 32 bytes, got ${key32.length}`);
|
|
232
|
+
for (let i = 0; i < 8; i++) {
|
|
233
|
+
const o = i * 4;
|
|
234
|
+
outWords60[i] = (key32[o] << 24 | key32[o + 1] << 16 | key32[o + 2] << 8 | key32[o + 3]) >>> 0;
|
|
235
|
+
}
|
|
236
|
+
for (let i = 8; i < 60; i++) {
|
|
237
|
+
let temp = outWords60[i - 1];
|
|
238
|
+
if ((i & 7) === 0) temp = (aesSubWord(aesRotWord(temp)) ^ AES_RCON[(i >>> 3) - 1]) >>> 0;
|
|
239
|
+
else if ((i & 7) === 4) temp = aesSubWord(temp);
|
|
240
|
+
outWords60[i] = (outWords60[i - 8] ^ temp) >>> 0;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function addRoundKey16(state16, roundWords, wordOffset) {
|
|
244
|
+
for (let c = 0; c < 4; c++) {
|
|
245
|
+
const w = roundWords[wordOffset + c];
|
|
246
|
+
const o = c * 4;
|
|
247
|
+
state16[o] = (state16[o] ^ w >>> 24 & 255) & 255;
|
|
248
|
+
state16[o + 1] = (state16[o + 1] ^ w >>> 16 & 255) & 255;
|
|
249
|
+
state16[o + 2] = (state16[o + 2] ^ w >>> 8 & 255) & 255;
|
|
250
|
+
state16[o + 3] = (state16[o + 3] ^ w & 255) & 255;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function encryptAes256WithRoundKeysInto(roundWords60, inputBlock16, outBlock16) {
|
|
254
|
+
outBlock16.set(inputBlock16);
|
|
255
|
+
addRoundKey16(outBlock16, roundWords60, 0);
|
|
256
|
+
for (let round = 1; round <= 14; round++) {
|
|
257
|
+
for (let i = 0; i < 16; i++) outBlock16[i] = AES_SBOX[outBlock16[i]];
|
|
258
|
+
const t1 = outBlock16[1];
|
|
259
|
+
outBlock16[1] = outBlock16[5];
|
|
260
|
+
outBlock16[5] = outBlock16[9];
|
|
261
|
+
outBlock16[9] = outBlock16[13];
|
|
262
|
+
outBlock16[13] = t1;
|
|
263
|
+
const t2a = outBlock16[2];
|
|
264
|
+
const t2b = outBlock16[6];
|
|
265
|
+
outBlock16[2] = outBlock16[10];
|
|
266
|
+
outBlock16[6] = outBlock16[14];
|
|
267
|
+
outBlock16[10] = t2a;
|
|
268
|
+
outBlock16[14] = t2b;
|
|
269
|
+
const t3 = outBlock16[15];
|
|
270
|
+
outBlock16[15] = outBlock16[11];
|
|
271
|
+
outBlock16[11] = outBlock16[7];
|
|
272
|
+
outBlock16[7] = outBlock16[3];
|
|
273
|
+
outBlock16[3] = t3;
|
|
274
|
+
if (round < 14) for (let c = 0; c < 4; c++) {
|
|
275
|
+
const o = c * 4;
|
|
276
|
+
const a0 = outBlock16[o];
|
|
277
|
+
const a1 = outBlock16[o + 1];
|
|
278
|
+
const a2 = outBlock16[o + 2];
|
|
279
|
+
const a3 = outBlock16[o + 3];
|
|
280
|
+
const xorAll = a0 ^ a1 ^ a2 ^ a3;
|
|
281
|
+
outBlock16[o] = (a0 ^ xorAll ^ gf256Xtime(a0 ^ a1)) & 255;
|
|
282
|
+
outBlock16[o + 1] = (a1 ^ xorAll ^ gf256Xtime(a1 ^ a2)) & 255;
|
|
283
|
+
outBlock16[o + 2] = (a2 ^ xorAll ^ gf256Xtime(a2 ^ a3)) & 255;
|
|
284
|
+
outBlock16[o + 3] = (a3 ^ xorAll ^ gf256Xtime(a3 ^ a0)) & 255;
|
|
285
|
+
}
|
|
286
|
+
addRoundKey16(outBlock16, roundWords60, round * 4);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Pure synchronous FIPS-197 AES-256 single-block encryption (`16B` plaintext -> `16B` ciphertext).
|
|
291
|
+
* Zeroizes expanded round keys immediately in `finally`.
|
|
292
|
+
*/
|
|
293
|
+
function aes256EncryptBlock(key32, block16) {
|
|
294
|
+
if (!(key32 instanceof Uint8Array) || key32.length !== 32) throw new require_constants.MpcProtocolError("INVALID_PARAMETER", "AES-256 key32 must be 32 bytes");
|
|
295
|
+
if (!(block16 instanceof Uint8Array) || block16.length !== 16) throw new require_constants.MpcProtocolError("INVALID_PARAMETER", "AES-256 block16 must be 16 bytes");
|
|
296
|
+
const roundWords = new Uint32Array(60);
|
|
297
|
+
try {
|
|
298
|
+
expandAes256RoundKeys(key32, roundWords);
|
|
299
|
+
const out = new Uint8Array(16);
|
|
300
|
+
encryptAes256WithRoundKeysInto(roundWords, block16, out);
|
|
301
|
+
return out;
|
|
302
|
+
} finally {
|
|
303
|
+
roundWords.fill(0);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
180
306
|
function expandColumnPrgAes256Ctr(seed32, ctxOtExt, mtaNonce, columnIndex) {
|
|
181
|
-
const
|
|
307
|
+
const ivDigest = (0, _noble_hashes_sha2_js.sha256)(require_secp256k1_scalar.lengthPrefixedEncode(require_constants.DST_OT_CTR_IV_V1, [
|
|
182
308
|
ctxOtExt,
|
|
183
309
|
mtaNonce,
|
|
184
310
|
require_secp256k1_scalar.u16be(columnIndex)
|
|
185
|
-
]))
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
311
|
+
]));
|
|
312
|
+
const ctrBlock16 = new Uint8Array(16);
|
|
313
|
+
ctrBlock16.set(ivDigest.subarray(0, 12), 0);
|
|
314
|
+
const roundWords = new Uint32Array(60);
|
|
315
|
+
try {
|
|
316
|
+
expandAes256RoundKeys(seed32, roundWords);
|
|
317
|
+
const out = new Uint8Array(require_constants.OT_COLUMN_BYTES);
|
|
318
|
+
for (let blk = 0; blk < 8; blk++) {
|
|
319
|
+
ctrBlock16[12] = 0;
|
|
320
|
+
ctrBlock16[13] = 0;
|
|
321
|
+
ctrBlock16[14] = 0;
|
|
322
|
+
ctrBlock16[15] = blk;
|
|
323
|
+
encryptAes256WithRoundKeysInto(roundWords, ctrBlock16, out.subarray(blk * 16, (blk + 1) * 16));
|
|
324
|
+
}
|
|
325
|
+
return out;
|
|
326
|
+
} finally {
|
|
327
|
+
roundWords.fill(0);
|
|
328
|
+
require_secp256k1_scalar.zeroizeBytes(ivDigest, ctrBlock16);
|
|
329
|
+
}
|
|
197
330
|
}
|
|
198
331
|
const EKLUNDH_MASKS_128 = [
|
|
199
332
|
113427455640312821154458202477256070485n,
|
|
@@ -591,11 +724,13 @@ function otExtendSenderStep4VerifyBeforePads(params) {
|
|
|
591
724
|
}
|
|
592
725
|
|
|
593
726
|
//#endregion
|
|
727
|
+
exports.aes256EncryptBlock = aes256EncryptBlock;
|
|
594
728
|
exports.baseOtReceiverStep2 = baseOtReceiverStep2;
|
|
595
729
|
exports.baseOtSenderStep1 = baseOtSenderStep1;
|
|
596
730
|
exports.baseOtSenderStep3 = baseOtSenderStep3;
|
|
597
731
|
exports.bytes16ToU128LE = bytes16ToU128LE;
|
|
598
732
|
exports.eklundhTranspose128x1024 = eklundhTranspose128x1024;
|
|
733
|
+
exports.expandColumnPrgAes256Ctr = expandColumnPrgAes256Ctr;
|
|
599
734
|
exports.expandKos15ChiWeights = expandKos15ChiWeights;
|
|
600
735
|
exports.gf128Mul = gf128Mul;
|
|
601
736
|
exports.otExtendReceiverStep1 = otExtendReceiverStep1;
|
package/lib/ot.d.cts
CHANGED
|
@@ -74,6 +74,12 @@ declare function baseOtSenderStep3(params: {
|
|
|
74
74
|
pending: BaseOtSenderPendingSession;
|
|
75
75
|
step2Message: BaseOtStep2Message;
|
|
76
76
|
}): BaseOtSenderState;
|
|
77
|
+
/**
|
|
78
|
+
* Pure synchronous FIPS-197 AES-256 single-block encryption (`16B` plaintext -> `16B` ciphertext).
|
|
79
|
+
* Zeroizes expanded round keys immediately in `finally`.
|
|
80
|
+
*/
|
|
81
|
+
declare function aes256EncryptBlock(key32: Uint8Array, block16: Uint8Array): Uint8Array;
|
|
82
|
+
declare function expandColumnPrgAes256Ctr(seed32: Uint8Array, ctxOtExt: Uint8Array, mtaNonce: Uint8Array, columnIndex: number): Uint8Array;
|
|
77
83
|
declare function bytes16ToU128LE(bytes16: Uint8Array, offset?: number): bigint;
|
|
78
84
|
declare function u128ToBytes16LE(value: bigint): Uint8Array;
|
|
79
85
|
/**
|
|
@@ -184,4 +190,4 @@ declare function otExtendSenderStep4VerifyBeforePads(params: {
|
|
|
184
190
|
step3Message: OtExtStep3Message;
|
|
185
191
|
}): VerifiedCotSenderRows;
|
|
186
192
|
//#endregion
|
|
187
|
-
export { BaseOtReceiverState, BaseOtSenderPendingSession, BaseOtSenderState, BaseOtStep1Message, BaseOtStep2Message, OtExtReceiverPendingState, OtExtSenderPendingState, OtExtStep1Message, OtExtStep2Message, OtExtStep3Message, VerifiedCotReceiverRows, VerifiedCotSenderRows, baseOtReceiverStep2, baseOtSenderStep1, baseOtSenderStep3, bytes16ToU128LE, eklundhTranspose128x1024, expandKos15ChiWeights, gf128Mul, otExtendReceiverStep1, otExtendReceiverStep3, otExtendSenderStep2, otExtendSenderStep4VerifyBeforePads, u128ToBytes16LE, wipeBaseOtReceiverState, wipeBaseOtSenderState, wipeVerifiedCotReceiverRows, wipeVerifiedCotSenderRows };
|
|
193
|
+
export { BaseOtReceiverState, BaseOtSenderPendingSession, BaseOtSenderState, BaseOtStep1Message, BaseOtStep2Message, OtExtReceiverPendingState, OtExtSenderPendingState, OtExtStep1Message, OtExtStep2Message, OtExtStep3Message, VerifiedCotReceiverRows, VerifiedCotSenderRows, aes256EncryptBlock, baseOtReceiverStep2, baseOtSenderStep1, baseOtSenderStep3, bytes16ToU128LE, eklundhTranspose128x1024, expandColumnPrgAes256Ctr, expandKos15ChiWeights, gf128Mul, otExtendReceiverStep1, otExtendReceiverStep3, otExtendSenderStep2, otExtendSenderStep4VerifyBeforePads, u128ToBytes16LE, wipeBaseOtReceiverState, wipeBaseOtSenderState, wipeVerifiedCotReceiverRows, wipeVerifiedCotSenderRows };
|