@majikah/majik-key 0.2.0 → 0.2.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.
|
@@ -51,7 +51,8 @@ export function aesGcmEncrypt(keyBytes, iv, plaintext) {
|
|
|
51
51
|
export function aesGcmDecrypt(keyBytes, iv, ciphertext) {
|
|
52
52
|
const aes = new AES(keyBytes);
|
|
53
53
|
const gcm = new GCM(aes);
|
|
54
|
-
|
|
54
|
+
const result = gcm.open(iv, ciphertext);
|
|
55
|
+
return result ? result.slice() : null;
|
|
55
56
|
}
|
|
56
57
|
// ─── WASM-first Argon2id with @noble/hashes fallback ─────────────────────────
|
|
57
58
|
/**
|
|
@@ -132,7 +133,8 @@ async function _argon2id(input, salt, params) {
|
|
|
132
133
|
*/
|
|
133
134
|
export async function deriveKeyFromPassphraseArgon2(passphrase, salt) {
|
|
134
135
|
const pw = new TextEncoder().encode(passphrase);
|
|
135
|
-
|
|
136
|
+
const result = await _argon2id(pw, salt, ARGON2_PARAMS.PASSPHRASE);
|
|
137
|
+
return result.slice(); // ← force a copy out of WASM memory
|
|
136
138
|
}
|
|
137
139
|
/**
|
|
138
140
|
* Derive a 32-byte AES key from a BIP-39 mnemonic using Argon2id.
|
|
@@ -144,7 +146,8 @@ export async function deriveKeyFromPassphraseArgon2(passphrase, salt) {
|
|
|
144
146
|
*/
|
|
145
147
|
export async function deriveKeyFromMnemonicArgon2(mnemonic, salt) {
|
|
146
148
|
const m = new TextEncoder().encode(mnemonic);
|
|
147
|
-
|
|
149
|
+
const result = await _argon2id(m, salt, ARGON2_PARAMS.MNEMONIC);
|
|
150
|
+
return result.slice(); // ← force a copy out of WASM memory
|
|
148
151
|
}
|
|
149
152
|
// ─── KDF v1: PBKDF2-SHA256 (legacy — do not use for new operations) ───────────
|
|
150
153
|
/**
|
|
@@ -7,6 +7,8 @@ export type SerializedMajikContact = {
|
|
|
7
7
|
publicKeyBase64: string;
|
|
8
8
|
mlKey: string;
|
|
9
9
|
majikah_registered?: boolean;
|
|
10
|
+
edPublicKeyBase64?: string;
|
|
11
|
+
mlDsaPublicKeyBase64?: string;
|
|
10
12
|
};
|
|
11
13
|
export interface MajikContactMeta {
|
|
12
14
|
label?: string;
|
|
@@ -24,6 +26,8 @@ export interface MajikContactData {
|
|
|
24
26
|
mlKey: string;
|
|
25
27
|
meta?: MajikContactMeta;
|
|
26
28
|
majikah_registered?: boolean;
|
|
29
|
+
edPublicKeyBase64?: string;
|
|
30
|
+
mlDsaPublicKeyBase64?: string;
|
|
27
31
|
}
|
|
28
32
|
export interface MajikContactCard {
|
|
29
33
|
id: string;
|
|
@@ -31,6 +35,8 @@ export interface MajikContactCard {
|
|
|
31
35
|
fingerprint: string;
|
|
32
36
|
label: string;
|
|
33
37
|
mlKey: string;
|
|
38
|
+
edPublicKeyBase64?: string;
|
|
39
|
+
mlDsaPublicKeyBase64?: string;
|
|
34
40
|
}
|
|
35
41
|
export declare class MajikContactError extends Error {
|
|
36
42
|
cause?: unknown;
|
|
@@ -43,6 +49,8 @@ export declare class MajikContact {
|
|
|
43
49
|
};
|
|
44
50
|
readonly fingerprint: string;
|
|
45
51
|
readonly mlKey: string;
|
|
52
|
+
readonly edPublicKeyBase64: string;
|
|
53
|
+
readonly mlDsaPublicKeyBase64: string;
|
|
46
54
|
meta: MajikContactMeta;
|
|
47
55
|
private majikah_registered?;
|
|
48
56
|
constructor(data: MajikContactData);
|
|
@@ -18,6 +18,8 @@ export class MajikContact {
|
|
|
18
18
|
publicKey;
|
|
19
19
|
fingerprint;
|
|
20
20
|
mlKey;
|
|
21
|
+
edPublicKeyBase64;
|
|
22
|
+
mlDsaPublicKeyBase64;
|
|
21
23
|
meta;
|
|
22
24
|
majikah_registered;
|
|
23
25
|
constructor(data) {
|
|
@@ -29,6 +31,8 @@ export class MajikContact {
|
|
|
29
31
|
this.publicKey = data.publicKey;
|
|
30
32
|
this.fingerprint = data.fingerprint;
|
|
31
33
|
this.mlKey = data.mlKey;
|
|
34
|
+
this.edPublicKeyBase64 = data.edPublicKeyBase64 || "";
|
|
35
|
+
this.mlDsaPublicKeyBase64 = data.mlDsaPublicKeyBase64 || "";
|
|
32
36
|
this.meta = {
|
|
33
37
|
label: data.meta?.label || "",
|
|
34
38
|
notes: data.meta?.notes || "",
|
|
@@ -152,6 +156,8 @@ export class MajikContact {
|
|
|
152
156
|
publicKeyBase64: await this.getPublicKeyBase64(),
|
|
153
157
|
majikah_registered: this.majikah_registered,
|
|
154
158
|
mlKey: this.mlKey,
|
|
159
|
+
edPublicKeyBase64: this.edPublicKeyBase64,
|
|
160
|
+
mlDsaPublicKeyBase64: this.mlDsaPublicKeyBase64,
|
|
155
161
|
};
|
|
156
162
|
}
|
|
157
163
|
/**
|
|
@@ -167,6 +173,8 @@ export class MajikContact {
|
|
|
167
173
|
publicKey: { raw: publicKeyRaw },
|
|
168
174
|
majikah_registered: serialized.majikah_registered,
|
|
169
175
|
mlKey: serialized.mlKey,
|
|
176
|
+
edPublicKeyBase64: serialized.edPublicKeyBase64,
|
|
177
|
+
mlDsaPublicKeyBase64: serialized.mlDsaPublicKeyBase64,
|
|
170
178
|
});
|
|
171
179
|
}
|
|
172
180
|
catch (err) {
|
package/dist/majik-key.js
CHANGED
|
@@ -499,6 +499,12 @@ export class MajikKey {
|
|
|
499
499
|
fingerprint: this._fingerprint,
|
|
500
500
|
meta: { label: this._label },
|
|
501
501
|
mlKey: mlKeyBase64,
|
|
502
|
+
edPublicKeyBase64: this._edPublicKey
|
|
503
|
+
? arrayToBase64(this._edPublicKey)
|
|
504
|
+
: undefined,
|
|
505
|
+
mlDsaPublicKeyBase64: this._mlDsaPublicKey
|
|
506
|
+
? arrayToBase64(this._mlDsaPublicKey)
|
|
507
|
+
: undefined,
|
|
502
508
|
});
|
|
503
509
|
}
|
|
504
510
|
toKeyIdentity() {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@majikah/majik-key",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "A post-quantum ready seed phrase account library for the Majikah ecosystem. Manages deterministic X25519 and ML-KEM-768 identities with Argon2id protection and seamless legacy account migration.",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.2",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "Zelijah",
|
|
8
8
|
"main": "./dist/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@stablelib/pbkdf2": "^2.0.1",
|
|
57
57
|
"@stablelib/sha256": "^2.0.1",
|
|
58
58
|
"@stablelib/x25519": "^2.0.1",
|
|
59
|
-
"@thezelijah/majik-user": "^1.0.
|
|
59
|
+
"@thezelijah/majik-user": "^1.0.6",
|
|
60
60
|
"ed2curve": "^0.3.0",
|
|
61
61
|
"hash-wasm": "^4.12.0"
|
|
62
62
|
},
|