@majikah/majik-key 0.2.9 → 0.2.10

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 CHANGED
@@ -893,7 +893,7 @@ Secure messaging platform using Majik Keys
893
893
 
894
894
  [Read more about Majik Message here](https://majikah.solutions/products/majik-message)
895
895
 
896
- [![Majik Message Thumbnail](https://github.com/user-attachments/assets/d433c6b8-1841-4fa1-a6da-b348029d1dbe)](https://message.majikah.solutions)
896
+ [![Majik Message Thumbnail](https://github.com/user-attachments/assets/6355cbd3-63e4-4a95-a370-64ba27cbb4a7)](https://message.majikah.solutions)
897
897
 
898
898
  > Click the image to try Majik Message live.
899
899
 
@@ -21,7 +21,7 @@
21
21
  * point, so ML-KEM keys can be deterministically re-derived and stored.
22
22
  * No partial migration — either fully upgraded or not upgraded yet.
23
23
  */
24
- import { MajikContact } from "@majikah/majik-contact";
24
+ import { MajikContact, MajikContactMeta } from "@majikah/majik-contact";
25
25
  import { KDF_VERSION } from "./core/crypto/constants";
26
26
  import type { MajikKeyJSON, MajikKeyMetadata, MnemonicJSON } from "./core/types";
27
27
  import { MajikMessageIdentity } from "./core/database/system/identity";
@@ -165,7 +165,11 @@ export declare class MajikKey {
165
165
  toString(pretty?: boolean): string;
166
166
  static generateMnemonic(strength?: 128 | 256, language?: MnemonicLanguage): Promise<string>;
167
167
  static validateMnemonic(mnemonic: string): boolean;
168
- toContact(): MajikContact;
168
+ /**
169
+ * Converts the MajikKey to a MajikContact.
170
+ * You can pass a custom metadata type if needed, e.g., toContact<MyMeta>()
171
+ */
172
+ toContact<TMeta extends MajikContactMeta = MajikContactMeta>(initialMeta?: Partial<TMeta>): MajikContact<TMeta>;
169
173
  toKeyIdentity(): MajikKeyIdentity;
170
174
  toSerializedIdentity(): SerializedIdentity;
171
175
  toMajikMessageIdentity(user: MajikUser, options?: {
package/dist/majik-key.js CHANGED
@@ -198,7 +198,7 @@ export class MajikKey {
198
198
  encryptedMlDsaSecretKeyBase64: arrayBufferToBase64(identity.encryptedMlDsaSecretKey),
199
199
  edSecretKey: identity.edSecretKey,
200
200
  mlDsaSecretKey: identity.mlDsaSecretKey,
201
- mnemonicLanguage: mnemonicLanguage
201
+ mnemonicLanguage: mnemonicLanguage,
202
202
  });
203
203
  }
204
204
  catch (err) {
@@ -512,13 +512,22 @@ export class MajikKey {
512
512
  return false;
513
513
  }
514
514
  }
515
- toContact() {
515
+ /**
516
+ * Converts the MajikKey to a MajikContact.
517
+ * You can pass a custom metadata type if needed, e.g., toContact<MyMeta>()
518
+ */
519
+ toContact(initialMeta) {
516
520
  const mlKeyBase64 = arrayToBase64(this.mlKemPublicKey);
521
+ // We construct the base metadata and merge with any provided initialMeta
522
+ const meta = {
523
+ label: this._label,
524
+ ...initialMeta,
525
+ };
517
526
  return new MajikContact({
518
527
  id: this._id,
519
528
  publicKey: this._publicKey,
520
529
  fingerprint: this._fingerprint,
521
- meta: { label: this._label },
530
+ meta: meta,
522
531
  mlKey: mlKeyBase64,
523
532
  edPublicKeyBase64: this._edPublicKey
524
533
  ? arrayToBase64(this._edPublicKey)
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.9",
5
+ "version": "0.2.10",
6
6
  "license": "Apache-2.0",
7
7
  "author": "Zelijah",
8
8
  "main": "./dist/index.js",
@@ -50,7 +50,7 @@
50
50
  "test:watch": "vitest"
51
51
  },
52
52
  "dependencies": {
53
- "@majikah/majik-contact": "^0.0.4",
53
+ "@majikah/majik-contact": "^0.0.6",
54
54
  "@noble/hashes": "^2.2.0",
55
55
  "@noble/post-quantum": "^0.6.1",
56
56
  "@scure/bip39": "^2.2.0",