@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.
Files changed (92) hide show
  1. package/README.md +179 -32
  2. package/dist/attestation.d.ts +26 -17
  3. package/dist/attestation.d.ts.map +1 -1
  4. package/dist/attestation.js +76 -29
  5. package/dist/attestation.js.map +1 -1
  6. package/dist/canonical-name.d.ts +18 -0
  7. package/dist/canonical-name.d.ts.map +1 -1
  8. package/dist/canonical-name.js +28 -1
  9. package/dist/canonical-name.js.map +1 -1
  10. package/dist/crypto/derivation-paths.d.ts +33 -2
  11. package/dist/crypto/derivation-paths.d.ts.map +1 -1
  12. package/dist/crypto/derivation-paths.js +33 -2
  13. package/dist/crypto/derivation-paths.js.map +1 -1
  14. package/dist/crypto/derivation.d.ts +47 -0
  15. package/dist/crypto/derivation.d.ts.map +1 -0
  16. package/dist/crypto/derivation.js +68 -0
  17. package/dist/crypto/derivation.js.map +1 -0
  18. package/dist/crypto/ecdh.d.ts +19 -0
  19. package/dist/crypto/ecdh.d.ts.map +1 -0
  20. package/dist/crypto/ecdh.js +33 -0
  21. package/dist/crypto/ecdh.js.map +1 -0
  22. package/dist/crypto/ed25519.d.ts +24 -3
  23. package/dist/crypto/ed25519.d.ts.map +1 -1
  24. package/dist/crypto/ed25519.js +39 -6
  25. package/dist/crypto/ed25519.js.map +1 -1
  26. package/dist/crypto/hkdf.d.ts +10 -1
  27. package/dist/crypto/hkdf.d.ts.map +1 -1
  28. package/dist/crypto/hkdf.js +10 -1
  29. package/dist/crypto/hkdf.js.map +1 -1
  30. package/dist/crypto/index.d.ts +25 -0
  31. package/dist/crypto/index.d.ts.map +1 -1
  32. package/dist/crypto/index.js +25 -0
  33. package/dist/crypto/index.js.map +1 -1
  34. package/dist/disposed-error.d.ts +24 -0
  35. package/dist/disposed-error.d.ts.map +1 -0
  36. package/dist/disposed-error.js +39 -0
  37. package/dist/disposed-error.js.map +1 -0
  38. package/dist/errors.d.ts +67 -0
  39. package/dist/errors.d.ts.map +1 -0
  40. package/dist/errors.js +54 -0
  41. package/dist/errors.js.map +1 -0
  42. package/dist/handle.d.ts +300 -14
  43. package/dist/handle.d.ts.map +1 -1
  44. package/dist/handle.js +463 -54
  45. package/dist/handle.js.map +1 -1
  46. package/dist/identity.d.ts +55 -11
  47. package/dist/identity.d.ts.map +1 -1
  48. package/dist/identity.js +105 -35
  49. package/dist/identity.js.map +1 -1
  50. package/dist/index.d.ts +9 -5
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +7 -4
  53. package/dist/index.js.map +1 -1
  54. package/dist/seed.d.ts +15 -11
  55. package/dist/seed.d.ts.map +1 -1
  56. package/dist/seed.js +23 -17
  57. package/dist/seed.js.map +1 -1
  58. package/dist/session.d.ts +42 -5
  59. package/dist/session.d.ts.map +1 -1
  60. package/dist/session.js +248 -117
  61. package/dist/session.js.map +1 -1
  62. package/dist/subhandle.d.ts +1 -125
  63. package/dist/subhandle.d.ts.map +1 -1
  64. package/dist/subhandle.js +12 -179
  65. package/dist/subhandle.js.map +1 -1
  66. package/dist/types.d.ts +22 -0
  67. package/dist/types.d.ts.map +1 -0
  68. package/dist/types.js +6 -0
  69. package/dist/types.js.map +1 -0
  70. package/dist/util.d.ts +47 -0
  71. package/dist/util.d.ts.map +1 -1
  72. package/dist/util.js +72 -20
  73. package/dist/util.js.map +1 -1
  74. package/package.json +10 -4
  75. package/src/attestation.ts +88 -38
  76. package/src/canonical-name.ts +33 -1
  77. package/src/crypto/derivation-paths.ts +37 -2
  78. package/src/crypto/derivation.ts +90 -0
  79. package/src/crypto/ecdh.ts +37 -0
  80. package/src/crypto/ed25519.ts +39 -6
  81. package/src/crypto/hkdf.ts +10 -1
  82. package/src/crypto/index.ts +28 -1
  83. package/src/disposed-error.ts +45 -0
  84. package/src/errors.ts +88 -0
  85. package/src/handle.ts +630 -65
  86. package/src/identity.ts +111 -64
  87. package/src/index.ts +10 -6
  88. package/src/seed.ts +27 -17
  89. package/src/session.ts +336 -132
  90. package/src/subhandle.ts +12 -251
  91. package/src/types.ts +26 -0
  92. package/src/util.ts +78 -20
@@ -1,126 +1,2 @@
1
- import { Handle, type HandleMetadata } from './handle.js';
2
- /**
3
- * Metadata for a {@link SubHandle}, extending {@link HandleMetadata} with
4
- * constraints that govern session creation.
5
- *
6
- * All constraint fields are optional. When present, they are enforced by
7
- * {@link SubHandle.validateSessionOptions} at session creation time.
8
- *
9
- * @category Types
10
- */
11
- export interface SubHandleMetadata extends HandleMetadata {
12
- /**
13
- * Restricts the set of audiences this SubHandle may create sessions for.
14
- * `undefined` = unrestricted; `[]` = deny all.
15
- */
16
- allowedAudiences?: string[];
17
- /**
18
- * Restricts the set of scopes this SubHandle may request in sessions.
19
- * `undefined` = unrestricted; `[]` = deny all.
20
- */
21
- allowedScopes?: string[];
22
- /**
23
- * Maximum allowed TTL (in seconds) for sessions created by this SubHandle.
24
- * Attempts to create a session with a larger TTL will be rejected.
25
- */
26
- maxSessionTtl?: number;
27
- /**
28
- * Unix timestamp (in seconds) at which this SubHandle itself expires.
29
- * After this time, any attempt to create a session will fail.
30
- * Useful for temporary access grants (e.g., contractor access for 2 weeks).
31
- */
32
- expiresAt?: number;
33
- }
34
- /**
35
- * Represents a context-isolated child Handle in the Me2em hierarchy.
36
- *
37
- * A SubHandle is always derived from a parent {@link Handle} and represents
38
- * a leaf node in the derivation tree (MAX_DEPTH = 2). It inherits all
39
- * cryptographic capabilities of Handle (signing, key derivation, etc.) but
40
- * adds:
41
- *
42
- * - A **derivation path** (`[handleName, subName]`) carried in session tokens.
43
- * - **Constraint enforcement** on audience, scopes, and TTL at session creation.
44
- * - An optional **expiration timestamp** for temporary access grants.
45
- *
46
- * SubHandle is used for polymorphism in {@link Session}: both Handle and
47
- * SubHandle can create and verify sessions, but SubHandle sessions carry
48
- * the additional `hPath` field for hierarchical auditing.
49
- *
50
- * @category Core Primitives
51
- */
52
- export declare class SubHandle extends Handle {
53
- private readonly _path;
54
- private readonly _subMetadata;
55
- /**
56
- * Creates a new SubHandle instance.
57
- *
58
- * @internal Typically created via {@link Handle.deriveSubHandle} or
59
- * {@link Identity.deriveSubHandle}. Direct construction is discouraged.
60
- *
61
- * @param privateKey - The 32-byte Ed25519 private key for this SubHandle.
62
- * @param name - The SubHandle name.
63
- * @param path - The derivation path, must have exactly 2 elements: `[handleName, subName]`.
64
- * @param subMetadata - Optional constraints and metadata.
65
- * @throws {Error} If the path does not have exactly 2 elements.
66
- */
67
- constructor(privateKey: Uint8Array, name: string, path: string[], subMetadata?: SubHandleMetadata);
68
- /**
69
- * Returns the full derivation path of this SubHandle.
70
- *
71
- * @returns A copy of the path array, e.g. `["station-001", "connector-1"]`.
72
- */
73
- getPath(): string[];
74
- /**
75
- * Returns the derivation path as a slash-separated string.
76
- *
77
- * @returns The path string, e.g. `"station-001/connector-1"`.
78
- */
79
- getPathString(): string;
80
- /**
81
- * Returns the depth of this SubHandle in the derivation hierarchy.
82
- *
83
- * With MAX_DEPTH = 2, this is always `2` (Identity = 0, Handle = 1, SubHandle = 2).
84
- *
85
- * @returns The depth, always `2`.
86
- */
87
- getDepth(): number;
88
- /**
89
- * Returns whether this SubHandle is a leaf node.
90
- *
91
- * With MAX_DEPTH = 2, a SubHandle is **always** a leaf and cannot derive children.
92
- *
93
- * @returns Always `true`.
94
- */
95
- isLeaf(): boolean;
96
- /**
97
- * SubHandle is a leaf node (depth = 2) and cannot derive children.
98
- * Overrides the inherited `Handle.deriveSubHandle` to throw an error.
99
- */
100
- deriveSubHandle(): Promise<never>;
101
- /**
102
- * Returns the SubHandle-specific metadata (constraints).
103
- *
104
- * @returns The SubHandleMetadata object.
105
- */
106
- getSubMetadata(): SubHandleMetadata;
107
- /**
108
- * Validates session options against this SubHandle's constraints.
109
- *
110
- * Called internally by {@link Session.create} before signing. Throws if
111
- * any constraint is violated:
112
- * - `audience` not in `allowedAudiences`
113
- * - any `scope` not in `allowedScopes`
114
- * - `ttl` exceeds `maxSessionTtl`
115
- * - current time is past `expiresAt`
116
- *
117
- * @param options - The session options to validate.
118
- * @throws {Error} If any constraint is violated.
119
- */
120
- validateSessionOptions(options: {
121
- audience: string;
122
- scopes: string[];
123
- ttl: number;
124
- }): void;
125
- }
1
+ export { SubHandle, type SubHandleMetadata } from './handle.js';
126
2
  //# sourceMappingURL=subhandle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"subhandle.d.ts","sourceRoot":"","sources":["../src/subhandle.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAG1D;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD;;;QAGI;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE5B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA0BD;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,SAAU,SAAQ,MAAM;IACnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAW;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAoB;IAEjD;;;;;;;;;;;OAWG;gBAED,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EAAE,EACd,WAAW,CAAC,EAAE,iBAAiB;IAmBjC;;;;OAIG;IACH,OAAO,IAAI,MAAM,EAAE;IAInB;;;;OAIG;IACH,aAAa,IAAI,MAAM;IAIvB;;;;;;OAMG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;;;;OAMG;IACH,MAAM,IAAI,OAAO;IAIjB;;;OAGG;IACY,eAAe,IAAI,OAAO,CAAC,KAAK,CAAC;IAIhD;;;;OAIG;IACH,cAAc,IAAI,iBAAiB;IAYnC;;;;;;;;;;;;OAYG;IACH,sBAAsB,CAAC,OAAO,EAAE;QAC9B,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;KACb,GAAG,IAAI;CA6CT"}
1
+ {"version":3,"file":"subhandle.d.ts","sourceRoot":"","sources":["../src/subhandle.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC"}
package/dist/subhandle.js CHANGED
@@ -1,182 +1,15 @@
1
1
  // subhandle.ts
2
2
  //
3
- // SubHandle is a leaf node in the Me2em derivation tree.
4
- // With MAX_DEPTH = 2, a SubHandle CANNOT derive children.
5
- // It inherits from Handle for polymorphism in Session handling.
6
- import { Handle } from './handle.js';
7
- import { normalizeName } from './canonical-name.js';
8
- /**
9
- * Extracts only display-safe fields for the base Handle metadata.
10
- * Constraint fields stay in SubHandle's own storage and must never
11
- * leak through Handle.getMetadata().
12
- */
13
- function extractDisplayFields(meta) {
14
- if (!meta)
15
- return undefined;
16
- const display = {};
17
- if (meta.displayName !== undefined)
18
- display.displayName = meta.displayName;
19
- if (meta.avatar !== undefined)
20
- display.avatar = meta.avatar;
21
- // copy any other custom fields, but never the constraint ones
22
- const CONSTRAINT_KEYS = new Set([
23
- 'allowedAudiences', 'allowedScopes', 'maxSessionTtl', 'expiresAt',
24
- ]);
25
- for (const [k, v] of Object.entries(meta)) {
26
- if (!CONSTRAINT_KEYS.has(k)) {
27
- display[k] = v;
28
- }
29
- }
30
- return display;
31
- }
32
- /**
33
- * Represents a context-isolated child Handle in the Me2em hierarchy.
34
- *
35
- * A SubHandle is always derived from a parent {@link Handle} and represents
36
- * a leaf node in the derivation tree (MAX_DEPTH = 2). It inherits all
37
- * cryptographic capabilities of Handle (signing, key derivation, etc.) but
38
- * adds:
39
- *
40
- * - A **derivation path** (`[handleName, subName]`) carried in session tokens.
41
- * - **Constraint enforcement** on audience, scopes, and TTL at session creation.
42
- * - An optional **expiration timestamp** for temporary access grants.
43
- *
44
- * SubHandle is used for polymorphism in {@link Session}: both Handle and
45
- * SubHandle can create and verify sessions, but SubHandle sessions carry
46
- * the additional `hPath` field for hierarchical auditing.
47
- *
48
- * @category Core Primitives
49
- */
50
- export class SubHandle extends Handle {
51
- _path;
52
- _subMetadata;
53
- /**
54
- * Creates a new SubHandle instance.
55
- *
56
- * @internal Typically created via {@link Handle.deriveSubHandle} or
57
- * {@link Identity.deriveSubHandle}. Direct construction is discouraged.
58
- *
59
- * @param privateKey - The 32-byte Ed25519 private key for this SubHandle.
60
- * @param name - The SubHandle name.
61
- * @param path - The derivation path, must have exactly 2 elements: `[handleName, subName]`.
62
- * @param subMetadata - Optional constraints and metadata.
63
- * @throws {Error} If the path does not have exactly 2 elements.
64
- */
65
- constructor(privateKey, name, path, subMetadata) {
66
- super(privateKey, name, extractDisplayFields(subMetadata));
67
- if (path.length !== 2) {
68
- throw new Error(`SubHandle path must have exactly 2 elements: [handleName, subName]. Got ${path.length}.`);
69
- }
70
- const normalizedName = normalizeName(name);
71
- if (path[1] !== normalizedName) {
72
- throw new Error(`path[1] must equal normalized name: path[1]=${JSON.stringify(path[1])}, name=${JSON.stringify(normalizedName)}`);
73
- }
74
- this._path = path;
75
- this._subMetadata = subMetadata ?? {};
76
- }
77
- /**
78
- * Returns the full derivation path of this SubHandle.
79
- *
80
- * @returns A copy of the path array, e.g. `["station-001", "connector-1"]`.
81
- */
82
- getPath() {
83
- return [...this._path];
84
- }
85
- /**
86
- * Returns the derivation path as a slash-separated string.
87
- *
88
- * @returns The path string, e.g. `"station-001/connector-1"`.
89
- */
90
- getPathString() {
91
- return this._path.join('/');
92
- }
93
- /**
94
- * Returns the depth of this SubHandle in the derivation hierarchy.
95
- *
96
- * With MAX_DEPTH = 2, this is always `2` (Identity = 0, Handle = 1, SubHandle = 2).
97
- *
98
- * @returns The depth, always `2`.
99
- */
100
- getDepth() {
101
- return 2;
102
- }
103
- /**
104
- * Returns whether this SubHandle is a leaf node.
105
- *
106
- * With MAX_DEPTH = 2, a SubHandle is **always** a leaf and cannot derive children.
107
- *
108
- * @returns Always `true`.
109
- */
110
- isLeaf() {
111
- return true;
112
- }
113
- /**
114
- * SubHandle is a leaf node (depth = 2) and cannot derive children.
115
- * Overrides the inherited `Handle.deriveSubHandle` to throw an error.
116
- */
117
- async deriveSubHandle() {
118
- throw new Error('Cannot derive child: maximum depth (2) reached or this SubHandle is marked as leaf');
119
- }
120
- /**
121
- * Returns the SubHandle-specific metadata (constraints).
122
- *
123
- * @returns The SubHandleMetadata object.
124
- */
125
- getSubMetadata() {
126
- return {
127
- ...this._subMetadata,
128
- allowedAudiences: this._subMetadata.allowedAudiences !== undefined
129
- ? [...this._subMetadata.allowedAudiences]
130
- : undefined,
131
- allowedScopes: this._subMetadata.allowedScopes !== undefined
132
- ? [...this._subMetadata.allowedScopes]
133
- : undefined,
134
- };
135
- }
136
- /**
137
- * Validates session options against this SubHandle's constraints.
138
- *
139
- * Called internally by {@link Session.create} before signing. Throws if
140
- * any constraint is violated:
141
- * - `audience` not in `allowedAudiences`
142
- * - any `scope` not in `allowedScopes`
143
- * - `ttl` exceeds `maxSessionTtl`
144
- * - current time is past `expiresAt`
145
- *
146
- * @param options - The session options to validate.
147
- * @throws {Error} If any constraint is violated.
148
- */
149
- validateSessionOptions(options) {
150
- // Audience check: undefined = unrestricted, [] = deny all
151
- if (this._subMetadata.allowedAudiences !== undefined) {
152
- if (!this._subMetadata.allowedAudiences.includes(options.audience)) {
153
- throw new Error(`Audience "${options.audience}" not allowed for this SubHandle. ` +
154
- `Allowed: ${this._subMetadata.allowedAudiences.length === 0
155
- ? '(none — empty list denies all)'
156
- : this._subMetadata.allowedAudiences.join(', ')}`);
157
- }
158
- }
159
- // Scopes check: undefined = unrestricted, [] = deny all
160
- if (this._subMetadata.allowedScopes !== undefined) {
161
- const forbidden = options.scopes.filter(s => !this._subMetadata.allowedScopes.includes(s));
162
- // An empty allow-list denies every requested scope.
163
- if (forbidden.length > 0) {
164
- throw new Error(`Scopes not allowed for this SubHandle: ${forbidden.join(', ')}`);
165
- }
166
- }
167
- // TTL check
168
- if (this._subMetadata.maxSessionTtl !== undefined &&
169
- options.ttl > this._subMetadata.maxSessionTtl) {
170
- throw new Error(`TTL ${options.ttl}s exceeds max allowed ` +
171
- `${this._subMetadata.maxSessionTtl}s for this SubHandle`);
172
- }
173
- // SubHandle expiration check
174
- if (this._subMetadata.expiresAt !== undefined) {
175
- const now = Math.floor(Date.now() / 1000);
176
- if (now >= this._subMetadata.expiresAt) {
177
- throw new Error('SubHandle has expired');
178
- }
179
- }
180
- }
181
- }
3
+ // Public import path for SubHandle. Since PR-10 (D4) the class pair
4
+ // `Handle`/`SubHandle` lives in `handle.ts`: `SubHandle extends Handle`,
5
+ // and a static cross-file import of the subclass would create an ESM
6
+ // module cycle that crashes at import time depending on the graph root
7
+ // (reproduced: "Cannot access 'Handle' before initialization"). The
8
+ // pre-PR-10 dynamic `import()` dodge is gone; co-location keeps the
9
+ // module graph acyclic and 100% static.
10
+ //
11
+ // This facade re-exports the class and its metadata type unchanged, so
12
+ // `import { SubHandle } from '@me2em/core'` and internal imports of
13
+ // `./subhandle.js` keep working exactly as before.
14
+ export { SubHandle } from './handle.js';
182
15
  //# sourceMappingURL=subhandle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subhandle.js","sourceRoot":"","sources":["../src/subhandle.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,EAAE;AACF,yDAAyD;AACzD,0DAA0D;AAC1D,gEAAgE;AAEhE,OAAO,EAAE,MAAM,EAAuB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAsCpD;;;;GAIG;AACH,SAAS,oBAAoB,CAC3B,IAAwB;IAExB,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,MAAM,OAAO,GAAmB,EAAE,CAAC;IACnC,IAAI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AK,CAAC,uBAAuB,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"subhandle.js","sourceRoot":"","sources":["../src/subhandle.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,EAAE;AACF,oEAAoE;AACpE,yEAAyE;AACzE,qEAAqE;AACrE,uEAAuE;AACvE,oEAAoE;AACpE,oEAAoE;AACpE,wCAAwC;AACxC,EAAE;AACF,uEAAuE;AACvE,oEAAoE;AACpE,mDAAmD;AAEnD,OAAO,EAAE,SAAS,EAA0B,MAAM,aAAa,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * An object capable of producing Ed25519 signatures.
3
+ *
4
+ * The normative v1.0 issuance contract (specs/v1.0.md §8): raw private
5
+ * keys never cross a trust boundary as function arguments —
6
+ * `Attestation.issue` accepts a `Signer`, not key bytes. `Identity` and
7
+ * `Handle` implement this interface; custom implementations (e.g.
8
+ * remote- or HSM-backed signing) are accepted structurally — no
9
+ * inheritance from a base class is required.
10
+ *
11
+ * @category Types
12
+ */
13
+ export interface Signer {
14
+ /**
15
+ * Signs `data` with the signer's own private key.
16
+ *
17
+ * @param data - The bytes to sign.
18
+ * @returns A promise resolving to the 64-byte Ed25519 signature.
19
+ */
20
+ sign(data: Uint8Array): Promise<Uint8Array>;
21
+ }
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,MAAM;IACrB;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC7C"}
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ // types.ts
2
+ //
3
+ // Cross-cutting public interfaces of @me2em/core that are not tied to a
4
+ // single class file (PLAN-LTS-v1 PR-6, task 1.2 / DR D2).
5
+ export {};
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,EAAE;AACF,wEAAwE;AACxE,0DAA0D"}
package/dist/util.d.ts CHANGED
@@ -1,9 +1,56 @@
1
+ /**
2
+ * Node.js console/inspect hook (`util.inspect.custom`), referenced by
3
+ * `Symbol.for` so that no `node:util` import — and therefore no Node
4
+ * dependency — leaks into browser bundles. In non-Node runtimes the
5
+ * symbol simply has no meaning and the method is never called.
6
+ */
7
+ export declare const INSPECT_SYMBOL: unique symbol;
1
8
  /**
2
9
  * Encodes a Uint8Array to a URL-safe Base64 string (no padding).
10
+ *
11
+ * Implemented on top of the audited `@scure/base` codec (A3) — a crypto
12
+ * library must not hand-roll its own base64 alphabet handling. The
13
+ * output is byte-identical to the previous hand-rolled encoder
14
+ * (unpadded URL-safe Base64), so token serialization does not change.
15
+ *
16
+ * @param bytes - The bytes to encode.
17
+ * @returns The unpadded URL-safe Base64 string (`''` for empty input).
3
18
  */
4
19
  export declare function base64urlEncode(bytes: Uint8Array): string;
5
20
  /**
6
21
  * Decodes a URL-safe Base64 string to a Uint8Array.
22
+ *
23
+ * Implemented on top of the audited `@scure/base` codec (A3). Throws a
24
+ * generic `Error` on inputs with characters outside the URL-safe
25
+ * alphabet or an impossible length — token parsers wrap this call and
26
+ * translate failures into `AttestationError` `MALFORMED`/`FORMAT`.
27
+ *
28
+ * @param input - The unpadded URL-safe Base64 string.
29
+ * @returns The decoded bytes.
7
30
  */
8
31
  export declare function base64urlDecode(input: string): Uint8Array;
32
+ /**
33
+ * RFC 4122 version-4 UUID with a runtime-portability fallback (PR-7):
34
+ * uses `crypto.randomUUID` where available (Node ≥14.17, modern
35
+ * browsers) and otherwise builds the UUID from
36
+ * `crypto.getRandomValues` bytes with the version/variant bits set.
37
+ * Keeps `Attestation.issue` and `Session.create` working on runtimes
38
+ * without `randomUUID` (older React Native JS engines, non-secure
39
+ * browser contexts).
40
+ *
41
+ * @returns A random UUID in the canonical 8-4-4-4-12 hex form.
42
+ */
43
+ export declare function randomUUID(): string;
44
+ /**
45
+ * `JSON.parse` hardened against prototype pollution (PR-7): parsing
46
+ * aborts when any key named `__proto__` appears in the payload, so a
47
+ * hostile token can never plant properties on `Object.prototype` —
48
+ * neither directly (the parse is aborted) nor via later spreads of the
49
+ * parsed value into fresh objects.
50
+ *
51
+ * @param input - The JSON text to parse.
52
+ * @returns The parsed value.
53
+ * @throws {SyntaxError} On invalid JSON or a forbidden `__proto__` key.
54
+ */
55
+ export declare function safeJsonParse(input: string): unknown;
9
56
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CASzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAazD"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,eAAO,MAAM,cAAc,eAA2C,CAAC;AAEvE;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEzD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEzD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAiBnC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAOpD"}
package/dist/util.js CHANGED
@@ -1,34 +1,86 @@
1
1
  // util.ts
2
2
  //
3
- // Shared utility functions for the Me2em protocol.
3
+ // Shared utility functions for the Me2eM protocol.
4
+ import { base64urlnopad } from '@scure/base';
5
+ /**
6
+ * Node.js console/inspect hook (`util.inspect.custom`), referenced by
7
+ * `Symbol.for` so that no `node:util` import — and therefore no Node
8
+ * dependency — leaks into browser bundles. In non-Node runtimes the
9
+ * symbol simply has no meaning and the method is never called.
10
+ */
11
+ export const INSPECT_SYMBOL = Symbol.for('nodejs.util.inspect.custom');
4
12
  /**
5
13
  * Encodes a Uint8Array to a URL-safe Base64 string (no padding).
14
+ *
15
+ * Implemented on top of the audited `@scure/base` codec (A3) — a crypto
16
+ * library must not hand-roll its own base64 alphabet handling. The
17
+ * output is byte-identical to the previous hand-rolled encoder
18
+ * (unpadded URL-safe Base64), so token serialization does not change.
19
+ *
20
+ * @param bytes - The bytes to encode.
21
+ * @returns The unpadded URL-safe Base64 string (`''` for empty input).
6
22
  */
7
23
  export function base64urlEncode(bytes) {
8
- let binary = '';
9
- for (const byte of bytes) {
10
- binary += String.fromCharCode(byte);
11
- }
12
- return btoa(binary)
13
- .replace(/\+/g, '-')
14
- .replace(/\//g, '_')
15
- .replace(/=+$/, '');
24
+ return base64urlnopad.encode(bytes);
16
25
  }
17
26
  /**
18
27
  * Decodes a URL-safe Base64 string to a Uint8Array.
28
+ *
29
+ * Implemented on top of the audited `@scure/base` codec (A3). Throws a
30
+ * generic `Error` on inputs with characters outside the URL-safe
31
+ * alphabet or an impossible length — token parsers wrap this call and
32
+ * translate failures into `AttestationError` `MALFORMED`/`FORMAT`.
33
+ *
34
+ * @param input - The unpadded URL-safe Base64 string.
35
+ * @returns The decoded bytes.
19
36
  */
20
37
  export function base64urlDecode(input) {
21
- let base64 = input
22
- .replace(/-/g, '+')
23
- .replace(/_/g, '/');
24
- while (base64.length % 4 !== 0) {
25
- base64 += '=';
26
- }
27
- const binary = atob(base64);
28
- const bytes = new Uint8Array(binary.length);
29
- for (let i = 0; i < binary.length; i++) {
30
- bytes[i] = binary.charCodeAt(i);
38
+ return base64urlnopad.decode(input);
39
+ }
40
+ /**
41
+ * RFC 4122 version-4 UUID with a runtime-portability fallback (PR-7):
42
+ * uses `crypto.randomUUID` where available (Node ≥14.17, modern
43
+ * browsers) and otherwise builds the UUID from
44
+ * `crypto.getRandomValues` bytes with the version/variant bits set.
45
+ * Keeps `Attestation.issue` and `Session.create` working on runtimes
46
+ * without `randomUUID` (older React Native JS engines, non-secure
47
+ * browser contexts).
48
+ *
49
+ * @returns A random UUID in the canonical 8-4-4-4-12 hex form.
50
+ */
51
+ export function randomUUID() {
52
+ const c = globalThis.crypto;
53
+ if (typeof c?.randomUUID === 'function') {
54
+ return c.randomUUID();
31
55
  }
32
- return bytes;
56
+ const bytes = new Uint8Array(16);
57
+ c.getRandomValues(bytes);
58
+ bytes[6] = (bytes[6] & 0x0f) | 0x40; // version 4
59
+ bytes[8] = (bytes[8] & 0x3f) | 0x80; // variant 10xx
60
+ const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0'));
61
+ return (hex.slice(0, 4).join('') + '-' +
62
+ hex.slice(4, 6).join('') + '-' +
63
+ hex.slice(6, 8).join('') + '-' +
64
+ hex.slice(8, 10).join('') + '-' +
65
+ hex.slice(10, 16).join(''));
66
+ }
67
+ /**
68
+ * `JSON.parse` hardened against prototype pollution (PR-7): parsing
69
+ * aborts when any key named `__proto__` appears in the payload, so a
70
+ * hostile token can never plant properties on `Object.prototype` —
71
+ * neither directly (the parse is aborted) nor via later spreads of the
72
+ * parsed value into fresh objects.
73
+ *
74
+ * @param input - The JSON text to parse.
75
+ * @returns The parsed value.
76
+ * @throws {SyntaxError} On invalid JSON or a forbidden `__proto__` key.
77
+ */
78
+ export function safeJsonParse(input) {
79
+ return JSON.parse(input, (key, value) => {
80
+ if (key === '__proto__') {
81
+ throw new SyntaxError('payload contains the forbidden key "__proto__"');
82
+ }
83
+ return value;
84
+ });
33
85
  }
34
86
  //# sourceMappingURL=util.js.map
package/dist/util.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,EAAE;A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B,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG;QAC9B,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG;QAC/B,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAC3B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,GAAW,EAAE,KAAc,EAAE,EAAE;QACvD,IAAI,GAAG,KAAK,WAAW,EAAE,CAAC;YACxB,MAAM,IAAI,WAAW,CAAC,gDAAgD,CAAC,CAAC;QAC1E,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@me2em/core",
3
- "version": "0.7.0-alpha.2",
4
- "description": "Core primitives for the Me2em authorization protocol: Identity, Handle, and Session",
3
+ "version": "1.0.0-rc.1",
4
+ "description": "Core primitives for the Me2eM authorization protocol: Identity, Handle, and Session",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -18,6 +18,9 @@
18
18
  "LICENSE"
19
19
  ],
20
20
  "license": "Apache-2.0",
21
+ "engines": {
22
+ "node": ">=22.6.0"
23
+ },
21
24
  "publishConfig": {
22
25
  "access": "public"
23
26
  },
@@ -25,12 +28,12 @@
25
28
  "@noble/curves": "^1.8.1",
26
29
  "@noble/ed25519": "^3.1.0",
27
30
  "@noble/hashes": "^2.2.0",
31
+ "@scure/base": "^2.4.0",
28
32
  "@scure/bip39": "^1.3.0"
29
33
  },
30
34
  "devDependencies": {
31
35
  "@types/node": "^25.9.1",
32
36
  "@vitest/coverage-v8": "^4.1.11",
33
- "eslint": "^10.4.1",
34
37
  "typescript": "^6.0.3",
35
38
  "vitest": "^4.1.7"
36
39
  },
@@ -38,7 +41,10 @@
38
41
  "build": "tsc -p tsconfig.json",
39
42
  "test": "vitest run",
40
43
  "test:coverage": "vitest run --coverage",
41
- "lint": "eslint src",
44
+ "bench": "vitest bench --run",
45
+ "bench:baseline": "vitest bench --run --outputJson bench/baseline.json && node scripts/normalize-baseline.mjs",
46
+ "vectors": "tsc -p tsconfig.json && node --experimental-strip-types scripts/generate-vectors.ts",
47
+ "lint": "eslint .",
42
48
  "typecheck": "tsc --noEmit",
43
49
  "build-docs": "typedoc"
44
50
  }