@atlasauth/pca-mpc 0.1.0 → 0.2.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Atlas Authorization
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,31 +1,66 @@
1
1
  # @atlasauth/pca-mpc
2
2
 
3
- PCA evolution B5 reference prototype: a multi-stakeholder Policy VM composed under secure multi-party computation (semi-honest additive secret sharing over a prime field), so user+org+regulator jointly decide allow/threshold without any party revealing its own policy.
3
+ Experimental reference prototype: a multi-stakeholder policy VM composed under secure multi-party computation, for Proof-Carrying Authority (PCA). Several stakeholders (for example user, organization, regulator) each evaluate their own private PCA policy to a tiny decision vector `{ allow, t, rQuant }`, then compose them under MPC so only the joint result is revealed: allow if every party allows, the maximum required proof threshold, and the maximum quantized risk. No party reveals its own policy or its own vector.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```sh
8
- npm i @atlasauth/pca-mpc
8
+ npm i @atlasauth/pca-mpc @atlasauth/pca
9
9
  ```
10
10
 
11
- Depends on the core `@atlasauth/pca` (installed transitively).
12
-
13
11
  ## Usage
14
12
 
15
13
  ```ts
16
- import { evaluateParty, composeSecure } from '@atlasauth/pca-mpc';
14
+ import { generateKeyPair, encodeKey, mintGrant, DEFAULT_RISK_POLICY } from '@atlasauth/pca';
15
+ import { evaluateParty, composeSecure, composeSecureMalicious } from '@atlasauth/pca-mpc';
16
+
17
+ const principal = generateKeyPair();
18
+ const holder = generateKeyPair();
19
+
20
+ // Each stakeholder builds a PartyPolicy from its own grant + decision input.
21
+ function party(id: string, verb = '*') {
22
+ const { grant } = mintGrant({
23
+ principalSecret: principal.secretKey,
24
+ principalPublic: encodeKey(principal.publicKey),
25
+ holder: encodeKey(holder.publicKey),
26
+ goal: 'wire funds',
27
+ envelope: { predicates: [{ verb, resource: '*' }], caveats: [], agent_binding: {}, risk_policy: DEFAULT_RISK_POLICY },
28
+ });
29
+ return {
30
+ id,
31
+ decideInput: {
32
+ grant,
33
+ action: { action: { verb: 'wire', resource: 'acct:1', params: {} } },
34
+ risk: { semanticDistance: 0.1, reversibility: 1, blastRadius: 0.1, taint: 0, confidence: 1, age: 0 },
35
+ budget: { B: 1, tau: 0 },
36
+ now: Date.now(),
37
+ },
38
+ };
39
+ }
40
+
41
+ // Local step: each party reduces its private policy to a decision vector.
42
+ const vectors = [party('user'), party('org'), party('regulator', 'read')].map((p) => evaluateParty(p));
17
43
 
18
- // Each stakeholder evaluates its OWN private policy to a tiny decision vector { allow, t, rQuant }.
19
- const user = evaluateParty({ id: 'user', decideInput: userInput });
20
- const org = evaluateParty({ id: 'org', decideInput: orgInput });
21
- const regulator = evaluateParty({ id: 'regulator', decideInput: regulatorInput });
44
+ // Joint step: semi-honest MPC (additive sharing over a prime field + Beaver triples).
45
+ const result = composeSecure(vectors);
46
+ result.composed; // { allow: 0, t: 3, rQuant: 5 } (the regulator only permits 'read', so the joint answer is deny)
22
47
 
23
- // Compose under MPC: only the joint decision is revealed, no party's own policy or vector.
24
- const result = composeSecure([user, org, regulator]);
25
- result.composed; // { allow, t, rQuant } — composed allow + MAX threshold + MAX risk
26
- result.opened; // the Beaver openings (the only online messages)
48
+ // Malicious-with-abort variant (SPDZ-style MACs): correct result, or a thrown abort.
49
+ const strict = composeSecureMalicious(vectors);
27
50
  ```
28
51
 
29
- `spdz` / `spdz-runner` provide the malicious-with-abort (dishonest-majority) layer. This computes a joint policy verdict; it does not authorize on its own — the resource server's verifier decides. See `docs/specs/pca-mpc-policy-vm.md` for the security model.
52
+ ## API
53
+
54
+ - `evaluateParty(policy, Q?)` - reduce a party's private PCA decision input to a `DecisionVector`.
55
+ - `composeSecure(vectors, config?)` - semi-honest composition; returns `composed`, the public Beaver `opened` messages, and per-party views.
56
+ - `composeSecureMalicious(vectors, config?)` - dishonest-majority layer with information-theoretic MACs and a MAC check that aborts on deviation; an optional no-dealer offline provider (OT-based) replaces the trusted dealer.
57
+ - `composeClear(vectors)` - the cleartext reference that `composeSecure` must equal.
58
+ - Lower-level building blocks (field arithmetic, sharing, Beaver triples, oblivious transfer including a post-quantum KEM-based base OT) are exported too.
59
+
60
+ ## Status
61
+
62
+ This is a research prototype, not a production MPC system. All parties run in one process and exchange data through in-memory structures, so it demonstrates and tests the protocol logic but is not a networked deployment. The semi-honest layer assumes parties follow the protocol and uses a trusted dealer for triples; the malicious layer detects deviation by aborting and can use an OT-based offline phase instead of a dealer. The cryptography has not been audited. The composed verdict informs a decision; it does not authorize anything on its own - the resource server's verifier decides.
63
+
64
+ ## License
30
65
 
31
- Part of Proof-Carrying Authority — see `@atlasauth/pca`.
66
+ MIT - see LICENSE
package/dist/ec.d.ts CHANGED
@@ -20,11 +20,15 @@
20
20
  * inject an off-curve / small-order / mixed-order point to mount a small-subgroup attack. A
21
21
  * `schnorrProve`/`schnorrVerify` NIZK of knowledge of the sender's discrete log `y` (`S = y·B`)
22
22
  * binds `S` to a known exponent, which — with validation — is what makes the base OT malicious-secure.
23
- * - **Constant-time is NOT achieved and cannot be, in pure JS.** BigInt modular arithmetic branches on
24
- * operand size and is not constant-time; this is a genuine language/runtime boundary (see docs §7.1),
25
- * not a shortcut — full constant-time needs a native/WASM constant-time field, exactly as the TEE
26
- * seam needs real hardware. We add what is cheap and honest (constant-time byte comparison for
27
- * commitments lives in `ot.ts`), and do not pretend the field layer is constant-time.
23
+ * - **Constant-time: the secret-scalar multiplications now run in a constant-time WASM core by
24
+ * DEFAULT.** BigInt modular arithmetic branches on operand size and is not constant-time; rather than
25
+ * pretend otherwise, the security-critical ops (every secret-scalar multiply/point-combine: `mulBase`,
26
+ * `mul`, `add`, `sub`, `neg`, and the `[L]·P` cofactor ladder) are routed through `@atlasauth/pca-mpc-wasm`
27
+ * (a `curve25519-dalek` core compiled to WebAssembly) whenever it loads, which is the default. The
28
+ * pure-BigInt path below is retained verbatim as a graceful fallback for when the WASM core is
29
+ * unavailable, and is proven byte-for-byte equivalent to it (see the backend section and
30
+ * `ec-wasm.test.ts`). The remaining BigInt marshalling (point compress/decompress) operates on
31
+ * public point values, never the secret scalar, and is not claimed constant-time (docs §7.1).
28
32
  * - Discrete log in the order-`L` subgroup is the hardness the OT's receiver-choice privacy relies on.
29
33
  */
30
34
  /** Field prime q = 2^255 − 19. */
@@ -44,23 +48,38 @@ export declare const IDENTITY: Point;
44
48
  export declare const BASE: Point;
45
49
  /** Canonical representative in [0, q). */
46
50
  export declare function modFq(x: bigint): bigint;
47
- /**
48
- * Unified complete addition (twisted Edwards a=−1, "add-2008-hwcd-3"). Works for P=Q too (so doubling
49
- * is just `add(P, P)`), and is complete on the prime-order subgroup — no exceptional cases.
50
- */
51
- export declare function add(p1: Point, p2: Point): Point;
52
51
  /**
53
52
  * Dedicated doubling (twisted Edwards a=−1, "dbl-2008-hwcd") — cheaper than the unified add, used to
54
53
  * speed up the scalar ladder. Complete on the subgroup.
55
54
  */
56
55
  export declare function dbl(p: Point): Point;
57
- /** Scalar multiplication [k]P (double-and-add). k is reduced mod L; k=0 ⇒ identity. */
56
+ /** Whether the constant-time WASM curve backend is active (else the pure-BigInt path is in use). */
57
+ export declare function isWasmCurveActive(): boolean;
58
+ /**
59
+ * Canonical 32-byte compressed Ed25519 encoding of a point (little-endian `y`, sign of `x` in bit 255)
60
+ * — the wire form the WASM core speaks. Faithful for on-curve points; the matching inverse is
61
+ * `decompressPoint`.
62
+ */
63
+ export declare function compressPoint(p: Point): Uint8Array;
64
+ /**
65
+ * Decode a canonical 32-byte compressed encoding back into an extended-coordinate `Point` (RFC 8032
66
+ * §5.1.3 x-recovery). Used to bring a WASM-core result back into the `Point` representation so the rest
67
+ * of `ec.ts`/`ot.ts` (affine encoding, KDF hashing, equality) sees byte-identical values to the pure
68
+ * path. Throws `PointValidationError` on a non-canonical / off-curve encoding.
69
+ */
70
+ export declare function decompressPoint(bytes: Uint8Array): Point;
71
+ /**
72
+ * Unified complete addition P + Q. Routes through the constant-time WASM core when available (inputs
73
+ * are on-curve points everywhere the OT stack calls this), else the pure-BigInt `add-2008-hwcd-3`.
74
+ */
75
+ export declare function add(p1: Point, p2: Point): Point;
76
+ /** Scalar multiplication [k]P (k reduced mod L; k=0 ⇒ identity). WASM core when available. */
58
77
  export declare function mul(k: bigint, p: Point): Point;
59
- /** [k]·BASE. */
78
+ /** [k]·BASE. WASM core when available (the fixed-base secret-scalar multiply). */
60
79
  export declare function mulBase(k: bigint): Point;
61
- /** P − Q. */
80
+ /** P − Q. WASM core when available. */
62
81
  export declare function sub(p1: Point, p2: Point): Point;
63
- /** −P = (−X : Y : Z : −T). */
82
+ /** −P. WASM core when available. */
64
83
  export declare function neg(p: Point): Point;
65
84
  /** Affine (x, y) of a point (one inversion). Identity ⇒ (0, 1). */
66
85
  export declare function toAffine(p: Point): {
@@ -86,10 +105,11 @@ export declare function isOnCurve(p: Point): boolean;
86
105
  /** Whether `p` is the identity (neutral) element (affine `(0, 1)`). */
87
106
  export declare function isIdentity(p: Point): boolean;
88
107
  /**
89
- * The cofactor check: whether `[L]·P = O`, i.e. `p` lies in the prime-order-`L` subgroup. For an
90
- * on-curve point this is true iff `p` has order dividing `L`; since `L` is prime this means order `1`
91
- * (identity) or order `L`. So on-curve ∧ `hasPrimeOrder` ∧ ¬identity ⟺ a genuine prime-order point.
92
- * Rejects every small-order point (order | 8) and every mixed-order point (order `h·L`, `h | 8`, `h>1`).
108
+ * The cofactor check `[L]·P = O`. When the constant-time WASM core is loaded, the `[L]·P` scalar work
109
+ * runs inside it (the point is compressed to its canonical 32-byte form — faithful for ON-curve points,
110
+ * which is the only case this is reached with in the validation flow — and the core's torsion check is
111
+ * exactly `[L]·P = O`); otherwise it falls back to the pure-BigInt raw ladder. Both agree bit-for-bit
112
+ * (the `[L]·P = O ⟺ torsion-free ∨ identity` equivalence), so the observable result is identical.
93
113
  */
94
114
  export declare function hasPrimeOrder(p: Point): boolean;
95
115
  /** Whether `p` is a valid non-identity point of the prime-order subgroup (the OT point contract). */
package/dist/ec.js CHANGED
@@ -21,18 +21,25 @@
21
21
  * inject an off-curve / small-order / mixed-order point to mount a small-subgroup attack. A
22
22
  * `schnorrProve`/`schnorrVerify` NIZK of knowledge of the sender's discrete log `y` (`S = y·B`)
23
23
  * binds `S` to a known exponent, which — with validation — is what makes the base OT malicious-secure.
24
- * - **Constant-time is NOT achieved and cannot be, in pure JS.** BigInt modular arithmetic branches on
25
- * operand size and is not constant-time; this is a genuine language/runtime boundary (see docs §7.1),
26
- * not a shortcut — full constant-time needs a native/WASM constant-time field, exactly as the TEE
27
- * seam needs real hardware. We add what is cheap and honest (constant-time byte comparison for
28
- * commitments lives in `ot.ts`), and do not pretend the field layer is constant-time.
24
+ * - **Constant-time: the secret-scalar multiplications now run in a constant-time WASM core by
25
+ * DEFAULT.** BigInt modular arithmetic branches on operand size and is not constant-time; rather than
26
+ * pretend otherwise, the security-critical ops (every secret-scalar multiply/point-combine: `mulBase`,
27
+ * `mul`, `add`, `sub`, `neg`, and the `[L]·P` cofactor ladder) are routed through `@atlasauth/pca-mpc-wasm`
28
+ * (a `curve25519-dalek` core compiled to WebAssembly) whenever it loads, which is the default. The
29
+ * pure-BigInt path below is retained verbatim as a graceful fallback for when the WASM core is
30
+ * unavailable, and is proven byte-for-byte equivalent to it (see the backend section and
31
+ * `ec-wasm.test.ts`). The remaining BigInt marshalling (point compress/decompress) operates on
32
+ * public point values, never the secret scalar, and is not claimed constant-time (docs §7.1).
29
33
  * - Discrete log in the order-`L` subgroup is the hardness the OT's receiver-choice privacy relies on.
30
34
  */
31
35
  Object.defineProperty(exports, "__esModule", { value: true });
32
36
  exports.PointValidationError = exports.BASE = exports.IDENTITY = exports.L = exports.Q = void 0;
33
37
  exports.modFq = modFq;
34
- exports.add = add;
35
38
  exports.dbl = dbl;
39
+ exports.isWasmCurveActive = isWasmCurveActive;
40
+ exports.compressPoint = compressPoint;
41
+ exports.decompressPoint = decompressPoint;
42
+ exports.add = add;
36
43
  exports.mul = mul;
37
44
  exports.mulBase = mulBase;
38
45
  exports.sub = sub;
@@ -48,12 +55,17 @@ exports.assertInSubgroup = assertInSubgroup;
48
55
  exports.schnorrProve = schnorrProve;
49
56
  exports.schnorrVerify = schnorrVerify;
50
57
  const node_crypto_1 = require("node:crypto");
58
+ const node_module_1 = require("node:module");
59
+ const node_path_1 = require("node:path");
51
60
  /** Field prime q = 2^255 − 19. */
52
61
  exports.Q = 2n ** 255n - 19n;
53
62
  /** Prime order of the base-point subgroup. Scalars live in [0, L). */
54
63
  exports.L = 2n ** 252n + 27742317777372353535851937790883648493n;
55
64
  // d = −121665 / 121666 (mod q).
56
65
  const D = modFq(-121665n * invFq(121666n));
66
+ // √(−1) mod q = 2^((q−1)/4) (used by the point decompression that round-trips the WASM core's
67
+ // canonical 32-byte compressed encoding back into an extended-coordinate `Point`).
68
+ const SQRT_M1 = powFq(2n, (exports.Q - 1n) / 4n);
57
69
  /** The identity (neutral) element, affine (0, 1). */
58
70
  exports.IDENTITY = { X: 0n, Y: 1n, Z: 1n, T: 0n };
59
71
  /** The standard Ed25519 base point B (a generator of the order-L subgroup). */
@@ -88,7 +100,7 @@ function fromAffine(x, y) {
88
100
  * Unified complete addition (twisted Edwards a=−1, "add-2008-hwcd-3"). Works for P=Q too (so doubling
89
101
  * is just `add(P, P)`), and is complete on the prime-order subgroup — no exceptional cases.
90
102
  */
91
- function add(p1, p2) {
103
+ function addPure(p1, p2) {
92
104
  const A = (modFq(p1.Y - p1.X) * modFq(p2.Y - p2.X)) % exports.Q;
93
105
  const B = (modFq(p1.Y + p1.X) * modFq(p2.Y + p2.X)) % exports.Q;
94
106
  const C = (((p1.T * 2n) % exports.Q) * D % exports.Q) * p2.T % exports.Q;
@@ -125,8 +137,8 @@ function dbl(p) {
125
137
  Z: (F * G) % exports.Q,
126
138
  };
127
139
  }
128
- /** Scalar multiplication [k]P (double-and-add). k is reduced mod L; k=0 ⇒ identity. */
129
- function mul(k, p) {
140
+ /** Scalar multiplication [k]P (double-and-add), pure-BigInt. k is reduced mod L; k=0 ⇒ identity. */
141
+ function mulPure(k, p) {
130
142
  let e = k % exports.L;
131
143
  if (e < 0n)
132
144
  e += exports.L;
@@ -134,23 +146,163 @@ function mul(k, p) {
134
146
  let base = p;
135
147
  while (e > 0n) {
136
148
  if (e & 1n)
137
- acc = add(acc, base);
149
+ acc = addPure(acc, base);
138
150
  base = dbl(base);
139
151
  e >>= 1n;
140
152
  }
141
153
  return acc;
142
154
  }
143
- /** [k]·BASE. */
155
+ /** [k]·BASE, pure-BigInt. */
156
+ function mulBasePure(k) {
157
+ return mulPure(k, exports.BASE);
158
+ }
159
+ /** P − Q, pure-BigInt. */
160
+ function subPure(p1, p2) {
161
+ return addPure(p1, negPure(p2));
162
+ }
163
+ /** −P = (−X : Y : Z : −T), pure-BigInt. */
164
+ function negPure(p) {
165
+ return { X: modFq(-p.X), Y: p.Y, Z: p.Z, T: modFq(-p.T) };
166
+ }
167
+ /** `undefined` = not yet probed; `null` = probed and unavailable (use the pure fallback). */
168
+ let wasmBackend;
169
+ /** Narrow an opaque module to the `WasmCurve` surface without using `any` — every op must be present. */
170
+ function asWasmCurve(mod) {
171
+ if (typeof mod !== 'object' || mod === null)
172
+ return null;
173
+ const m = mod;
174
+ const needed = ['mulBase', 'mul', 'add', 'sub', 'neg', 'isOnCurve', 'isIdentity', 'isInSubgroup'];
175
+ for (const name of needed) {
176
+ if (typeof m[name] !== 'function')
177
+ return null;
178
+ }
179
+ return mod;
180
+ }
181
+ /**
182
+ * Lazily load the constant-time WASM curve core, once. Tries the resolved workspace dependency first,
183
+ * then the sibling package's built `dist` (the stable path whether this module runs from `src` under
184
+ * vitest or from `dist` after a build — `__dirname/../../pca-mpc-wasm/dist` is the same in both). Any
185
+ * failure (package missing, wasm cannot instantiate) is swallowed and pins the pure-BigInt fallback.
186
+ */
187
+ function wasmCurve() {
188
+ if (wasmBackend !== undefined)
189
+ return wasmBackend;
190
+ wasmBackend = null;
191
+ try {
192
+ const require = (0, node_module_1.createRequire)(__filename);
193
+ const candidates = [
194
+ '@atlasauth/pca-mpc-wasm',
195
+ (0, node_path_1.join)(__dirname, '..', '..', 'pca-mpc-wasm', 'dist', 'index.js'),
196
+ ];
197
+ for (const spec of candidates) {
198
+ try {
199
+ const loaded = asWasmCurve(require(spec));
200
+ if (loaded !== null) {
201
+ wasmBackend = loaded;
202
+ break;
203
+ }
204
+ }
205
+ catch {
206
+ // try the next candidate
207
+ }
208
+ }
209
+ }
210
+ catch {
211
+ wasmBackend = null;
212
+ }
213
+ return wasmBackend;
214
+ }
215
+ /** Whether the constant-time WASM curve backend is active (else the pure-BigInt path is in use). */
216
+ function isWasmCurveActive() {
217
+ return wasmCurve() !== null;
218
+ }
219
+ /**
220
+ * Canonical 32-byte compressed Ed25519 encoding of a point (little-endian `y`, sign of `x` in bit 255)
221
+ * — the wire form the WASM core speaks. Faithful for on-curve points; the matching inverse is
222
+ * `decompressPoint`.
223
+ */
224
+ function compressPoint(p) {
225
+ const { x, y } = toAffine(p);
226
+ const out = feBytes(y);
227
+ out[31] = (out[31] | (Number(x & 1n) << 7)) & 0xff;
228
+ return out;
229
+ }
230
+ /**
231
+ * Decode a canonical 32-byte compressed encoding back into an extended-coordinate `Point` (RFC 8032
232
+ * §5.1.3 x-recovery). Used to bring a WASM-core result back into the `Point` representation so the rest
233
+ * of `ec.ts`/`ot.ts` (affine encoding, KDF hashing, equality) sees byte-identical values to the pure
234
+ * path. Throws `PointValidationError` on a non-canonical / off-curve encoding.
235
+ */
236
+ function decompressPoint(bytes) {
237
+ if (bytes.length !== 32)
238
+ throw new PointValidationError('decompressPoint: expected 32 bytes');
239
+ const sign = (bytes[31] >> 7) & 1;
240
+ let y = 0n;
241
+ for (let i = 0; i < 32; i++)
242
+ y |= BigInt(bytes[i]) << BigInt(8 * i);
243
+ y &= (1n << 255n) - 1n; // clear the sign bit
244
+ if (y >= exports.Q)
245
+ throw new PointValidationError('decompressPoint: non-canonical y (≥ q)');
246
+ const y2 = modFq(y * y);
247
+ const u = modFq(y2 - 1n);
248
+ const v = modFq(D * y2 + 1n);
249
+ const v3 = modFq(modFq(v * v) * v);
250
+ const v7 = modFq(modFq(v3 * v3) * v);
251
+ let x = modFq(modFq(u * v3) * powFq(modFq(u * v7), (exports.Q - 5n) / 8n));
252
+ const vx2 = modFq(v * modFq(x * x));
253
+ if (vx2 === modFq(u)) {
254
+ // x is correct as-is
255
+ }
256
+ else if (vx2 === modFq(-u)) {
257
+ x = modFq(x * SQRT_M1);
258
+ }
259
+ else {
260
+ throw new PointValidationError('decompressPoint: not on curve');
261
+ }
262
+ if (x === 0n && sign === 1)
263
+ throw new PointValidationError('decompressPoint: non-canonical sign');
264
+ if (Number(x & 1n) !== sign)
265
+ x = modFq(exports.Q - x);
266
+ return fromAffine(x, y);
267
+ }
268
+ // --- Public group-op dispatchers: constant-time WASM core when loaded, pure BigInt otherwise. ---
269
+ /**
270
+ * Unified complete addition P + Q. Routes through the constant-time WASM core when available (inputs
271
+ * are on-curve points everywhere the OT stack calls this), else the pure-BigInt `add-2008-hwcd-3`.
272
+ */
273
+ function add(p1, p2) {
274
+ const w = wasmCurve();
275
+ if (w !== null)
276
+ return decompressPoint(w.add(compressPoint(p1), compressPoint(p2)));
277
+ return addPure(p1, p2);
278
+ }
279
+ /** Scalar multiplication [k]P (k reduced mod L; k=0 ⇒ identity). WASM core when available. */
280
+ function mul(k, p) {
281
+ const w = wasmCurve();
282
+ if (w !== null)
283
+ return decompressPoint(w.mul(k, compressPoint(p)));
284
+ return mulPure(k, p);
285
+ }
286
+ /** [k]·BASE. WASM core when available (the fixed-base secret-scalar multiply). */
144
287
  function mulBase(k) {
145
- return mul(k, exports.BASE);
288
+ const w = wasmCurve();
289
+ if (w !== null)
290
+ return decompressPoint(w.mulBase(k));
291
+ return mulBasePure(k);
146
292
  }
147
- /** P − Q. */
293
+ /** P − Q. WASM core when available. */
148
294
  function sub(p1, p2) {
149
- return add(p1, neg(p2));
295
+ const w = wasmCurve();
296
+ if (w !== null)
297
+ return decompressPoint(w.sub(compressPoint(p1), compressPoint(p2)));
298
+ return subPure(p1, p2);
150
299
  }
151
- /** −P = (−X : Y : Z : −T). */
300
+ /** −P. WASM core when available. */
152
301
  function neg(p) {
153
- return { X: modFq(-p.X), Y: p.Y, Z: p.Z, T: modFq(-p.T) };
302
+ const w = wasmCurve();
303
+ if (w !== null)
304
+ return decompressPoint(w.neg(compressPoint(p)));
305
+ return negPure(p);
154
306
  }
155
307
  /** Affine (x, y) of a point (one inversion). Identity ⇒ (0, 1). */
156
308
  function toAffine(p) {
@@ -210,7 +362,7 @@ function scalarMulRaw(k, p) {
210
362
  let base = p;
211
363
  while (e > 0n) {
212
364
  if (e & 1n)
213
- acc = add(acc, base);
365
+ acc = addPure(acc, base);
214
366
  base = dbl(base);
215
367
  e >>= 1n;
216
368
  }
@@ -247,9 +399,26 @@ function isIdentity(p) {
247
399
  * (identity) or order `L`. So on-curve ∧ `hasPrimeOrder` ∧ ¬identity ⟺ a genuine prime-order point.
248
400
  * Rejects every small-order point (order | 8) and every mixed-order point (order `h·L`, `h | 8`, `h>1`).
249
401
  */
250
- function hasPrimeOrder(p) {
402
+ function hasPrimeOrderPure(p) {
251
403
  return equal(scalarMulRaw(exports.L, p), exports.IDENTITY);
252
404
  }
405
+ /**
406
+ * The cofactor check `[L]·P = O`. When the constant-time WASM core is loaded, the `[L]·P` scalar work
407
+ * runs inside it (the point is compressed to its canonical 32-byte form — faithful for ON-curve points,
408
+ * which is the only case this is reached with in the validation flow — and the core's torsion check is
409
+ * exactly `[L]·P = O`); otherwise it falls back to the pure-BigInt raw ladder. Both agree bit-for-bit
410
+ * (the `[L]·P = O ⟺ torsion-free ∨ identity` equivalence), so the observable result is identical.
411
+ */
412
+ function hasPrimeOrder(p) {
413
+ const w = wasmCurve();
414
+ if (w !== null && isOnCurve(p)) {
415
+ const c = compressPoint(p);
416
+ // torsion-free ⟺ order 1 or L; include the identity explicitly so this matches the pure
417
+ // `[L]·O = O ⇒ true` semantics (the pure ladder returns true for the identity too).
418
+ return w.isInSubgroup(c) || w.isIdentity(c);
419
+ }
420
+ return hasPrimeOrderPure(p);
421
+ }
253
422
  /** Whether `p` is a valid non-identity point of the prime-order subgroup (the OT point contract). */
254
423
  function isInSubgroup(p) {
255
424
  return isOnCurve(p) && !isIdentity(p) && hasPrimeOrder(p);
package/dist/ec.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ec.js","sourceRoot":"","sources":["../src/ec.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;AA+BH,sBAGC;AA6BD,kBAeC;AAMD,kBAgBC;AAGD,kBAWC;AAGD,0BAEC;AAGD,kBAEC;AAGD,kBAEC;AAGD,4BAGC;AAGD,sBAKC;AAcD,kCAMC;AA8CD,8BAWC;AAGD,gCAEC;AAQD,sCAEC;AAGD,oCAEC;AAGD,4CAMC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