@me2em/core 0.4.4-alpha.1 → 0.4.4-alpha.2

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 (62) hide show
  1. package/README.md +159 -373
  2. package/dist/crypto/ed25519.d.ts +12 -0
  3. package/dist/crypto/ed25519.d.ts.map +1 -0
  4. package/dist/crypto/ed25519.js +12 -0
  5. package/dist/crypto/ed25519.js.map +1 -0
  6. package/dist/crypto/hkdf.d.ts +13 -0
  7. package/dist/crypto/hkdf.d.ts.map +1 -0
  8. package/dist/crypto/hkdf.js +16 -0
  9. package/dist/crypto/hkdf.js.map +1 -0
  10. package/dist/crypto/index.d.ts +3 -0
  11. package/dist/crypto/index.d.ts.map +1 -0
  12. package/dist/crypto/index.js +3 -0
  13. package/dist/crypto/index.js.map +1 -0
  14. package/dist/crypto/init.d.ts +9 -0
  15. package/dist/crypto/init.d.ts.map +1 -0
  16. package/dist/crypto/init.js +16 -0
  17. package/dist/crypto/init.js.map +1 -0
  18. package/dist/handle.d.ts +87 -0
  19. package/dist/handle.d.ts.map +1 -0
  20. package/dist/handle.js +113 -0
  21. package/dist/handle.js.map +1 -0
  22. package/dist/identity.d.ts +43 -0
  23. package/dist/identity.d.ts.map +1 -0
  24. package/dist/identity.js +71 -0
  25. package/dist/identity.js.map +1 -0
  26. package/dist/index.d.ts +29 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +29 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/seed.d.ts +96 -0
  31. package/dist/seed.d.ts.map +1 -0
  32. package/dist/seed.js +127 -0
  33. package/dist/seed.js.map +1 -0
  34. package/dist/session.d.ts +41 -0
  35. package/dist/session.d.ts.map +1 -0
  36. package/dist/session.js +37 -0
  37. package/dist/session.js.map +1 -0
  38. package/package.json +36 -12
  39. package/.github/workflows/ci.yml +0 -0
  40. package/CODE_OF_CONDUCT.md +0 -73
  41. package/CONTRIBUTING.md +0 -145
  42. package/GOVERNANCE.md +0 -132
  43. package/SECURITY.md +0 -70
  44. package/packages/core/README.md +0 -656
  45. package/packages/core/package.json +0 -44
  46. package/packages/core/test/derivation.spec.ts +0 -117
  47. package/packages/core/tsconfig.json +0 -9
  48. package/pnpm-workspace.yaml +0 -2
  49. package/specs/core.md +0 -44
  50. package/specs/openapi/server-ref.yaml +0 -10
  51. package/specs/test-vectors.json +0 -13
  52. package/tsconfig.base.json +0 -20
  53. package/typedoc.json +0 -18
  54. /package/{packages/core/src → src}/crypto/ed25519.ts +0 -0
  55. /package/{packages/core/src → src}/crypto/hkdf.ts +0 -0
  56. /package/{packages/core/src → src}/crypto/index.ts +0 -0
  57. /package/{packages/core/src → src}/crypto/init.ts +0 -0
  58. /package/{packages/core/src → src}/handle.ts +0 -0
  59. /package/{packages/core/src → src}/identity.ts +0 -0
  60. /package/{packages/core/src → src}/index.ts +0 -0
  61. /package/{packages/core/src → src}/seed.ts +0 -0
  62. /package/{packages/core/src → src}/session.ts +0 -0
@@ -0,0 +1,12 @@
1
+ import { ed } from './init.js';
2
+ /**
3
+ * @internal
4
+ * Low-level Ed25519 implementation wrapper.
5
+ */
6
+ export declare const getPublicKey: (secretKey: ed.TArg<Uint8Array>) => ed.TRet<Uint8Array>;
7
+ export declare const sign: (message: ed.TArg<Uint8Array>, secretKey: ed.TArg<Uint8Array>) => ed.TRet<Uint8Array>;
8
+ export declare const verify: (signature: ed.TArg<Uint8Array>, message: ed.TArg<Uint8Array>, publicKey: ed.TArg<Uint8Array>, opts?: ed.TArg<ed.EdDSAVerifyOpts>) => boolean;
9
+ export declare const getPublicKeyAsync: (secretKey: ed.TArg<Uint8Array>) => Promise<ed.TRet<Uint8Array>>;
10
+ export declare const signAsync: (message: ed.TArg<Uint8Array>, secretKey: ed.TArg<Uint8Array>) => Promise<ed.TRet<Uint8Array>>;
11
+ export declare const verifyAsync: (signature: ed.TArg<Uint8Array>, message: ed.TArg<Uint8Array>, publicKey: ed.TArg<Uint8Array>, opts?: ed.TArg<ed.EdDSAVerifyOpts>) => Promise<boolean>;
12
+ //# sourceMappingURL=ed25519.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ed25519.d.ts","sourceRoot":"","sources":["../../src/crypto/ed25519.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAE/B;;;GAGG;AACH,eAAO,MAAM,YAAY,yDAAkB,CAAC;AAC5C,eAAO,MAAM,IAAI,uFAAU,CAAC;AAC5B,eAAO,MAAM,MAAM,+IAAY,CAAC;AAChC,eAAO,MAAM,iBAAiB,kEAAuB,CAAC;AACtD,eAAO,MAAM,SAAS,gGAAe,CAAC;AACtC,eAAO,MAAM,WAAW,wJAAiB,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { ed } from './init.js';
2
+ /**
3
+ * @internal
4
+ * Low-level Ed25519 implementation wrapper.
5
+ */
6
+ export const getPublicKey = ed.getPublicKey;
7
+ export const sign = ed.sign;
8
+ export const verify = ed.verify;
9
+ export const getPublicKeyAsync = ed.getPublicKeyAsync;
10
+ export const signAsync = ed.signAsync;
11
+ export const verifyAsync = ed.verifyAsync;
12
+ //# sourceMappingURL=ed25519.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ed25519.js","sourceRoot":"","sources":["../../src/crypto/ed25519.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AAE/B;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC;AAC5C,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC;AAC5B,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC;AAChC,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC,iBAAiB,CAAC;AACtD,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC,SAAS,CAAC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC,WAAW,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { sha256 as nobleSha256 } from '@noble/hashes/sha2.js';
2
+ /**
3
+ * HKDF-SHA256 wrapper for me2em protocol
4
+ *
5
+ * @param ikm - Input key material
6
+ * @param salt - Salt (can be empty Uint8Array)
7
+ * @param info - Context info
8
+ * @param length - Output length in bytes
9
+ * @returns Derived key as Uint8Array
10
+ */
11
+ export declare function hkdf(ikm: Uint8Array, salt: Uint8Array, info: Uint8Array, length: number): Uint8Array;
12
+ export { nobleSha256 as sha256 };
13
+ //# sourceMappingURL=hkdf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hkdf.d.ts","sourceRoot":"","sources":["../../src/crypto/hkdf.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAClB,GAAG,EAAE,UAAU,EACf,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GACb,UAAU,CAEZ;AAED,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { hkdf as nobleHkdf } from '@noble/hashes/hkdf.js';
2
+ import { sha256 as nobleSha256 } from '@noble/hashes/sha2.js';
3
+ /**
4
+ * HKDF-SHA256 wrapper for me2em protocol
5
+ *
6
+ * @param ikm - Input key material
7
+ * @param salt - Salt (can be empty Uint8Array)
8
+ * @param info - Context info
9
+ * @param length - Output length in bytes
10
+ * @returns Derived key as Uint8Array
11
+ */
12
+ export function hkdf(ikm, salt, info, length) {
13
+ return nobleHkdf(nobleSha256, ikm, salt, info, length);
14
+ }
15
+ export { nobleSha256 as sha256 };
16
+ //# sourceMappingURL=hkdf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hkdf.js","sourceRoot":"","sources":["../../src/crypto/hkdf.ts"],"names":[],"mappings":"AAAA,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,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './ed25519.js';
2
+ export * from './hkdf.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crypto/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './ed25519.js';
2
+ export * from './hkdf.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/crypto/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
@@ -0,0 +1,9 @@
1
+ import * as ed from '@noble/ed25519';
2
+ import { sha512 } from '@noble/hashes/sha2.js';
3
+ /**
4
+ * Configure @noble/ed25519 for synchronous operations.
5
+ * Must be called before any ed25519 operation (sign, verify, getPublicKey).
6
+ */
7
+ export declare function initEd25519(): void;
8
+ export { ed, sha512 };
9
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/crypto/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;;GAGG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAKlC;AAKD,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ import * as ed from '@noble/ed25519';
2
+ import { sha512 } from '@noble/hashes/sha2.js';
3
+ /**
4
+ * Configure @noble/ed25519 for synchronous operations.
5
+ * Must be called before any ed25519 operation (sign, verify, getPublicKey).
6
+ */
7
+ export function initEd25519() {
8
+ // Configure sha512 for sync operations (required for @noble/ed25519 v3)
9
+ if (!ed.hashes.sha512) {
10
+ ed.hashes.sha512 = sha512;
11
+ }
12
+ }
13
+ // Auto-init on module load
14
+ initEd25519();
15
+ export { ed, sha512 };
16
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/crypto/init.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;;GAGG;AACH,MAAM,UAAU,WAAW;IACzB,wEAAwE;IACxE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACtB,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,2BAA2B;AAC3B,WAAW,EAAE,CAAC;AAEd,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,87 @@
1
+ export interface HandleMetadata {
2
+ displayName?: string;
3
+ avatar?: string;
4
+ [key: string]: unknown;
5
+ }
6
+ /**
7
+ * Represents a context-specific cryptographic handle derived from an {@link Identity}.
8
+ *
9
+ * A Handle encapsulates a private key tied to a specific name (context).
10
+ * It provides methods for signing data, verifying signatures, and deriving
11
+ * secondary secrets (like passwords or channel keys) without ever exposing
12
+ * the underlying private key.
13
+ *
14
+ * @category Core Primitives
15
+ */
16
+ export declare class Handle {
17
+ private readonly privateKey;
18
+ private readonly publicKey;
19
+ private readonly _name;
20
+ private readonly _metadata?;
21
+ /**
22
+ * Creates a new Handle instance.
23
+ * @internal Typically created via {@link Identity.deriveHandle}.
24
+ *
25
+ * @param privateKey - The 32-byte Ed25519 private key for this handle.
26
+ * @param name - The context name this handle represents.
27
+ * @param metadata - Optional metadata associated with this handle.
28
+ */
29
+ constructor(privateKey: Uint8Array, name: string, metadata?: HandleMetadata);
30
+ /** @returns The unique context identifier for this Handle. */
31
+ getId(): string;
32
+ /**
33
+ * Cryptographically signs arbitrary data using the Handle's private key.
34
+ * @param data - The data to be signed, as a Uint8Array.
35
+ * @returns A Promise resolving to the Ed25519 signature as a Uint8Array.
36
+ */
37
+ sign(data: Uint8Array): Promise<Uint8Array>;
38
+ /**
39
+ * Verifies an Ed25519 signature against the provided data and public key.
40
+ * @param signature - The signature to verify (Uint8Array).
41
+ * @param data - The original data that was signed (Uint8Array).
42
+ * @param publicKey - The public key to verify against (Uint8Array).
43
+ * @returns A Promise resolving to true if the signature is valid, false otherwise.
44
+ */
45
+ static verify(signature: Uint8Array, data: Uint8Array, publicKey: Uint8Array): Promise<boolean>;
46
+ /** @returns The context name associated with this Handle. */
47
+ getName(): string;
48
+ /** @returns The metadata object associated with this Handle. */
49
+ getMetadata(): HandleMetadata | undefined;
50
+ /** @returns A Uint8Array containing the 32-byte Ed25519 public key. */
51
+ getPublicKey(): Uint8Array;
52
+ /**
53
+ * Deterministically derives a secret (e.g., a password or API key) for a specific service context.
54
+ * The private key NEVER leaves this class, ensuring maximum security.
55
+ *
56
+ * @param context - A unique identifier for the service (e.g., 'google', 'github', 'wifi-router').
57
+ * @param length - Length of the derived raw bytes (default: 16 bytes = ~22 chars base64url).
58
+ * @returns A URL-safe base64 string suitable for use as a strong password.
59
+ */
60
+ derivePassword(context: string, length?: number): string;
61
+ /**
62
+ * Derives a symmetric 256-bit channel key for secure communication between
63
+ * the Identity (controller) and this Handle (device/context).
64
+ *
65
+ * Both parties can independently compute this key because:
66
+ * 1. The Handle possesses its own private key directly.
67
+ * 2. The Identity can derive the same private key via `identity.deriveHandle(name)`.
68
+ *
69
+ * This enables zero-knowledge encrypted channels without key exchange protocols.
70
+ *
71
+ * @param context - Channel identifier for domain separation (e.g., 'drone-001', 'session-abc'). Both parties MUST use the same context.
72
+ * @returns A 32-byte Uint8Array suitable for AES-256-GCM encryption.
73
+ * @example
74
+ * ```typescript
75
+ * // On the drone (Handle side):
76
+ * const channelKey = droneHandle.deriveChannelKey('telemetry-v1');
77
+ * const encrypted = await encryptAESGCM(telemetry, channelKey);
78
+ *
79
+ * // On the control center (Identity side):
80
+ * const droneHandle = await centerIdentity.deriveHandle('drone-001');
81
+ * const channelKey = droneHandle.deriveChannelKey('telemetry-v1');
82
+ * const decrypted = await decryptAESGCM(encrypted, channelKey);
83
+ * ```
84
+ */
85
+ deriveChannelKey(context: string): Uint8Array;
86
+ }
87
+ //# sourceMappingURL=handle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,qBAAa,MAAM;IACjB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;IACvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAiB;IAE1C;;;;;;;KAOC;gBACS,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc;IAO3E,8DAA8D;IAC9D,KAAK,IAAI,MAAM;IAOb;;;;KAIC;IACG,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAI/C;;;;;;KAMC;WACU,MAAM,CAAC,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC;IAIrG,6DAA6D;IAC7D,OAAO,IAAI,MAAM;IAEjB,gEAAgE;IAChE,WAAW,IAAI,cAAc,GAAG,SAAS;IAExC,uEAAuE;IACxE,YAAY,IAAI,UAAU;IAE1B;;;;;;;OAOG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,MAAW,GAAG,MAAM;IAc5D;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU;CAK9C"}
package/dist/handle.js ADDED
@@ -0,0 +1,113 @@
1
+ import { ed } from './crypto/init.js';
2
+ import { hkdf } from '@noble/hashes/hkdf.js';
3
+ import { sha256 } from '@noble/hashes/sha2.js';
4
+ /**
5
+ * Represents a context-specific cryptographic handle derived from an {@link Identity}.
6
+ *
7
+ * A Handle encapsulates a private key tied to a specific name (context).
8
+ * It provides methods for signing data, verifying signatures, and deriving
9
+ * secondary secrets (like passwords or channel keys) without ever exposing
10
+ * the underlying private key.
11
+ *
12
+ * @category Core Primitives
13
+ */
14
+ export class Handle {
15
+ privateKey;
16
+ publicKey;
17
+ _name;
18
+ _metadata;
19
+ /**
20
+ * Creates a new Handle instance.
21
+ * @internal Typically created via {@link Identity.deriveHandle}.
22
+ *
23
+ * @param privateKey - The 32-byte Ed25519 private key for this handle.
24
+ * @param name - The context name this handle represents.
25
+ * @param metadata - Optional metadata associated with this handle.
26
+ */
27
+ constructor(privateKey, name, metadata) {
28
+ this.privateKey = privateKey;
29
+ this.publicKey = ed.getPublicKey(privateKey);
30
+ this._name = name;
31
+ this._metadata = metadata;
32
+ }
33
+ /** @returns The unique context identifier for this Handle. */
34
+ getId() {
35
+ return btoa(String.fromCharCode(...this.publicKey))
36
+ .replace(/\+/g, '-')
37
+ .replace(/\//g, '_')
38
+ .replace(/=+$/, '');
39
+ }
40
+ /**
41
+ * Cryptographically signs arbitrary data using the Handle's private key.
42
+ * @param data - The data to be signed, as a Uint8Array.
43
+ * @returns A Promise resolving to the Ed25519 signature as a Uint8Array.
44
+ */
45
+ async sign(data) {
46
+ return ed.sign(data, this.privateKey);
47
+ }
48
+ /**
49
+ * Verifies an Ed25519 signature against the provided data and public key.
50
+ * @param signature - The signature to verify (Uint8Array).
51
+ * @param data - The original data that was signed (Uint8Array).
52
+ * @param publicKey - The public key to verify against (Uint8Array).
53
+ * @returns A Promise resolving to true if the signature is valid, false otherwise.
54
+ */
55
+ static async verify(signature, data, publicKey) {
56
+ return ed.verify(signature, data, publicKey);
57
+ }
58
+ /** @returns The context name associated with this Handle. */
59
+ getName() { return this._name; }
60
+ /** @returns The metadata object associated with this Handle. */
61
+ getMetadata() { return this._metadata; }
62
+ /** @returns A Uint8Array containing the 32-byte Ed25519 public key. */
63
+ getPublicKey() { return this.publicKey; }
64
+ /**
65
+ * Deterministically derives a secret (e.g., a password or API key) for a specific service context.
66
+ * The private key NEVER leaves this class, ensuring maximum security.
67
+ *
68
+ * @param context - A unique identifier for the service (e.g., 'google', 'github', 'wifi-router').
69
+ * @param length - Length of the derived raw bytes (default: 16 bytes = ~22 chars base64url).
70
+ * @returns A URL-safe base64 string suitable for use as a strong password.
71
+ */
72
+ derivePassword(context, length = 16) {
73
+ const salt = new TextEncoder().encode(`me2em/secret/${context.toLowerCase().trim()}`);
74
+ const info = new TextEncoder().encode('me2em/secret/v1');
75
+ // HKDF использует this.privateKey напрямую, не экспортируя его
76
+ const secretBytes = hkdf(sha256, this.privateKey, salt, info, length);
77
+ // Конвертация в URL-safe base64 (аналогично getId)
78
+ return btoa(String.fromCharCode(...secretBytes))
79
+ .replace(/\+/g, '-')
80
+ .replace(/\//g, '_')
81
+ .replace(/=+$/, '');
82
+ }
83
+ /**
84
+ * Derives a symmetric 256-bit channel key for secure communication between
85
+ * the Identity (controller) and this Handle (device/context).
86
+ *
87
+ * Both parties can independently compute this key because:
88
+ * 1. The Handle possesses its own private key directly.
89
+ * 2. The Identity can derive the same private key via `identity.deriveHandle(name)`.
90
+ *
91
+ * This enables zero-knowledge encrypted channels without key exchange protocols.
92
+ *
93
+ * @param context - Channel identifier for domain separation (e.g., 'drone-001', 'session-abc'). Both parties MUST use the same context.
94
+ * @returns A 32-byte Uint8Array suitable for AES-256-GCM encryption.
95
+ * @example
96
+ * ```typescript
97
+ * // On the drone (Handle side):
98
+ * const channelKey = droneHandle.deriveChannelKey('telemetry-v1');
99
+ * const encrypted = await encryptAESGCM(telemetry, channelKey);
100
+ *
101
+ * // On the control center (Identity side):
102
+ * const droneHandle = await centerIdentity.deriveHandle('drone-001');
103
+ * const channelKey = droneHandle.deriveChannelKey('telemetry-v1');
104
+ * const decrypted = await decryptAESGCM(encrypted, channelKey);
105
+ * ```
106
+ */
107
+ deriveChannelKey(context) {
108
+ const salt = new TextEncoder().encode(`me2em/channel/${context.toLowerCase().trim()}`);
109
+ const info = new TextEncoder().encode('me2em/channel/v1');
110
+ return hkdf(sha256, this.privateKey, salt, info, 32);
111
+ }
112
+ }
113
+ //# sourceMappingURL=handle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle.js","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,43 @@
1
+ import { Handle, type HandleMetadata } from './handle.js';
2
+ /**
3
+ * Represents the root cryptographic identity derived from a seed phrase.
4
+ *
5
+ * An Identity is the foundation of the Me2em protocol. It allows for the
6
+ * hierarchical derivation of isolated {@link Handle}s for different contexts
7
+ * (e.g., email, social, specific devices) from a single master seed,
8
+ * ensuring zero cross-contamination of cryptographic material.
9
+ *
10
+ * @category Core Primitives
11
+ */
12
+ export declare class Identity {
13
+ private readonly privateKey;
14
+ private readonly publicKey;
15
+ private constructor();
16
+ /**
17
+ * Initializes a new Identity from a BIP39 mnemonic seed phrase or raw seed bytes.
18
+ *
19
+ * @param seed - A 12 or 24-word BIP39 mnemonic string, or a raw Uint8Array seed.
20
+ * @returns A Promise resolving to a new Identity instance.
21
+ * @throws {Error} If the provided seed is invalid or cannot be processed.
22
+ */
23
+ static fromSeed(seed: Uint8Array | string): Promise<Identity>;
24
+ /**
25
+ * Derives a new, cryptographically isolated {@link Handle} for a specific context.
26
+ *
27
+ * Each Handle is derived deterministically. The same name and metadata will
28
+ * always produce the same Handle from the same Identity, but different names
29
+ * produce completely unrelated keys.
30
+ *
31
+ * @param name - The context identifier (e.g., 'alice@example.com', 'device-1').
32
+ * @param metadata - Optional metadata to associate with this Handle.
33
+ * @returns A Promise resolving to the derived Handle.
34
+ */
35
+ deriveHandle(name: string, metadata?: HandleMetadata): Promise<Handle>;
36
+ /**
37
+ * Retrieves the public key of the root Identity.
38
+ *
39
+ * @returns A Uint8Array containing the 32-byte Ed25519 public key.
40
+ */
41
+ getPublicKey(): Uint8Array;
42
+ }
43
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAI1D;;;;;;;;;GASG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;IAEvC,OAAO;IAKL;;;;;;KAMC;WACU,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAoBjE;;;;;;;;;;KAUC;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAgB5E;;;;OAIG;IACH,YAAY,IAAI,UAAU;CAG3B"}
@@ -0,0 +1,71 @@
1
+ import { ed } from './crypto/init.js'; // ← sha512 теперь импортируется из init
2
+ import { hkdf } from '@noble/hashes/hkdf.js';
3
+ import { sha256 } from '@noble/hashes/sha2.js';
4
+ import { Handle } from './handle.js';
5
+ const ME2EM_HKDF_INFO_PREFIX = 'me2em/handle/v1/';
6
+ /**
7
+ * Represents the root cryptographic identity derived from a seed phrase.
8
+ *
9
+ * An Identity is the foundation of the Me2em protocol. It allows for the
10
+ * hierarchical derivation of isolated {@link Handle}s for different contexts
11
+ * (e.g., email, social, specific devices) from a single master seed,
12
+ * ensuring zero cross-contamination of cryptographic material.
13
+ *
14
+ * @category Core Primitives
15
+ */
16
+ export class Identity {
17
+ privateKey;
18
+ publicKey;
19
+ constructor(privateKey) {
20
+ this.privateKey = privateKey;
21
+ this.publicKey = ed.getPublicKey(privateKey); // Теперь работает синхронно
22
+ }
23
+ /**
24
+ * Initializes a new Identity from a BIP39 mnemonic seed phrase or raw seed bytes.
25
+ *
26
+ * @param seed - A 12 or 24-word BIP39 mnemonic string, or a raw Uint8Array seed.
27
+ * @returns A Promise resolving to a new Identity instance.
28
+ * @throws {Error} If the provided seed is invalid or cannot be processed.
29
+ */
30
+ static async fromSeed(seed) {
31
+ const seedBytes = typeof seed === 'string'
32
+ ? Uint8Array.from(Buffer.from(seed, 'hex'))
33
+ : seed;
34
+ if (seedBytes.length !== 32) {
35
+ throw new Error('Invalid seed: must be 32 bytes');
36
+ }
37
+ const key = hkdf(sha256, seedBytes, new Uint8Array(0), // salt
38
+ new TextEncoder().encode('me2em/identity/v1/root'), // info
39
+ 32 // length
40
+ );
41
+ return new Identity(key);
42
+ }
43
+ /**
44
+ * Derives a new, cryptographically isolated {@link Handle} for a specific context.
45
+ *
46
+ * Each Handle is derived deterministically. The same name and metadata will
47
+ * always produce the same Handle from the same Identity, but different names
48
+ * produce completely unrelated keys.
49
+ *
50
+ * @param name - The context identifier (e.g., 'alice@example.com', 'device-1').
51
+ * @param metadata - Optional metadata to associate with this Handle.
52
+ * @returns A Promise resolving to the derived Handle.
53
+ */
54
+ async deriveHandle(name, metadata) {
55
+ const info = new TextEncoder().encode(ME2EM_HKDF_INFO_PREFIX + name.toLowerCase().trim());
56
+ // Используем sha256 для единообразия (или sha512, если нужно)
57
+ // Важно: используем тот же хэш, что и в спецификации
58
+ const handleKey = hkdf(sha256, // ← Используем sha256 для совместимости с Identity деривацией
59
+ this.privateKey, new Uint8Array(0), info, 32);
60
+ return new Handle(handleKey, name, metadata);
61
+ }
62
+ /**
63
+ * Retrieves the public key of the root Identity.
64
+ *
65
+ * @returns A Uint8Array containing the 32-byte Ed25519 public key.
66
+ */
67
+ getPublicKey() {
68
+ return this.publicKey;
69
+ }
70
+ }
71
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAU,MAAM,kBAAkB,CAAC,CAAE,wCAAwC;AACxF,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAuB,MAAM,aAAa,CAAC;AAE1D,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAElD;;;;;;;;;GASG;AACH,MAAM,OAAO,QAAQ;IACF,UAAU,CAAa;IACvB,SAAS,CAAa;IAEvC,YAAoB,UAAsB;QACxC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAE,4BAA4B;IAC7E,CAAC;IAEC;;;;;;KAMC;IACH,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAyB;QAC7C,MAAM,SAAS,GAAG,OAAO,IAAI,KAAK,QAAQ;YACxC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC3C,CAAC,CAAC,IAAI,CAAC;QAET,IAAI,SAAS,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,CACd,MAAM,EACN,SAAS,EACT,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO;QAC1B,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,wBAAwB,CAAC,EAAE,OAAO;QAC3D,EAAE,CAAC,SAAS;SACb,CAAC;QAEF,OAAO,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;IAEC;;;;;;;;;;KAUC;IACH,KAAK,CAAC,YAAY,CAAC,IAAY,EAAE,QAAyB;QACxD,MAAM,IAAI,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,sBAAsB,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QAE1F,8DAA8D;QAC9D,qDAAqD;QACrD,MAAM,SAAS,GAAG,IAAI,CACpB,MAAM,EAAG,8DAA8D;QACvE,IAAI,CAAC,UAAU,EACf,IAAI,UAAU,CAAC,CAAC,CAAC,EACjB,IAAI,EACJ,EAAE,CACH,CAAC;QAEF,OAAO,IAAI,MAAM,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED;;;;OAIG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
@@ -0,0 +1,29 @@
1
+ export { Identity } from './identity.js';
2
+ export { Handle, type HandleMetadata } from './handle.js';
3
+ export { Session, type SessionOptions, type SessionToken } from './session.js';
4
+ export * as crypto from './crypto/index.js';
5
+ /**
6
+ * @module @me2em/core
7
+ * @packageDocumentation
8
+ *
9
+ * Core cryptographic primitives for the Me2em authorization protocol.
10
+ *
11
+ * This package provides the foundation for decentralized, multi-context
12
+ * identity management and secure, stateless authentication.
13
+ *
14
+ * ## Key Features
15
+ * - **Hierarchical Identities**: Derive multiple isolated {@link Handle}s from a single seed.
16
+ * - **Stateless Auth**: Cryptographic proof without server-side session storage via {@link Session}.
17
+ * - **Zero-Knowledge Secrets**: Deterministic password derivation without storage.
18
+ *
19
+ * @example Basic usage
20
+ * ```typescript
21
+ * import { Identity } from '@me2em/core';
22
+ *
23
+ * const identity = await Identity.fromSeed('your twelve word mnemonic phrase here...');
24
+ * const handle = await identity.deriveHandle('user@example.com');
25
+ * const signature = await handle.sign(new TextEncoder().encode('data'));
26
+ * ```
27
+ */
28
+ export { generateSeedPhrase, normalizeSeedPhrase, validateSeedPhrase, get32ByteSeedFromMnemonic, type SeedStrength } from './seed.js';
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EACzB,KAAK,YAAY,EAClB,MAAM,WAAW,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,29 @@
1
+ export { Identity } from './identity.js';
2
+ export { Handle } from './handle.js';
3
+ export { Session } from './session.js';
4
+ export * as crypto from './crypto/index.js';
5
+ /**
6
+ * @module @me2em/core
7
+ * @packageDocumentation
8
+ *
9
+ * Core cryptographic primitives for the Me2em authorization protocol.
10
+ *
11
+ * This package provides the foundation for decentralized, multi-context
12
+ * identity management and secure, stateless authentication.
13
+ *
14
+ * ## Key Features
15
+ * - **Hierarchical Identities**: Derive multiple isolated {@link Handle}s from a single seed.
16
+ * - **Stateless Auth**: Cryptographic proof without server-side session storage via {@link Session}.
17
+ * - **Zero-Knowledge Secrets**: Deterministic password derivation without storage.
18
+ *
19
+ * @example Basic usage
20
+ * ```typescript
21
+ * import { Identity } from '@me2em/core';
22
+ *
23
+ * const identity = await Identity.fromSeed('your twelve word mnemonic phrase here...');
24
+ * const handle = await identity.deriveHandle('user@example.com');
25
+ * const signature = await handle.sign(new TextEncoder().encode('data'));
26
+ * ```
27
+ */
28
+ export { generateSeedPhrase, normalizeSeedPhrase, validateSeedPhrase, get32ByteSeedFromMnemonic } from './seed.js';
29
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAuB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,OAAO,EAA0C,MAAM,cAAc,CAAC;AAC/E,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EAE1B,MAAM,WAAW,CAAC"}
package/dist/seed.d.ts ADDED
@@ -0,0 +1,96 @@
1
+ export type SeedStrength = 128 | 256;
2
+ /**
3
+ * Utilities for BIP39 mnemonic seed phrase generation and validation.
4
+ *
5
+ * These functions provide secure, deterministic seed phrase handling
6
+ * compatible with the BIP39 standard.
7
+ *
8
+ * @category Seed Utilities
9
+ * @packageDocumentation
10
+ */
11
+ /**
12
+ * Generates a cryptographically secure random mnemonic seed phrase.
13
+ *
14
+ * @param strength - The entropy strength in bits.
15
+ * - 128 bits = 12 words (standard security)
16
+ * - 160 bits = 15 words
17
+ * - 192 bits = 18 words
18
+ * - 224 bits = 21 words
19
+ * - 256 bits = 24 words (maximum security)
20
+ *
21
+ * @returns A Promise resolving to a space-separated mnemonic string.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const mnemonic12 = await generateSeedPhrase(128);
26
+ * // "abandon abandon abandon ... art"
27
+ *
28
+ * const mnemonic24 = await generateSeedPhrase(256);
29
+ * // "abandon abandon abandon ... zoo" (24 words)
30
+ * ```
31
+ */
32
+ export declare function generateSeedPhrase(strength?: SeedStrength): string[];
33
+ /**
34
+ * Normalizes a mnemonic seed phrase by trimming whitespace and converting to lowercase.
35
+ *
36
+ * @param phrase - The mnemonic phrase to normalize (string or array of words).
37
+ * @returns A normalized string of lowercase words separated by single spaces.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const normalized = normalizeSeedPhrase(' ABANDON abandon ART ');
42
+ * // "abandon abandon art"
43
+ *
44
+ * const normalized2 = normalizeSeedPhrase(['abandon', ' ART ', 'zoo']);
45
+ * // "abandon art zoo"
46
+ * ```
47
+ */
48
+ export declare function normalizeSeedPhrase(seedPhrase: string | string[]): string[];
49
+ /**
50
+ * Validates a mnemonic seed phrase against the BIP39 standard.
51
+ *
52
+ * Checks:
53
+ * - Correct word count (12, 15, 18, 21, or 24 words)
54
+ * - All words exist in the BIP39 wordlist
55
+ * - Valid checksum
56
+ *
57
+ * @param phrase - The mnemonic phrase to validate.
58
+ * @returns `true` if the phrase is valid, `false` otherwise.
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const isValid = await validateSeedPhrase('abandon abandon ... art');
63
+ * // true
64
+ *
65
+ * const isInvalid = await validateSeedPhrase('invalid word list ...');
66
+ * // false
67
+ * ```
68
+ */
69
+ export declare function validateSeedPhrase(words: string[]): {
70
+ isValid: boolean;
71
+ error?: string;
72
+ };
73
+ /**
74
+ * Derives a 32-byte cryptographic seed from a BIP39 mnemonic phrase using PBKDF2.
75
+ *
76
+ * This is the standard BIP39 derivation function that converts a human-readable
77
+ * mnemonic into a binary seed suitable for key generation.
78
+ *
79
+ * @param phrase - The BIP39 mnemonic phrase (will be normalized automatically).
80
+ * @param passphrase - Optional passphrase for additional security (BIP39 "25th word").
81
+ * @returns A Promise resolving to a 32-byte Uint8Array seed.
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const seed = await get32ByteSeedFromMnemonic('abandon abandon ... art');
86
+ * // Uint8Array(32) [123, 45, 67, ...]
87
+ *
88
+ * const seedWithPassphrase = await get32ByteSeedFromMnemonic(
89
+ * 'abandon abandon ... art',
90
+ * 'mySecretPassphrase'
91
+ * );
92
+ * // Different seed even with same mnemonic
93
+ * ```
94
+ */
95
+ export declare function get32ByteSeedFromMnemonic(seedPhrase: string | string[]): Promise<Uint8Array>;
96
+ //# sourceMappingURL=seed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../src/seed.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,YAAY,GAAG,GAAG,GAAG,GAAG,CAAC;AAErC;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,GAAE,YAAkB,GAAG,MAAM,EAAE,CAMzE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAG3E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAexF;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAalG"}