@majikah/majik-key 0.1.5 → 0.1.6

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.
@@ -1,8 +1,12 @@
1
1
  import { MajikMessageIdentityJSON } from "./database/system/identity";
2
2
  import { ISODateString } from "./types";
3
- export type SerializedMajikContact = Omit<MajikContactData, "publicKey"> & {
3
+ export type SerializedMajikContact = {
4
+ id: string;
5
+ fingerprint: string;
6
+ meta?: MajikContactMeta;
4
7
  publicKeyBase64: string;
5
8
  mlKey: string;
9
+ majikah_registered?: boolean;
6
10
  };
7
11
  export interface MajikContactMeta {
8
12
  label?: string;
@@ -46,6 +50,7 @@ export declare class MajikContact {
46
50
  raw: Uint8Array;
47
51
  }, mlKey: string, fingerprint: string, meta?: Partial<MajikContactMeta>): MajikContact;
48
52
  private assertId;
53
+ private assertMLKey;
49
54
  private assertPublicKey;
50
55
  private assertFingerprint;
51
56
  private updateTimestamp;
@@ -23,6 +23,7 @@ export class MajikContact {
23
23
  constructor(data) {
24
24
  this.assertId(data.id);
25
25
  this.assertPublicKey(data.publicKey);
26
+ this.assertMLKey(data.mlKey);
26
27
  this.assertFingerprint(data.fingerprint);
27
28
  this.id = data.id;
28
29
  this.publicKey = data.publicKey;
@@ -50,6 +51,11 @@ export class MajikContact {
50
51
  throw new MajikContactError("Contact ID must be a non-empty string");
51
52
  }
52
53
  }
54
+ assertMLKey(key) {
55
+ if (!key || typeof key !== "string") {
56
+ throw new MajikContactError("ML Key must be a non-empty string");
57
+ }
58
+ }
53
59
  assertPublicKey(key) {
54
60
  // Accept either a WebCrypto CryptoKey (with .type === 'public')
55
61
  // or a raw-key wrapper object that contains a Uint8Array `raw` field.
@@ -103,7 +103,7 @@ export declare class MajikKey {
103
103
  get isArgon2id(): boolean;
104
104
  get isLocked(): boolean;
105
105
  get isUnlocked(): boolean;
106
- get mlKemPublicKey(): Uint8Array | undefined;
106
+ get mlKemPublicKey(): Uint8Array;
107
107
  get mlKemSecretKey(): Uint8Array | undefined;
108
108
  get hasMlKem(): boolean;
109
109
  get isFullyUpgraded(): boolean;
package/dist/majik-key.js CHANGED
@@ -394,7 +394,7 @@ export class MajikKey {
394
394
  }
395
395
  }
396
396
  toContact() {
397
- const mlKeyBase64 = arrayToBase64(this._mlKemPublicKey);
397
+ const mlKeyBase64 = arrayToBase64(this.mlKemPublicKey);
398
398
  return new MajikContact({
399
399
  id: this._id,
400
400
  publicKey: this._publicKey,
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.1.5",
5
+ "version": "0.1.6",
6
6
  "license": "Apache-2.0",
7
7
  "author": "Zelijah",
8
8
  "main": "./dist/index.js",