@majikah/majik-key 0.6.0 → 0.7.0
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/dist/majik-key.d.ts +3 -1
- package/dist/majik-key.js +7 -15
- package/package.json +4 -4
package/dist/majik-key.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Seed phrase account library for the Majikah ecosystem.
|
|
4
4
|
*
|
|
5
5
|
*/
|
|
6
|
-
import { MajikContact, MajikContactMeta } from "@majikah/majik-contact";
|
|
6
|
+
import { MajikContact, MajikContactData, MajikContactMeta } from "@majikah/majik-contact";
|
|
7
7
|
import { KDF_VERSION } from "./core/crypto/constants";
|
|
8
8
|
import type { BitcoinRawPublicKey, ED25519RawPublicKey, MajikKeyAddress, MajikKeyDangerousJSON, MajikKeyFingerprint, MajikKeyJSON, MajikKeyMetadata, MLDSA87RawPublicKey, MLKEM768RawPublicKey, MnemonicJSON, X25519RawKey } from "./core/types";
|
|
9
9
|
import { MajikMessageIdentity } from "./core/database/system/identity";
|
|
@@ -361,6 +361,8 @@ export declare class MajikKey {
|
|
|
361
361
|
* You can pass a custom metadata type if needed, e.g., toContact<MyMeta>()
|
|
362
362
|
*/
|
|
363
363
|
toContact<TMeta extends MajikContactMeta = MajikContactMeta>(initialMeta?: Partial<TMeta>): MajikContact<TMeta>;
|
|
364
|
+
/** Build any MajikContact subclass by passing its constructor. */
|
|
365
|
+
toContact<TMeta extends MajikContactMeta, TContact extends MajikContact<TMeta>>(ContactClass: new (data: MajikContactData<TMeta>) => TContact, initialMeta?: Partial<TMeta>): TContact;
|
|
364
366
|
toKeyIdentity(): MajikKeyIdentity;
|
|
365
367
|
toSerializedIdentity(): SerializedIdentity;
|
|
366
368
|
toMajikMessageIdentity(user: MajikUser, options?: {
|
package/dist/majik-key.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { generateMnemonic as bip39GenerateMnemonic, mnemonicToSeed, validateMnemonic, } from "@scure/bip39";
|
|
7
7
|
import { aesGcmDecrypt, aesGcmEncrypt, deriveKeyFromPassphraseArgon2, deriveKeyFromMnemonicArgon2, deriveKeyFromPassphrase, generateRandomBytes, IV_LENGTH, } from "./core/crypto/crypto-provider";
|
|
8
8
|
import { EncryptionEngine } from "./core/crypto/encryption-engine";
|
|
9
|
-
import { MajikContact } from "@majikah/majik-contact";
|
|
9
|
+
import { MajikContact, } from "@majikah/majik-contact";
|
|
10
10
|
import { arrayBufferToBase64, arrayToBase64, base64ToArrayBuffer, concatUint8Arrays, utf8ToBase64, base64ToUtf8, seedStringToArray, seedArrayToString, base64ToUint8Array, } from "./core/utils";
|
|
11
11
|
import { KDF_VERSION, MAJIK_MNEMONIC_SALT } from "./core/crypto/constants";
|
|
12
12
|
import { MajikKeyValidator } from "./core/validator";
|
|
@@ -801,23 +801,15 @@ export class MajikKey {
|
|
|
801
801
|
return false;
|
|
802
802
|
}
|
|
803
803
|
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
toContact(initialMeta) {
|
|
809
|
-
const mlKeyBase64 = arrayToBase64(this.mlKemPublicKey);
|
|
810
|
-
// We construct the base metadata and merge with any provided initialMeta
|
|
811
|
-
const meta = {
|
|
812
|
-
label: this._label,
|
|
813
|
-
...initialMeta,
|
|
814
|
-
};
|
|
815
|
-
return new MajikContact({
|
|
804
|
+
toContact(arg1, arg2) {
|
|
805
|
+
const ContactClass = (typeof arg1 === "function" ? arg1 : MajikContact);
|
|
806
|
+
const initialMeta = (typeof arg1 === "function" ? arg2 : arg1);
|
|
807
|
+
return new ContactClass({
|
|
816
808
|
id: this._id,
|
|
817
809
|
publicKey: this._publicKey,
|
|
818
810
|
fingerprint: this._fingerprint,
|
|
819
|
-
meta:
|
|
820
|
-
mlKey:
|
|
811
|
+
meta: { label: this._label, ...initialMeta },
|
|
812
|
+
mlKey: arrayToBase64(this.mlKemPublicKey),
|
|
821
813
|
edPublicKeyBase64: this._edPublicKey
|
|
822
814
|
? arrayToBase64(this._edPublicKey)
|
|
823
815
|
: undefined,
|
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.
|
|
5
|
+
"version": "0.7.0",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"author": "Zelijah",
|
|
8
8
|
"main": "./dist/index.js",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"test:backup": "vitest run test/backup/majik-key-backup.test.ts"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@majikah/majik-contact": "^0.
|
|
59
|
+
"@majikah/majik-contact": "^0.1.1",
|
|
60
60
|
"@noble/curves": "^2.4.0",
|
|
61
61
|
"@noble/hashes": "^2.4.0",
|
|
62
62
|
"@noble/post-quantum": "^0.7.1",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
86
|
"@majikah/majik-bytes": ">=1.0.0",
|
|
87
|
-
"jszip": ">=3.10.2",
|
|
88
87
|
"@scure/btc-signer": ">=2.4.1",
|
|
89
|
-
"@solana/kit": ">=8.3.0"
|
|
88
|
+
"@solana/kit": ">=8.3.0",
|
|
89
|
+
"jszip": ">=3.10.2"
|
|
90
90
|
},
|
|
91
91
|
"peerDependenciesMeta": {
|
|
92
92
|
"@solana/kit": {
|