@me2em/core 0.7.0-alpha.2 → 1.0.0-rc.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 +179 -32
- package/dist/attestation.d.ts +26 -17
- package/dist/attestation.d.ts.map +1 -1
- package/dist/attestation.js +76 -29
- package/dist/attestation.js.map +1 -1
- package/dist/canonical-name.d.ts +18 -0
- package/dist/canonical-name.d.ts.map +1 -1
- package/dist/canonical-name.js +28 -1
- package/dist/canonical-name.js.map +1 -1
- package/dist/crypto/derivation-paths.d.ts +33 -2
- package/dist/crypto/derivation-paths.d.ts.map +1 -1
- package/dist/crypto/derivation-paths.js +33 -2
- package/dist/crypto/derivation-paths.js.map +1 -1
- package/dist/crypto/derivation.d.ts +47 -0
- package/dist/crypto/derivation.d.ts.map +1 -0
- package/dist/crypto/derivation.js +68 -0
- package/dist/crypto/derivation.js.map +1 -0
- package/dist/crypto/ecdh.d.ts +19 -0
- package/dist/crypto/ecdh.d.ts.map +1 -0
- package/dist/crypto/ecdh.js +33 -0
- package/dist/crypto/ecdh.js.map +1 -0
- package/dist/crypto/ed25519.d.ts +24 -3
- package/dist/crypto/ed25519.d.ts.map +1 -1
- package/dist/crypto/ed25519.js +39 -6
- package/dist/crypto/ed25519.js.map +1 -1
- package/dist/crypto/hkdf.d.ts +10 -1
- package/dist/crypto/hkdf.d.ts.map +1 -1
- package/dist/crypto/hkdf.js +10 -1
- package/dist/crypto/hkdf.js.map +1 -1
- package/dist/crypto/index.d.ts +25 -0
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +25 -0
- package/dist/crypto/index.js.map +1 -1
- package/dist/disposed-error.d.ts +24 -0
- package/dist/disposed-error.d.ts.map +1 -0
- package/dist/disposed-error.js +39 -0
- package/dist/disposed-error.js.map +1 -0
- package/dist/errors.d.ts +67 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +54 -0
- package/dist/errors.js.map +1 -0
- package/dist/handle.d.ts +300 -14
- package/dist/handle.d.ts.map +1 -1
- package/dist/handle.js +463 -54
- package/dist/handle.js.map +1 -1
- package/dist/identity.d.ts +55 -11
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +105 -35
- package/dist/identity.js.map +1 -1
- package/dist/index.d.ts +9 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/seed.d.ts +15 -11
- package/dist/seed.d.ts.map +1 -1
- package/dist/seed.js +23 -17
- package/dist/seed.js.map +1 -1
- package/dist/session.d.ts +42 -5
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +248 -117
- package/dist/session.js.map +1 -1
- package/dist/subhandle.d.ts +1 -125
- package/dist/subhandle.d.ts.map +1 -1
- package/dist/subhandle.js +12 -179
- package/dist/subhandle.js.map +1 -1
- package/dist/types.d.ts +22 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/util.d.ts +47 -0
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +72 -20
- package/dist/util.js.map +1 -1
- package/package.json +10 -4
- package/src/attestation.ts +88 -38
- package/src/canonical-name.ts +33 -1
- package/src/crypto/derivation-paths.ts +37 -2
- package/src/crypto/derivation.ts +90 -0
- package/src/crypto/ecdh.ts +37 -0
- package/src/crypto/ed25519.ts +39 -6
- package/src/crypto/hkdf.ts +10 -1
- package/src/crypto/index.ts +28 -1
- package/src/disposed-error.ts +45 -0
- package/src/errors.ts +88 -0
- package/src/handle.ts +630 -65
- package/src/identity.ts +111 -64
- package/src/index.ts +10 -6
- package/src/seed.ts +27 -17
- package/src/session.ts +336 -132
- package/src/subhandle.ts +12 -251
- package/src/types.ts +26 -0
- package/src/util.ts +78 -20
package/dist/attestation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestation.js","sourceRoot":"","sources":["../src/attestation.ts"],"names":[],"mappings":"AAAA,iBAAiB;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;YACR,GAAG;YACH,GAAG;SACJ,CAAC;QAEF,MAAM,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QACvE,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAClD,MAAM,UAAU,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;QACjD,MAAM,YAAY,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,GAAG,UAAU,IAAI,YAAY,EAAE,CAAC;QAE9C,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACzC,CAAC;CACF"}
|
package/dist/canonical-name.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
export declare const NAME_PATTERN: RegExp;
|
|
2
2
|
export declare function normalizeName(raw: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* Canonicalizes a password/channel context: NFKC → lowercase → trim.
|
|
5
|
+
*
|
|
6
|
+
* Same canonical form as {@link normalizeName} names use, minus the
|
|
7
|
+
* character-set pattern — a context is a caller-defined HKDF label, not
|
|
8
|
+
* a wire identifier. The canonical context is embedded verbatim into the
|
|
9
|
+
* derivation salt (`me2em/secret/{context}`, `me2em/channel/{context}`),
|
|
10
|
+
* so `' GitHub '`, `'github'` and the fullwidth `'GitHub'` all map to
|
|
11
|
+
* the same secret (specs/v1.0.md §1, since the revisions PR-8; the
|
|
12
|
+
* pre-revision rule was lowercase → trim without NFKC).
|
|
13
|
+
*
|
|
14
|
+
* @param raw - Caller-defined context, e.g. `'github'`, `'telemetry-v1'`.
|
|
15
|
+
* @returns The canonical context.
|
|
16
|
+
* @throws TypeError if `raw` is not a string (API misuse).
|
|
17
|
+
* @throws AttestationError `MALFORMED`/`FORMAT` if the context is empty
|
|
18
|
+
* after canonicalization.
|
|
19
|
+
*/
|
|
20
|
+
export declare function normalizeContext(raw: string): string;
|
|
3
21
|
//# sourceMappingURL=canonical-name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-name.d.ts","sourceRoot":"","sources":["../src/canonical-name.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"canonical-name.d.ts","sourceRoot":"","sources":["../src/canonical-name.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,QAAiC,CAAC;AAE3D,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAWpD"}
|
package/dist/canonical-name.js
CHANGED
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
// canonical-name.ts
|
|
2
|
+
import { AttestationError } from './errors.js';
|
|
2
3
|
export const NAME_PATTERN = /^[a-z0-9][a-z0-9._@-]{0,62}$/;
|
|
3
4
|
export function normalizeName(raw) {
|
|
4
5
|
if (typeof raw !== 'string')
|
|
5
6
|
throw new TypeError('Name must be a string');
|
|
6
7
|
const name = raw.normalize('NFKC').toLowerCase().trim();
|
|
7
8
|
if (!NAME_PATTERN.test(name)) {
|
|
8
|
-
throw new
|
|
9
|
+
throw new AttestationError('MALFORMED', 'FORMAT', `Invalid name: ${JSON.stringify(raw)}`);
|
|
9
10
|
}
|
|
10
11
|
return name;
|
|
11
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Canonicalizes a password/channel context: NFKC → lowercase → trim.
|
|
15
|
+
*
|
|
16
|
+
* Same canonical form as {@link normalizeName} names use, minus the
|
|
17
|
+
* character-set pattern — a context is a caller-defined HKDF label, not
|
|
18
|
+
* a wire identifier. The canonical context is embedded verbatim into the
|
|
19
|
+
* derivation salt (`me2em/secret/{context}`, `me2em/channel/{context}`),
|
|
20
|
+
* so `' GitHub '`, `'github'` and the fullwidth `'GitHub'` all map to
|
|
21
|
+
* the same secret (specs/v1.0.md §1, since the revisions PR-8; the
|
|
22
|
+
* pre-revision rule was lowercase → trim without NFKC).
|
|
23
|
+
*
|
|
24
|
+
* @param raw - Caller-defined context, e.g. `'github'`, `'telemetry-v1'`.
|
|
25
|
+
* @returns The canonical context.
|
|
26
|
+
* @throws TypeError if `raw` is not a string (API misuse).
|
|
27
|
+
* @throws AttestationError `MALFORMED`/`FORMAT` if the context is empty
|
|
28
|
+
* after canonicalization.
|
|
29
|
+
*/
|
|
30
|
+
export function normalizeContext(raw) {
|
|
31
|
+
if (typeof raw !== 'string')
|
|
32
|
+
throw new TypeError('Context must be a string');
|
|
33
|
+
const ctx = raw.normalize('NFKC').toLowerCase().trim();
|
|
34
|
+
if (ctx.length === 0) {
|
|
35
|
+
throw new AttestationError('MALFORMED', 'FORMAT', `Context must not be empty after canonicalization: ${JSON.stringify(raw)}`);
|
|
36
|
+
}
|
|
37
|
+
return ctx;
|
|
38
|
+
}
|
|
12
39
|
//# sourceMappingURL=canonical-name.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical-name.js","sourceRoot":"","sources":["../src/canonical-name.ts"],"names":[],"mappings":"AAAA,oBAAoB;AAEpB,MAAM,CAAC,MAAM,YAAY,GAAG,8BAA8B,CAAC;AAE3D,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;IAC1E,MAAM,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACxD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"canonical-name.js","sourceRoot":"","sources":["../src/canonical-name.ts"],"names":[],"mappings":"AAAA,oBAAoB;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAG,8BAA8B,CAAC;AAE3D,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,MAAM,IAAI,SAAS,CAAC,uBAAuB,CAAC,CAAC;IAC1E,MAAM,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACxD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,gBAAgB,CAAC,WAAW,EAAE,QAAQ,EAAE,iBAAiB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,MAAM,IAAI,SAAS,CAAC,0BAA0B,CAAC,CAAC;IAC7E,MAAM,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACvD,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrB,MAAM,IAAI,gBAAgB,CACxB,WAAW,EACX,QAAQ,EACR,qDAAqD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAC3E,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Deterministic derivation paths for the
|
|
2
|
+
* Deterministic derivation paths for the Me2eM protocol.
|
|
3
3
|
*
|
|
4
4
|
* All HKDF info strings used to derive Identity, Handle, and SubHandle keys
|
|
5
5
|
* are centralized here. This guarantees that:
|
|
@@ -31,11 +31,42 @@ export declare const DERIVATION_PATHS: {
|
|
|
31
31
|
*/
|
|
32
32
|
readonly subhandle: (handleName: string, subName: string) => string;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Info string for peer-to-peer channel key derivation.
|
|
35
35
|
* v2 binds both peers' public keys into the derivation, preventing
|
|
36
36
|
* unknown key-share attacks. The peer keys are appended in sorted
|
|
37
37
|
* order so both parties derive the identical string.
|
|
38
38
|
*/
|
|
39
39
|
readonly p2pChannelV2: "me2em/p2p-channel/v2";
|
|
40
|
+
/**
|
|
41
|
+
* Builds the info string for password (secret) derivation.
|
|
42
|
+
*
|
|
43
|
+
* Revision model (PR-8, D3): revision `1` — the initial revision — and
|
|
44
|
+
* an omitted revision both yield the frozen v1 info string, so the
|
|
45
|
+
* default derivation is byte-identical to the pre-revision protocol.
|
|
46
|
+
* Revision `N ≥ 2` appends a `/rN` path segment and derives a secret
|
|
47
|
+
* that is cryptographically independent of revision 1 for the same
|
|
48
|
+
* context — the sanctioned rotation path (specs/v1.0.md §3, PLAN-LTS
|
|
49
|
+
* §4 derivation-freeze rule).
|
|
50
|
+
*
|
|
51
|
+
* @param revision - Positive integer revision; default `1`.
|
|
52
|
+
* @returns The info string, e.g. `"me2em/secret/v1"` or `"me2em/secret/v1/r2"`.
|
|
53
|
+
*
|
|
54
|
+
* @since 0.8.0
|
|
55
|
+
*/
|
|
56
|
+
readonly password: (revision?: number) => string;
|
|
57
|
+
/**
|
|
58
|
+
* Builds the info string for channel-key derivation.
|
|
59
|
+
*
|
|
60
|
+
* Same revision model as {@link DERIVATION_PATHS.password}: revision
|
|
61
|
+
* `1`/omitted yields the frozen `"me2em/channel/v1"`; revision
|
|
62
|
+
* `N ≥ 2` yields `"me2em/channel/v1/rN"` — an independent key for
|
|
63
|
+
* rotating a compromised channel without changing the context.
|
|
64
|
+
*
|
|
65
|
+
* @param revision - Positive integer revision; default `1`.
|
|
66
|
+
* @returns The info string, e.g. `"me2em/channel/v1"` or `"me2em/channel/v1/r2"`.
|
|
67
|
+
*
|
|
68
|
+
* @since 0.8.0
|
|
69
|
+
*/
|
|
70
|
+
readonly channel: (revision?: number) => string;
|
|
40
71
|
};
|
|
41
72
|
//# sourceMappingURL=derivation-paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derivation-paths.d.ts","sourceRoot":"","sources":["../../src/crypto/derivation-paths.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;;OAGG;;IAGH;;;;;OAKG;4BACY,MAAM,KAAG,MAAM;IAG9B;;;;;;OAMG;qCACqB,MAAM,WAAW,MAAM,KAAG,MAAM;IAGxD;;;;;OAKG;;
|
|
1
|
+
{"version":3,"file":"derivation-paths.d.ts","sourceRoot":"","sources":["../../src/crypto/derivation-paths.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB;IAC3B;;;OAGG;;IAGH;;;;;OAKG;4BACY,MAAM,KAAG,MAAM;IAG9B;;;;;;OAMG;qCACqB,MAAM,WAAW,MAAM,KAAG,MAAM;IAGxD;;;;;OAKG;;IAGH;;;;;;;;;;;;;;;OAeG;mCACkB,MAAM,KAAO,MAAM;IAGxC;;;;;;;;;;;;OAYG;kCACiB,MAAM,KAAO,MAAM;CAE/B,CAAC"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// protocol version.
|
|
9
9
|
import { normalizeName } from '../canonical-name.js';
|
|
10
10
|
/**
|
|
11
|
-
* Deterministic derivation paths for the
|
|
11
|
+
* Deterministic derivation paths for the Me2eM protocol.
|
|
12
12
|
*
|
|
13
13
|
* All HKDF info strings used to derive Identity, Handle, and SubHandle keys
|
|
14
14
|
* are centralized here. This guarantees that:
|
|
@@ -40,11 +40,42 @@ export const DERIVATION_PATHS = {
|
|
|
40
40
|
*/
|
|
41
41
|
subhandle: (handleName, subName) => `me2em/subhandle/v1/${normalizeName(handleName)}/${normalizeName(subName)}`,
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Info string for peer-to-peer channel key derivation.
|
|
44
44
|
* v2 binds both peers' public keys into the derivation, preventing
|
|
45
45
|
* unknown key-share attacks. The peer keys are appended in sorted
|
|
46
46
|
* order so both parties derive the identical string.
|
|
47
47
|
*/
|
|
48
48
|
p2pChannelV2: 'me2em/p2p-channel/v2',
|
|
49
|
+
/**
|
|
50
|
+
* Builds the info string for password (secret) derivation.
|
|
51
|
+
*
|
|
52
|
+
* Revision model (PR-8, D3): revision `1` — the initial revision — and
|
|
53
|
+
* an omitted revision both yield the frozen v1 info string, so the
|
|
54
|
+
* default derivation is byte-identical to the pre-revision protocol.
|
|
55
|
+
* Revision `N ≥ 2` appends a `/rN` path segment and derives a secret
|
|
56
|
+
* that is cryptographically independent of revision 1 for the same
|
|
57
|
+
* context — the sanctioned rotation path (specs/v1.0.md §3, PLAN-LTS
|
|
58
|
+
* §4 derivation-freeze rule).
|
|
59
|
+
*
|
|
60
|
+
* @param revision - Positive integer revision; default `1`.
|
|
61
|
+
* @returns The info string, e.g. `"me2em/secret/v1"` or `"me2em/secret/v1/r2"`.
|
|
62
|
+
*
|
|
63
|
+
* @since 0.8.0
|
|
64
|
+
*/
|
|
65
|
+
password: (revision = 1) => revision === 1 ? 'me2em/secret/v1' : `me2em/secret/v1/r${revision}`,
|
|
66
|
+
/**
|
|
67
|
+
* Builds the info string for channel-key derivation.
|
|
68
|
+
*
|
|
69
|
+
* Same revision model as {@link DERIVATION_PATHS.password}: revision
|
|
70
|
+
* `1`/omitted yields the frozen `"me2em/channel/v1"`; revision
|
|
71
|
+
* `N ≥ 2` yields `"me2em/channel/v1/rN"` — an independent key for
|
|
72
|
+
* rotating a compromised channel without changing the context.
|
|
73
|
+
*
|
|
74
|
+
* @param revision - Positive integer revision; default `1`.
|
|
75
|
+
* @returns The info string, e.g. `"me2em/channel/v1"` or `"me2em/channel/v1/r2"`.
|
|
76
|
+
*
|
|
77
|
+
* @since 0.8.0
|
|
78
|
+
*/
|
|
79
|
+
channel: (revision = 1) => revision === 1 ? 'me2em/channel/v1' : `me2em/channel/v1/r${revision}`,
|
|
49
80
|
};
|
|
50
81
|
//# sourceMappingURL=derivation-paths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derivation-paths.js","sourceRoot":"","sources":["../../src/crypto/derivation-paths.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,yEAAyE;AACzE,2EAA2E;AAC3E,wEAAwE;AACxE,EAAE;AACF,wEAAwE;AACxE,oBAAoB;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B;;;OAGG;IACH,QAAQ,EAAE,wBAAwB;IAElC;;;;;OAKG;IACH,MAAM,EAAE,CAAC,IAAY,EAAU,EAAE,CAC/B,mBAAmB,aAAa,CAAC,IAAI,CAAC,EAAE;IAE1C;;;;;;OAMG;IACH,SAAS,EAAE,CAAC,UAAkB,EAAE,OAAe,EAAU,EAAE,CACzD,sBAAsB,aAAa,CAAC,UAAU,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE;IAE7E;;;;;OAKG;IACH,YAAY,EAAE,sBAAsB;
|
|
1
|
+
{"version":3,"file":"derivation-paths.js","sourceRoot":"","sources":["../../src/crypto/derivation-paths.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,yEAAyE;AACzE,2EAA2E;AAC3E,wEAAwE;AACxE,EAAE;AACF,wEAAwE;AACxE,oBAAoB;AAEpB,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B;;;OAGG;IACH,QAAQ,EAAE,wBAAwB;IAElC;;;;;OAKG;IACH,MAAM,EAAE,CAAC,IAAY,EAAU,EAAE,CAC/B,mBAAmB,aAAa,CAAC,IAAI,CAAC,EAAE;IAE1C;;;;;;OAMG;IACH,SAAS,EAAE,CAAC,UAAkB,EAAE,OAAe,EAAU,EAAE,CACzD,sBAAsB,aAAa,CAAC,UAAU,CAAC,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE;IAE7E;;;;;OAKG;IACH,YAAY,EAAE,sBAAsB;IAEpC;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,EAAE,CAAC,WAAmB,CAAC,EAAU,EAAE,CACzC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,oBAAoB,QAAQ,EAAE;IAErE;;;;;;;;;;;;OAYG;IACH,OAAO,EAAE,CAAC,WAAmB,CAAC,EAAU,EAAE,CACxC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,qBAAqB,QAAQ,EAAE;CAC/D,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derives the root Identity key from the 64-byte seed.
|
|
3
|
+
*
|
|
4
|
+
* `HKDF-SHA256(seed, salt = "", info = "me2em/identity/v1/root", 32)`
|
|
5
|
+
* (specs/v1.0.md §2–§3). This is the exact computation
|
|
6
|
+
* `Identity.fromSeed` performs; exposed so advanced callers can
|
|
7
|
+
* reproduce or audit the derivation without holding an Identity
|
|
8
|
+
* instance.
|
|
9
|
+
*
|
|
10
|
+
* @param seed - The 64-byte BIP39 seed (specs/v1.0.md §2).
|
|
11
|
+
* @returns The 32-byte Ed25519 root private key.
|
|
12
|
+
* @since 0.8.0
|
|
13
|
+
*/
|
|
14
|
+
export declare function deriveRootKey(seed: Uint8Array): Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* Derives a Handle key from the root Identity key.
|
|
17
|
+
*
|
|
18
|
+
* `HKDF-SHA256(rootKey, salt = "", info = "me2em/handle/v1/{name}", 32)`.
|
|
19
|
+
* `name` is canonicalized (NFKC → lowercase → trim) by
|
|
20
|
+
* {@link DERIVATION_PATHS.handle}.
|
|
21
|
+
*
|
|
22
|
+
* @param rootKey - The 32-byte root private key (see {@link deriveRootKey}).
|
|
23
|
+
* @param name - The Handle name.
|
|
24
|
+
* @returns The 32-byte Ed25519 Handle private key.
|
|
25
|
+
* @since 0.8.0
|
|
26
|
+
*/
|
|
27
|
+
export declare function deriveHandleKey(rootKey: Uint8Array, name: string): Uint8Array;
|
|
28
|
+
/**
|
|
29
|
+
* Derives a SubHandle key from its parent Handle key — the single
|
|
30
|
+
* implementation shared by `Handle.deriveSubHandle` (autonomous,
|
|
31
|
+
* two-step from the Handle) and `Identity.deriveSubHandle` (atomic,
|
|
32
|
+
* from the Identity). Byte-parity of both entry points is pinned by
|
|
33
|
+
* test 5.3.3 (`derivation.spec.ts`) and by the golden vectors.
|
|
34
|
+
*
|
|
35
|
+
* `HKDF-SHA256(handleKey, salt = "",
|
|
36
|
+
* info = "me2em/subhandle/v1/{handleName}/{subName}", 32)`. Both names
|
|
37
|
+
* are canonicalized (NFKC → lowercase → trim) by
|
|
38
|
+
* {@link DERIVATION_PATHS.subhandle}.
|
|
39
|
+
*
|
|
40
|
+
* @param handleKey - The 32-byte parent Handle private key.
|
|
41
|
+
* @param handleName - The parent Handle name.
|
|
42
|
+
* @param subName - The SubHandle name.
|
|
43
|
+
* @returns The 32-byte Ed25519 SubHandle private key.
|
|
44
|
+
* @since 0.8.0
|
|
45
|
+
*/
|
|
46
|
+
export declare function deriveSubHandleKey(handleKey: Uint8Array, handleName: string, subName: string): Uint8Array;
|
|
47
|
+
//# sourceMappingURL=derivation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivation.d.ts","sourceRoot":"","sources":["../../src/crypto/derivation.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAO1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAO7E;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GACd,UAAU,CAOZ"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// packages/core/src/crypto/derivation.ts
|
|
2
|
+
//
|
|
3
|
+
// Key-derivation helpers shared by every derivation entry point
|
|
4
|
+
// (PR-10, tasks 3.2/5.3.3). `Identity.fromSeed`, `Identity.deriveHandle`,
|
|
5
|
+
// `Identity.deriveSubHandle` and `Handle.deriveSubHandle` all route
|
|
6
|
+
// through these functions, which is what guarantees the byte-parity the
|
|
7
|
+
// spec pins (specs/v1.0.md §3): the two-step derivation
|
|
8
|
+
// (`handle.deriveSubHandle`) and the atomic derivation
|
|
9
|
+
// (`identity.deriveSubHandle`) MUST produce the same SubHandle key.
|
|
10
|
+
//
|
|
11
|
+
// All functions derive with HKDF-SHA256 (RFC 5869), salt = "" (zero
|
|
12
|
+
// length), 32-byte output — see specs/v1.0.md §3. The info strings come
|
|
13
|
+
// exclusively from {@link DERIVATION_PATHS} (single source of truth).
|
|
14
|
+
import { hkdf } from './hkdf.js';
|
|
15
|
+
import { DERIVATION_PATHS } from './derivation-paths.js';
|
|
16
|
+
/**
|
|
17
|
+
* Derives the root Identity key from the 64-byte seed.
|
|
18
|
+
*
|
|
19
|
+
* `HKDF-SHA256(seed, salt = "", info = "me2em/identity/v1/root", 32)`
|
|
20
|
+
* (specs/v1.0.md §2–§3). This is the exact computation
|
|
21
|
+
* `Identity.fromSeed` performs; exposed so advanced callers can
|
|
22
|
+
* reproduce or audit the derivation without holding an Identity
|
|
23
|
+
* instance.
|
|
24
|
+
*
|
|
25
|
+
* @param seed - The 64-byte BIP39 seed (specs/v1.0.md §2).
|
|
26
|
+
* @returns The 32-byte Ed25519 root private key.
|
|
27
|
+
* @since 0.8.0
|
|
28
|
+
*/
|
|
29
|
+
export function deriveRootKey(seed) {
|
|
30
|
+
return hkdf(seed, new Uint8Array(0), new TextEncoder().encode(DERIVATION_PATHS.identity), 32);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Derives a Handle key from the root Identity key.
|
|
34
|
+
*
|
|
35
|
+
* `HKDF-SHA256(rootKey, salt = "", info = "me2em/handle/v1/{name}", 32)`.
|
|
36
|
+
* `name` is canonicalized (NFKC → lowercase → trim) by
|
|
37
|
+
* {@link DERIVATION_PATHS.handle}.
|
|
38
|
+
*
|
|
39
|
+
* @param rootKey - The 32-byte root private key (see {@link deriveRootKey}).
|
|
40
|
+
* @param name - The Handle name.
|
|
41
|
+
* @returns The 32-byte Ed25519 Handle private key.
|
|
42
|
+
* @since 0.8.0
|
|
43
|
+
*/
|
|
44
|
+
export function deriveHandleKey(rootKey, name) {
|
|
45
|
+
return hkdf(rootKey, new Uint8Array(0), new TextEncoder().encode(DERIVATION_PATHS.handle(name)), 32);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Derives a SubHandle key from its parent Handle key — the single
|
|
49
|
+
* implementation shared by `Handle.deriveSubHandle` (autonomous,
|
|
50
|
+
* two-step from the Handle) and `Identity.deriveSubHandle` (atomic,
|
|
51
|
+
* from the Identity). Byte-parity of both entry points is pinned by
|
|
52
|
+
* test 5.3.3 (`derivation.spec.ts`) and by the golden vectors.
|
|
53
|
+
*
|
|
54
|
+
* `HKDF-SHA256(handleKey, salt = "",
|
|
55
|
+
* info = "me2em/subhandle/v1/{handleName}/{subName}", 32)`. Both names
|
|
56
|
+
* are canonicalized (NFKC → lowercase → trim) by
|
|
57
|
+
* {@link DERIVATION_PATHS.subhandle}.
|
|
58
|
+
*
|
|
59
|
+
* @param handleKey - The 32-byte parent Handle private key.
|
|
60
|
+
* @param handleName - The parent Handle name.
|
|
61
|
+
* @param subName - The SubHandle name.
|
|
62
|
+
* @returns The 32-byte Ed25519 SubHandle private key.
|
|
63
|
+
* @since 0.8.0
|
|
64
|
+
*/
|
|
65
|
+
export function deriveSubHandleKey(handleKey, handleName, subName) {
|
|
66
|
+
return hkdf(handleKey, new Uint8Array(0), new TextEncoder().encode(DERIVATION_PATHS.subhandle(handleName, subName)), 32);
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=derivation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivation.js","sourceRoot":"","sources":["../../src/crypto/derivation.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,EAAE;AACF,gEAAgE;AAChE,0EAA0E;AAC1E,oEAAoE;AACpE,wEAAwE;AACxE,wDAAwD;AACxD,uDAAuD;AACvD,oEAAoE;AACpE,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AACxE,sEAAsE;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,aAAa,CAAC,IAAgB;IAC5C,OAAO,IAAI,CACT,IAAI,EACJ,IAAI,UAAU,CAAC,CAAC,CAAC,EACjB,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EACnD,EAAE,CACH,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,OAAmB,EAAE,IAAY;IAC/D,OAAO,IAAI,CACT,OAAO,EACP,IAAI,UAAU,CAAC,CAAC,CAAC,EACjB,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EACvD,EAAE,CACH,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kBAAkB,CAChC,SAAqB,EACrB,UAAkB,EAClB,OAAe;IAEf,OAAO,IAAI,CACT,SAAS,EACT,IAAI,UAAU,CAAC,CAAC,CAAC,EACjB,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,EACzE,EAAE,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computes the raw X25519 shared secret between this party's Ed25519
|
|
3
|
+
* private key and the peer's Ed25519 public key (both converted to the
|
|
4
|
+
* Montgomery form, RFC 7748). ECDH is symmetric, so the result is
|
|
5
|
+
* order-independent — and byte-identical on both peers.
|
|
6
|
+
*
|
|
7
|
+
* This is only the raw ECDH output. The protocol derivation
|
|
8
|
+
* ({@link Handle.deriveSharedSecret}) additionally binds both peers'
|
|
9
|
+
* public keys into the HKDF salt and expands with the P2P info string;
|
|
10
|
+
* never encrypt with the raw output alone.
|
|
11
|
+
*
|
|
12
|
+
* @param myPrivateKey - This party's 32-byte Ed25519 private key.
|
|
13
|
+
* @param otherPublicKey - The peer's 32-byte Ed25519 public key.
|
|
14
|
+
* @returns The 32-byte raw ECDH output — the HKDF IKM of the P2P
|
|
15
|
+
* derivation.
|
|
16
|
+
* @since 0.8.0
|
|
17
|
+
*/
|
|
18
|
+
export declare function rawX25519SharedSecret(myPrivateKey: Uint8Array, otherPublicKey: Uint8Array): Uint8Array;
|
|
19
|
+
//# sourceMappingURL=ecdh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecdh.d.ts","sourceRoot":"","sources":["../../src/crypto/ecdh.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,UAAU,EACxB,cAAc,EAAE,UAAU,GACzB,UAAU,CAIZ"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// packages/core/src/crypto/ecdh.ts
|
|
2
|
+
//
|
|
3
|
+
// X25519 (Montgomery) ECDH step of the P2P shared-secret derivation
|
|
4
|
+
// (specs/v1.0.md §3 "P2P"): both Ed25519 keypairs are converted to the
|
|
5
|
+
// Montgomery form (RFC 7748) and the raw X25519 output becomes the HKDF
|
|
6
|
+
// IKM. Isolated here (PR-10, task 3.3.1) so that no protocol module
|
|
7
|
+
// imports `@noble/curves` directly — every crypto primitive lives
|
|
8
|
+
// under `crypto/` and reaches the rest of the codebase through
|
|
9
|
+
// documented wrappers.
|
|
10
|
+
import { ed25519, x25519 } from '@noble/curves/ed25519.js';
|
|
11
|
+
/**
|
|
12
|
+
* Computes the raw X25519 shared secret between this party's Ed25519
|
|
13
|
+
* private key and the peer's Ed25519 public key (both converted to the
|
|
14
|
+
* Montgomery form, RFC 7748). ECDH is symmetric, so the result is
|
|
15
|
+
* order-independent — and byte-identical on both peers.
|
|
16
|
+
*
|
|
17
|
+
* This is only the raw ECDH output. The protocol derivation
|
|
18
|
+
* ({@link Handle.deriveSharedSecret}) additionally binds both peers'
|
|
19
|
+
* public keys into the HKDF salt and expands with the P2P info string;
|
|
20
|
+
* never encrypt with the raw output alone.
|
|
21
|
+
*
|
|
22
|
+
* @param myPrivateKey - This party's 32-byte Ed25519 private key.
|
|
23
|
+
* @param otherPublicKey - The peer's 32-byte Ed25519 public key.
|
|
24
|
+
* @returns The 32-byte raw ECDH output — the HKDF IKM of the P2P
|
|
25
|
+
* derivation.
|
|
26
|
+
* @since 0.8.0
|
|
27
|
+
*/
|
|
28
|
+
export function rawX25519SharedSecret(myPrivateKey, otherPublicKey) {
|
|
29
|
+
const montgomerySecret = ed25519.utils.toMontgomerySecret(myPrivateKey);
|
|
30
|
+
const montgomeryPeer = ed25519.utils.toMontgomery(otherPublicKey);
|
|
31
|
+
return x25519.getSharedSecret(montgomerySecret, montgomeryPeer);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=ecdh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecdh.js","sourceRoot":"","sources":["../../src/crypto/ecdh.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,uEAAuE;AACvE,wEAAwE;AACxE,oEAAoE;AACpE,kEAAkE;AAClE,+DAA+D;AAC/D,uBAAuB;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAAwB,EACxB,cAA0B;IAE1B,MAAM,gBAAgB,GAAG,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC;IACxE,MAAM,cAAc,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;IAClE,OAAO,MAAM,CAAC,eAAe,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAClE,CAAC"}
|
package/dist/crypto/ed25519.d.ts
CHANGED
|
@@ -34,18 +34,39 @@ export declare function sign(message: Uint8Array, privateKey: Uint8Array): Uint8
|
|
|
34
34
|
*/
|
|
35
35
|
export declare function verify(signature: Uint8Array, message: Uint8Array, publicKey: Uint8Array, opts?: VerifyOpts): boolean;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Derives the Ed25519 public key for a private key (asynchronous
|
|
38
|
+
* variant of {@link getPublicKey}; same contract).
|
|
39
|
+
*
|
|
40
|
+
* @param privateKey - 32-byte Ed25519 private key.
|
|
41
|
+
* @returns A Promise resolving to the 32-byte public key.
|
|
42
|
+
* @throws `TypeError` if the key length is invalid.
|
|
43
|
+
* @throws `RangeError` if the key length is invalid.
|
|
38
44
|
*/
|
|
39
45
|
export declare function getPublicKeyAsync(privateKey: Uint8Array): Promise<Uint8Array>;
|
|
40
46
|
/**
|
|
41
|
-
*
|
|
47
|
+
* Signs a message with an Ed25519 private key (asynchronous variant of
|
|
48
|
+
* {@link sign}; same contract).
|
|
49
|
+
*
|
|
50
|
+
* @param message - The bytes to sign.
|
|
51
|
+
* @param privateKey - 32-byte Ed25519 private key.
|
|
52
|
+
* @returns A Promise resolving to the 64-byte signature.
|
|
53
|
+
* @throws `TypeError` if an input length is invalid.
|
|
54
|
+
* @throws `RangeError` if an input length is invalid.
|
|
42
55
|
*/
|
|
43
56
|
export declare function signAsync(message: Uint8Array, privateKey: Uint8Array): Promise<Uint8Array>;
|
|
44
57
|
/**
|
|
45
|
-
*
|
|
58
|
+
* Verifies an Ed25519 signature (asynchronous variant of
|
|
59
|
+
* {@link verify}; same contract).
|
|
46
60
|
*
|
|
61
|
+
* @param signature - The 64-byte signature.
|
|
62
|
+
* @param message - The signed message bytes.
|
|
63
|
+
* @param publicKey - The 32-byte signer public key.
|
|
47
64
|
* @param opts - Optional verification options, forwarded to the
|
|
48
65
|
* underlying implementation.
|
|
66
|
+
* @returns A Promise resolving to `true` if the signature is valid,
|
|
67
|
+
* `false` otherwise.
|
|
68
|
+
* @throws `TypeError` if an input length is invalid.
|
|
69
|
+
* @throws `RangeError` if an input length is invalid.
|
|
49
70
|
*/
|
|
50
71
|
export declare function verifyAsync(signature: Uint8Array, message: Uint8Array, publicKey: Uint8Array, opts?: Parameters<typeof ed.verifyAsync>[3]): Promise<boolean>;
|
|
51
72
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ed25519.d.ts","sourceRoot":"","sources":["../../src/crypto/ed25519.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ed25519.d.ts","sourceRoot":"","sources":["../../src/crypto/ed25519.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAE/B,wEAAwE;AACxE,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAElD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAE/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,UAAU,CAE5E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CACpB,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,UAAU,EACrB,IAAI,CAAC,EAAE,UAAU,GAChB,OAAO,CAET;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAEnF;AAED;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAEhG;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,WAAW,CAC/B,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,UAAU,EACrB,IAAI,CAAC,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAC1C,OAAO,CAAC,OAAO,CAAC,CAElB"}
|
package/dist/crypto/ed25519.js
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
// packages/core/src/crypto/ed25519.ts
|
|
2
2
|
//
|
|
3
3
|
// Documented wrappers around the @noble/ed25519 primitives used by the
|
|
4
|
-
// protocol. These are real functions rather than alias re-exports,
|
|
5
|
-
//
|
|
6
|
-
//
|
|
4
|
+
// protocol. These are real functions rather than alias re-exports, for
|
|
5
|
+
// two stable reasons (see also the BACKLOG.md house rule):
|
|
6
|
+
//
|
|
7
|
+
// 1. Documentation ownership — generated documentation is fully owned
|
|
8
|
+
// by this package and never inherits comments (or broken links)
|
|
9
|
+
// from the upstream library; TypeDoc renders these TSDoc blocks
|
|
10
|
+
// verbatim on the docs site (TSDoc is the source of truth).
|
|
11
|
+
// 2. Typing isolation — the upstream `ed` entity's typing produces
|
|
12
|
+
// TypeDoc warnings that fail the `treatWarningsAsErrors: true`
|
|
13
|
+
// docs build; local wrappers keep the public surface clean.
|
|
14
|
+
//
|
|
15
|
+
// The wrappers are public API surface (the `crypto` namespace,
|
|
16
|
+
// specs/v1.0.md §12) and are pinned by test/arch-cycle.spec.ts parity
|
|
17
|
+
// tests. Removing them is a breaking 2.0.0 decision — do not propose
|
|
18
|
+
// (PLAN amendment A5).
|
|
7
19
|
import { ed } from './init.js';
|
|
8
20
|
/**
|
|
9
21
|
* Derives the Ed25519 public key for a private key (synchronous).
|
|
@@ -44,22 +56,43 @@ export function verify(signature, message, publicKey, opts) {
|
|
|
44
56
|
return ed.verify(signature, message, publicKey, opts);
|
|
45
57
|
}
|
|
46
58
|
/**
|
|
47
|
-
*
|
|
59
|
+
* Derives the Ed25519 public key for a private key (asynchronous
|
|
60
|
+
* variant of {@link getPublicKey}; same contract).
|
|
61
|
+
*
|
|
62
|
+
* @param privateKey - 32-byte Ed25519 private key.
|
|
63
|
+
* @returns A Promise resolving to the 32-byte public key.
|
|
64
|
+
* @throws `TypeError` if the key length is invalid.
|
|
65
|
+
* @throws `RangeError` if the key length is invalid.
|
|
48
66
|
*/
|
|
49
67
|
export async function getPublicKeyAsync(privateKey) {
|
|
50
68
|
return ed.getPublicKeyAsync(privateKey);
|
|
51
69
|
}
|
|
52
70
|
/**
|
|
53
|
-
*
|
|
71
|
+
* Signs a message with an Ed25519 private key (asynchronous variant of
|
|
72
|
+
* {@link sign}; same contract).
|
|
73
|
+
*
|
|
74
|
+
* @param message - The bytes to sign.
|
|
75
|
+
* @param privateKey - 32-byte Ed25519 private key.
|
|
76
|
+
* @returns A Promise resolving to the 64-byte signature.
|
|
77
|
+
* @throws `TypeError` if an input length is invalid.
|
|
78
|
+
* @throws `RangeError` if an input length is invalid.
|
|
54
79
|
*/
|
|
55
80
|
export async function signAsync(message, privateKey) {
|
|
56
81
|
return ed.signAsync(message, privateKey);
|
|
57
82
|
}
|
|
58
83
|
/**
|
|
59
|
-
*
|
|
84
|
+
* Verifies an Ed25519 signature (asynchronous variant of
|
|
85
|
+
* {@link verify}; same contract).
|
|
60
86
|
*
|
|
87
|
+
* @param signature - The 64-byte signature.
|
|
88
|
+
* @param message - The signed message bytes.
|
|
89
|
+
* @param publicKey - The 32-byte signer public key.
|
|
61
90
|
* @param opts - Optional verification options, forwarded to the
|
|
62
91
|
* underlying implementation.
|
|
92
|
+
* @returns A Promise resolving to `true` if the signature is valid,
|
|
93
|
+
* `false` otherwise.
|
|
94
|
+
* @throws `TypeError` if an input length is invalid.
|
|
95
|
+
* @throws `RangeError` if an input length is invalid.
|
|
63
96
|
*/
|
|
64
97
|
export async function verifyAsync(signature, message, publicKey, opts) {
|
|
65
98
|
return ed.verifyAsync(signature, message, publicKey, opts);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ed25519.js","sourceRoot":"","sources":["../../src/crypto/ed25519.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,mEAAmE;AACnE,
|
|
1
|
+
{"version":3,"file":"ed25519.js","sourceRoot":"","sources":["../../src/crypto/ed25519.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,2DAA2D;AAC3D,EAAE;AACF,sEAAsE;AACtE,mEAAmE;AACnE,mEAAmE;AACnE,+DAA+D;AAC/D,mEAAmE;AACnE,kEAAkE;AAClE,+DAA+D;AAC/D,EAAE;AACF,+DAA+D;AAC/D,sEAAsE;AACtE,qEAAqE;AACrE,uBAAuB;AAEvB,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAK/B;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,UAAsB;IACjD,OAAO,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAAC,OAAmB,EAAE,UAAsB;IAC9D,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AACtC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,MAAM,CACpB,SAAqB,EACrB,OAAmB,EACnB,SAAqB,EACrB,IAAiB;IAEjB,OAAO,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,UAAsB;IAC5D,OAAO,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAmB,EAAE,UAAsB;IACzE,OAAO,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,SAAqB,EACrB,OAAmB,EACnB,SAAqB,EACrB,IAA2C;IAE3C,OAAO,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAC7D,CAAC"}
|
package/dist/crypto/hkdf.d.ts
CHANGED
|
@@ -8,6 +8,15 @@
|
|
|
8
8
|
* @returns Derived key as Uint8Array
|
|
9
9
|
*/
|
|
10
10
|
export declare function hkdf(ikm: Uint8Array, salt: Uint8Array, info: Uint8Array, length: number): Uint8Array;
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* SHA-256 hash function (wrapper over `@noble/hashes/sha2`).
|
|
13
|
+
*
|
|
14
|
+
* Exposed as a building block for application-side tooling that needs
|
|
15
|
+
* the same hash the protocol's derivation uses; the derivation module
|
|
16
|
+
* consumes it internally.
|
|
17
|
+
*
|
|
18
|
+
* @param input - The bytes to hash.
|
|
19
|
+
* @returns The 32-byte SHA-256 digest.
|
|
20
|
+
*/
|
|
12
21
|
export declare function sha256(input: Uint8Array): Uint8Array;
|
|
13
22
|
//# sourceMappingURL=hkdf.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hkdf.d.ts","sourceRoot":"","sources":["../../src/crypto/hkdf.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAClB,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACb,UAAU,CAEZ;AAED
|
|
1
|
+
{"version":3,"file":"hkdf.d.ts","sourceRoot":"","sources":["../../src/crypto/hkdf.ts"],"names":[],"mappings":"AAKA;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAClB,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACb,UAAU,CAEZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAEpD"}
|
package/dist/crypto/hkdf.js
CHANGED
|
@@ -13,7 +13,16 @@ import { sha256 as nobleSha256 } from '@noble/hashes/sha2.js';
|
|
|
13
13
|
export function hkdf(ikm, salt, info, length) {
|
|
14
14
|
return nobleHkdf(nobleSha256, ikm, salt, info, length);
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* SHA-256 hash function (wrapper over `@noble/hashes/sha2`).
|
|
18
|
+
*
|
|
19
|
+
* Exposed as a building block for application-side tooling that needs
|
|
20
|
+
* the same hash the protocol's derivation uses; the derivation module
|
|
21
|
+
* consumes it internally.
|
|
22
|
+
*
|
|
23
|
+
* @param input - The bytes to hash.
|
|
24
|
+
* @returns The 32-byte SHA-256 digest.
|
|
25
|
+
*/
|
|
17
26
|
export function sha256(input) {
|
|
18
27
|
return nobleSha256(input);
|
|
19
28
|
}
|
package/dist/crypto/hkdf.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hkdf.js","sourceRoot":"","sources":["../../src/crypto/hkdf.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAClB,GAAe,EACf,IAAgB,EAChB,IAAgB,EAChB,MAAc;IAEd,OAAO,SAAS,CAAC,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACzD,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"hkdf.js","sourceRoot":"","sources":["../../src/crypto/hkdf.ts"],"names":[],"mappings":"AAAA,mCAAmC;AAEnC,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,UAAU,IAAI,CAClB,GAAe,EACf,IAAgB,EAChB,IAAgB,EAChB,MAAc;IAEd,OAAO,SAAS,CAAC,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,MAAM,CAAC,KAAiB;IACtC,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
|