@invisi-labs/primitives 0.0.0-stage → 1.2.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 +4 -2
- package/dist/address.cjs +263 -0
- package/dist/address.cjs.map +1 -0
- package/dist/address.d.cts +35 -0
- package/dist/address.d.ts +35 -0
- package/dist/address.js +10 -0
- package/dist/address.js.map +1 -0
- package/dist/chunk-3SEC7POH.js +168 -0
- package/dist/chunk-3SEC7POH.js.map +1 -0
- package/dist/chunk-Q3NNEKKR.js +147 -0
- package/dist/chunk-Q3NNEKKR.js.map +1 -0
- package/dist/chunk-QAC5T4S5.js +1162 -0
- package/dist/chunk-QAC5T4S5.js.map +1 -0
- package/dist/chunk-XM4B6K37.js +21 -0
- package/dist/chunk-XM4B6K37.js.map +1 -0
- package/dist/credit.cjs +1125 -0
- package/dist/credit.cjs.map +1 -0
- package/dist/credit.d.cts +68 -0
- package/dist/credit.d.ts +68 -0
- package/dist/credit.js +42 -0
- package/dist/credit.js.map +1 -0
- package/dist/encryption-Bzsl9VQk.d.ts +35 -0
- package/dist/encryption-P2HJ89FQ.d.cts +35 -0
- package/dist/index.cjs +2796 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +511 -0
- package/dist/index.d.ts +511 -0
- package/dist/index.js +1336 -0
- package/dist/index.js.map +1 -0
- package/dist/note.cjs +887 -0
- package/dist/note.cjs.map +1 -0
- package/dist/note.d.cts +12 -0
- package/dist/note.d.ts +12 -0
- package/dist/note.js +18 -0
- package/dist/note.js.map +1 -0
- package/dist/types-CEAuh35C.d.cts +80 -0
- package/dist/types-CEAuh35C.d.ts +80 -0
- package/package.json +52 -3
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// src/fmd/fmd.ts
|
|
2
|
+
import { blake2b as blake2b2 } from "@noble/hashes/blake2b";
|
|
3
|
+
import { concatBytes, utf8ToBytes } from "@noble/hashes/utils";
|
|
4
|
+
|
|
5
|
+
// src/fmd/decaf377.ts
|
|
6
|
+
import { twistedEdwards } from "@noble/curves/abstract/edwards";
|
|
7
|
+
import { Field, mod } from "@noble/curves/abstract/modular";
|
|
8
|
+
import { blake2b } from "@noble/hashes/blake2b";
|
|
9
|
+
var FQ = 8444461749428370424248824938781546531375899335154063827935233455917409239041n;
|
|
10
|
+
var FR = 2111115437357092606062206234695386632838870926408408195193685246394721360383n;
|
|
11
|
+
var field = Field(FQ, 253, true);
|
|
12
|
+
var f = (n) => mod(n, FQ);
|
|
13
|
+
var abs = (n) => (n & 1n) === 0n ? n : f(-n);
|
|
14
|
+
function secureRandomBytes(length) {
|
|
15
|
+
const webCrypto = globalThis.crypto;
|
|
16
|
+
if (!webCrypto?.getRandomValues) throw new Error("WebCrypto secure randomness is unavailable");
|
|
17
|
+
return webCrypto.getRandomValues(new Uint8Array(length));
|
|
18
|
+
}
|
|
19
|
+
var curve = twistedEdwards({
|
|
20
|
+
a: FQ - 1n,
|
|
21
|
+
d: 3021n,
|
|
22
|
+
Fp: field,
|
|
23
|
+
n: FR,
|
|
24
|
+
h: 4n,
|
|
25
|
+
Gx: 4959445789346820725352484487855828915252512307947624787834978378872129235627n,
|
|
26
|
+
Gy: 6060471950081851567114691557659790004756535011754163002297540472747064943288n,
|
|
27
|
+
hash: blake2b,
|
|
28
|
+
randomBytes: (length = 32) => secureRandomBytes(length)
|
|
29
|
+
});
|
|
30
|
+
var generator = curve.ExtendedPoint.BASE;
|
|
31
|
+
function readLE(bytes) {
|
|
32
|
+
let n = 0n;
|
|
33
|
+
for (let i = bytes.length - 1; i >= 0; i--) n = n << 8n | BigInt(bytes[i]);
|
|
34
|
+
return n;
|
|
35
|
+
}
|
|
36
|
+
function writeLE(n) {
|
|
37
|
+
const bytes = new Uint8Array(32);
|
|
38
|
+
for (let i = 0; i < 32; i++) {
|
|
39
|
+
bytes[i] = Number(n & 255n);
|
|
40
|
+
n >>= 8n;
|
|
41
|
+
}
|
|
42
|
+
return bytes;
|
|
43
|
+
}
|
|
44
|
+
function multiply(point, scalar) {
|
|
45
|
+
return scalar === 0n ? curve.ExtendedPoint.ZERO : point.multiply(scalar);
|
|
46
|
+
}
|
|
47
|
+
function inverseScalar(scalar) {
|
|
48
|
+
return Field(FR).inv(scalar);
|
|
49
|
+
}
|
|
50
|
+
function decodePoint(bytes) {
|
|
51
|
+
if (!(bytes instanceof Uint8Array) || bytes.length !== 32)
|
|
52
|
+
throw new Error("Invalid Decaf377 encoding length");
|
|
53
|
+
const s = readLE(bytes);
|
|
54
|
+
if (s >= FQ || (s & 1n) !== 0n || bytes[31] >> 5 !== 0)
|
|
55
|
+
throw new Error("Invalid Decaf377 encoding");
|
|
56
|
+
const ss = f(s * s);
|
|
57
|
+
const u1 = f(1n - ss);
|
|
58
|
+
const u2 = f(u1 * u1 - 4n * 3021n * ss);
|
|
59
|
+
const denominator = f(u2 * u1 * u1);
|
|
60
|
+
if (denominator === 0n) throw new Error("Invalid Decaf377 encoding");
|
|
61
|
+
let v;
|
|
62
|
+
try {
|
|
63
|
+
v = field.sqrt(field.inv(denominator));
|
|
64
|
+
} catch {
|
|
65
|
+
throw new Error("Invalid Decaf377 encoding");
|
|
66
|
+
}
|
|
67
|
+
const twoSU1 = f(2n * s * u1);
|
|
68
|
+
if ((f(twoSU1 * v) & 1n) !== 0n) v = f(-v);
|
|
69
|
+
const x = f(twoSU1 * v * v * u2);
|
|
70
|
+
const y = f((1n + ss) * v * u1);
|
|
71
|
+
return curve.ExtendedPoint.fromAffine({ x, y });
|
|
72
|
+
}
|
|
73
|
+
function encodePoint(point) {
|
|
74
|
+
const { ex: x, ez: z, et: t } = point;
|
|
75
|
+
if (x === 0n) return new Uint8Array(32);
|
|
76
|
+
const aMinusD = -3022n;
|
|
77
|
+
const u1 = f((x + t) * (x - t));
|
|
78
|
+
const denominator = f(u1 * aMinusD * x * x);
|
|
79
|
+
const v = field.sqrt(field.inv(denominator));
|
|
80
|
+
const u2 = abs(f(v * u1));
|
|
81
|
+
const u3 = f(u2 * z - t);
|
|
82
|
+
return writeLE(abs(f(aMinusD * v * u3 * x)));
|
|
83
|
+
}
|
|
84
|
+
function isIdentity(point) {
|
|
85
|
+
return point.ex === 0n;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// src/fmd/fmd.ts
|
|
89
|
+
var PRECISION = 24;
|
|
90
|
+
function requireBytes(value, length, name) {
|
|
91
|
+
if (!(value instanceof Uint8Array) || value.length !== length)
|
|
92
|
+
throw new TypeError(`${name} must be a ${length}-byte Uint8Array`);
|
|
93
|
+
}
|
|
94
|
+
function detectionScalar(key) {
|
|
95
|
+
requireBytes(key, 32, "Detection key");
|
|
96
|
+
const scalar = readLE(key);
|
|
97
|
+
if (scalar === 0n || scalar >= FR)
|
|
98
|
+
throw new Error("Detection key must be a canonical nonzero Decaf377 scalar");
|
|
99
|
+
return scalar;
|
|
100
|
+
}
|
|
101
|
+
function hash(domain, ...parts) {
|
|
102
|
+
const personalization = new Uint8Array(16);
|
|
103
|
+
personalization.set(utf8ToBytes(`decaf377-fmd.${domain}`));
|
|
104
|
+
return blake2b2(concatBytes(...parts), { dkLen: 64, personalization });
|
|
105
|
+
}
|
|
106
|
+
var hashScalar = (domain, ...parts) => readLE(hash(domain, ...parts)) % FR;
|
|
107
|
+
var childOffset = (clueKey, index) => hashScalar("hkd", clueKey, Uint8Array.of(index));
|
|
108
|
+
var hashBit = (p, shared, q) => hash("bit", p, shared, q)[0] & 1;
|
|
109
|
+
function deriveClueKey(detectionKey) {
|
|
110
|
+
return encodePoint(multiply(generator, detectionScalar(detectionKey)));
|
|
111
|
+
}
|
|
112
|
+
function validateClueKey(clueKey) {
|
|
113
|
+
requireBytes(clueKey, 32, "Clue key");
|
|
114
|
+
if (isIdentity(decodePoint(clueKey))) throw new Error("Clue key must not be the identity");
|
|
115
|
+
}
|
|
116
|
+
function createClue(clueKey) {
|
|
117
|
+
validateClueKey(clueKey);
|
|
118
|
+
return createClueFromSeed(clueKey, secureRandomBytes(32));
|
|
119
|
+
}
|
|
120
|
+
function createClueFromSeed(clueKey, seed32) {
|
|
121
|
+
validateClueKey(clueKey);
|
|
122
|
+
requireBytes(seed32, 32, "Clue seed");
|
|
123
|
+
const root = decodePoint(clueKey);
|
|
124
|
+
const r = hashScalar("rdv", clueKey, seed32);
|
|
125
|
+
const z = hashScalar("zdv", clueKey, seed32);
|
|
126
|
+
if (r === 0n) throw new Error("Degenerate clue seed");
|
|
127
|
+
const p = encodePoint(multiply(generator, r));
|
|
128
|
+
const q = encodePoint(multiply(generator, z));
|
|
129
|
+
const ciphertext = new Uint8Array(3);
|
|
130
|
+
for (let i = 0; i < PRECISION; i++) {
|
|
131
|
+
const child = root.add(multiply(generator, childOffset(clueKey, i)));
|
|
132
|
+
const shared = encodePoint(multiply(child, r));
|
|
133
|
+
ciphertext[i >> 3] = ciphertext[i >> 3] | (hashBit(p, shared, q) ^ 1) << (i & 7);
|
|
134
|
+
}
|
|
135
|
+
const m = hashScalar("sca", p, Uint8Array.of(PRECISION), ciphertext);
|
|
136
|
+
const y = (z - m + FR) * inverseScalar(r) % FR;
|
|
137
|
+
if (y === 0n) throw new Error("Degenerate clue seed");
|
|
138
|
+
return concatBytes(p, writeLE(y), Uint8Array.of(PRECISION), ciphertext);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export {
|
|
142
|
+
deriveClueKey,
|
|
143
|
+
validateClueKey,
|
|
144
|
+
createClue,
|
|
145
|
+
createClueFromSeed
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=chunk-Q3NNEKKR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/fmd/fmd.ts","../src/fmd/decaf377.ts"],"sourcesContent":["/**\n * Frozen S-FMD profile: decaf377-fmd 2.1.1, 24-bit clues (68 bytes).\n * Only FMD detection keys belong here; these are not transaction ownership keys.\n *\n * SECURITY: the noble Edwards arithmetic and this exact Decaf codec port use\n * JavaScript BigInt. They do not provide constant-time execution or reliable\n * secret erasure. This new composition has not received an independent audit.\n */\nimport { blake2b } from \"@noble/hashes/blake2b\";\nimport { concatBytes, utf8ToBytes } from \"@noble/hashes/utils\";\nimport {\n FR,\n decodePoint,\n encodePoint,\n generator,\n inverseScalar,\n isIdentity,\n multiply,\n readLE,\n secureRandomBytes,\n writeLE,\n} from \"./decaf377.js\";\n\nconst PRECISION = 24;\nfunction requireBytes(value: Uint8Array, length: number, name: string): void {\n if (!(value instanceof Uint8Array) || value.length !== length)\n throw new TypeError(`${name} must be a ${length}-byte Uint8Array`);\n}\nfunction detectionScalar(key: Uint8Array): bigint {\n requireBytes(key, 32, \"Detection key\");\n const scalar = readLE(key);\n if (scalar === 0n || scalar >= FR)\n throw new Error(\"Detection key must be a canonical nonzero Decaf377 scalar\");\n return scalar;\n}\nfunction hash(domain: string, ...parts: Uint8Array[]): Uint8Array {\n // Rust blake2b_simd defaults to 64 output bytes and zero-pads personalization.\n const personalization = new Uint8Array(16);\n personalization.set(utf8ToBytes(`decaf377-fmd.${domain}`));\n return blake2b(concatBytes(...parts), { dkLen: 64, personalization });\n}\nconst hashScalar = (domain: string, ...parts: Uint8Array[]) => readLE(hash(domain, ...parts)) % FR;\nconst childOffset = (clueKey: Uint8Array, index: number) =>\n hashScalar(\"hkd\", clueKey, Uint8Array.of(index));\nconst hashBit = (p: Uint8Array, shared: Uint8Array, q: Uint8Array) =>\n hash(\"bit\", p, shared, q)[0]! & 1;\n\n/** Derive the canonical 32-byte Decaf377 clue key from a nonzero FMD scalar. */\nexport function deriveClueKey(detectionKey: Uint8Array): Uint8Array {\n return encodePoint(multiply(generator, detectionScalar(detectionKey)));\n}\n/** Reject malformed, noncanonical, or identity clue keys. */\nexport function validateClueKey(clueKey: Uint8Array): void {\n requireBytes(clueKey, 32, \"Clue key\");\n if (isIdentity(decodePoint(clueKey))) throw new Error(\"Clue key must not be the identity\");\n}\n/** Create a fixed 24-bit clue using a fresh WebCrypto random seed. */\nexport function createClue(clueKey: Uint8Array): Uint8Array {\n validateClueKey(clueKey);\n return createClueFromSeed(clueKey, secureRandomBytes(32));\n}\n/**\n * Deterministic interoperability/backend entry point. Seed must be independently\n * generated with a CSPRNG for every production clue; never reuse a fixed seed.\n */\nexport function createClueFromSeed(clueKey: Uint8Array, seed32: Uint8Array): Uint8Array {\n validateClueKey(clueKey);\n requireBytes(seed32, 32, \"Clue seed\");\n const root = decodePoint(clueKey);\n const r = hashScalar(\"rdv\", clueKey, seed32);\n const z = hashScalar(\"zdv\", clueKey, seed32);\n if (r === 0n) throw new Error(\"Degenerate clue seed\");\n const p = encodePoint(multiply(generator, r));\n const q = encodePoint(multiply(generator, z));\n const ciphertext = new Uint8Array(3);\n for (let i = 0; i < PRECISION; i++) {\n const child = root.add(multiply(generator, childOffset(clueKey, i)));\n const shared = encodePoint(multiply(child, r));\n ciphertext[i >> 3] = ciphertext[i >> 3]! | ((hashBit(p, shared, q) ^ 1) << (i & 7));\n }\n const m = hashScalar(\"sca\", p, Uint8Array.of(PRECISION), ciphertext);\n const y = ((z - m + FR) * inverseScalar(r)) % FR;\n if (y === 0n) throw new Error(\"Degenerate clue seed\");\n return concatBytes(p, writeLE(y), Uint8Array.of(PRECISION), ciphertext);\n}\n\n/** Check a full-precision clue locally without exporting the detection key. */\nexport function detectClue(detectionKey: Uint8Array, clue: Uint8Array): boolean {\n const scalar = detectionScalar(detectionKey);\n requireBytes(clue, 68, \"Clue\");\n if (clue[64] !== PRECISION) return false;\n const p = clue.slice(0, 32),\n y = readLE(clue.slice(32, 64));\n if (y === 0n || y >= FR) return false;\n let point;\n try {\n point = decodePoint(p);\n } catch {\n return false;\n }\n if (isIdentity(point)) return false;\n const ciphertext = clue.slice(65);\n const m = hashScalar(\"sca\", p, Uint8Array.of(PRECISION), ciphertext);\n const q = encodePoint(multiply(generator, m).add(multiply(point, y)));\n const clueKey = deriveClueKey(detectionKey);\n for (let i = 0; i < PRECISION; i++) {\n const child = (scalar + childOffset(clueKey, i)) % FR;\n const bit = hashBit(p, encodePoint(multiply(point, child)), q);\n if ((bit ^ ((ciphertext[i >> 3]! >> (i & 7)) & 1)) !== 1) return false;\n }\n return true;\n}\n","/**\n * Internal Decaf377 codec, ported from decaf377 0.10.1 min_curve/element.rs.\n * Edwards group/field arithmetic is supplied by @noble/curves 1.9.1. The\n * Montgomery constants below are converted to ordinary field integers.\n * This JavaScript BigInt backend is NOT constant-time and has not been audited.\n */\nimport { twistedEdwards, type ExtPointType } from \"@noble/curves/abstract/edwards\";\nimport { Field, mod } from \"@noble/curves/abstract/modular\";\nimport { blake2b } from \"@noble/hashes/blake2b\";\n\nexport const FQ = 8444461749428370424248824938781546531375899335154063827935233455917409239041n;\nexport const FR = 2111115437357092606062206234695386632838870926408408195193685246394721360383n;\nconst field = Field(FQ, 253, true);\nconst f = (n: bigint) => mod(n, FQ);\nconst abs = (n: bigint) => ((n & 1n) === 0n ? n : f(-n));\n\nexport function secureRandomBytes(length: number): Uint8Array {\n const webCrypto = (\n globalThis as { crypto?: { getRandomValues(array: Uint8Array): Uint8Array } }\n ).crypto;\n if (!webCrypto?.getRandomValues) throw new Error(\"WebCrypto secure randomness is unavailable\");\n return webCrypto.getRandomValues(new Uint8Array(length));\n}\n\nconst curve = twistedEdwards({\n a: FQ - 1n,\n d: 3021n,\n Fp: field,\n n: FR,\n h: 4n,\n Gx: 4959445789346820725352484487855828915252512307947624787834978378872129235627n,\n Gy: 6060471950081851567114691557659790004756535011754163002297540472747064943288n,\n hash: blake2b,\n randomBytes: (length = 32) => secureRandomBytes(length),\n});\nexport type DecafPoint = ExtPointType;\nexport const generator: DecafPoint = curve.ExtendedPoint.BASE;\n\nexport function readLE(bytes: Uint8Array): bigint {\n let n = 0n;\n for (let i = bytes.length - 1; i >= 0; i--) n = (n << 8n) | BigInt(bytes[i]!);\n return n;\n}\nexport function writeLE(n: bigint): Uint8Array {\n const bytes = new Uint8Array(32);\n for (let i = 0; i < 32; i++) {\n bytes[i] = Number(n & 255n);\n n >>= 8n;\n }\n return bytes;\n}\nexport function multiply(point: DecafPoint, scalar: bigint): DecafPoint {\n return scalar === 0n ? curve.ExtendedPoint.ZERO : point.multiply(scalar);\n}\nexport function inverseScalar(scalar: bigint): bigint {\n // Noble's field inversion uses Euclid. Neither this nor BigInt is constant-time.\n return Field(FR).inv(scalar);\n}\n\n/** Canonical Decaf decoding, including the low-bit sign convention. */\nexport function decodePoint(bytes: Uint8Array): DecafPoint {\n if (!(bytes instanceof Uint8Array) || bytes.length !== 32)\n throw new Error(\"Invalid Decaf377 encoding length\");\n const s = readLE(bytes);\n if (s >= FQ || (s & 1n) !== 0n || bytes[31]! >> 5 !== 0)\n throw new Error(\"Invalid Decaf377 encoding\");\n const ss = f(s * s);\n const u1 = f(1n - ss);\n const u2 = f(u1 * u1 - 4n * 3021n * ss);\n const denominator = f(u2 * u1 * u1);\n // This is the square branch of Rust sqrt_ratio_zeta(1, denominator).\n // Decompression rejects the nonsquare branch; root sign is fixed below.\n if (denominator === 0n) throw new Error(\"Invalid Decaf377 encoding\");\n let v: bigint;\n try {\n v = field.sqrt(field.inv(denominator));\n } catch {\n throw new Error(\"Invalid Decaf377 encoding\");\n }\n const twoSU1 = f(2n * s * u1);\n if ((f(twoSU1 * v) & 1n) !== 0n) v = f(-v);\n const x = f(twoSU1 * v * v * u2);\n const y = f((1n + ss) * v * u1);\n return curve.ExtendedPoint.fromAffine({ x, y });\n}\nexport function encodePoint(point: DecafPoint): Uint8Array {\n const { ex: x, ez: z, et: t } = point;\n if (x === 0n) return new Uint8Array(32);\n const aMinusD = -3022n;\n const u1 = f((x + t) * (x - t));\n const denominator = f(u1 * aMinusD * x * x);\n const v = field.sqrt(field.inv(denominator));\n const u2 = abs(f(v * u1));\n const u3 = f(u2 * z - t);\n return writeLE(abs(f(aMinusD * v * u3 * x)));\n}\nexport function isIdentity(point: DecafPoint): boolean {\n return point.ex === 0n;\n}\n"],"mappings":";AAQA,SAAS,WAAAA,gBAAe;AACxB,SAAS,aAAa,mBAAmB;;;ACHzC,SAAS,sBAAyC;AAClD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