@majikah/majik-signature-client 0.5.0 → 0.6.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.
@@ -142,6 +142,7 @@ export declare class MajikKeyManager {
142
142
  * @param label - Optional: preserve existing label if not provided
143
143
  */
144
144
  replacePassphrase(backup: string, mnemonic: string, newPassphrase: string, expectedId: string, label?: string): Promise<MajikKey>;
145
+ updateLabel(keyId: string, newLabel: string): Promise<void>;
145
146
  /**
146
147
  * Ensure an account is unlocked, prompting for passphrase if needed.
147
148
  *
@@ -293,6 +293,17 @@ export class MajikKeyManager {
293
293
  this._cache.set(freshKey.id, freshKey);
294
294
  return freshKey;
295
295
  }
296
+ async updateLabel(keyId, newLabel) {
297
+ // 1. Fetch the existing key
298
+ const key = this.get(keyId);
299
+ if (!key) {
300
+ throw new Error(`Key with ID ${keyId} not found in keystore.`);
301
+ }
302
+ // 2. Update the label on the key instance itself
303
+ const updated = key.updateLabel(newLabel);
304
+ await this._persist(updated);
305
+ this._cache.set(updated.id, updated);
306
+ }
296
307
  // ── ensureUnlocked ────────────────────────────────────────────────────────
297
308
  /**
298
309
  * Ensure an account is unlocked, prompting for passphrase if needed.
@@ -54,6 +54,7 @@ export interface SecurityPreferences {
54
54
  export interface KeyPreferences {
55
55
  autoLockOnMinimize?: boolean;
56
56
  autoLockInterval?: number;
57
+ onetimeUnlock?: boolean;
57
58
  }
58
59
  /**
59
60
  * Pluggable persistence backend for client-level state.
@@ -160,6 +160,11 @@ export declare class MajikSignatureClient {
160
160
  lockAccount(id: string): void;
161
161
  lockAllAccounts(): void;
162
162
  verifyPassphrase(id: string, passphrase: string): Promise<boolean>;
163
+ /**
164
+ * Update the metadata (e.g., label) of an owned account.
165
+ * This updates both the contact directory and the local ownAccounts cache.
166
+ */
167
+ updateOwnAccountMeta(id: string, meta: Partial<MajikContactMeta>): Promise<void>;
163
168
  updatePassphrase(id: string, currentPassphrase: string, newPassphrase: string): Promise<void>;
164
169
  replacePassphrase(backup: string, mnemonic: string, newPassphrase: string, id: string, label?: string): Promise<MajikKey>;
165
170
  listOwnAccounts(majikahOnly?: boolean): MajikContact[];
@@ -357,6 +357,25 @@ export class MajikSignatureClient {
357
357
  async verifyPassphrase(id, passphrase) {
358
358
  return this._keys.isPassphraseValid(id, passphrase);
359
359
  }
360
+ /**
361
+ * Update the metadata (e.g., label) of an owned account.
362
+ * This updates both the contact directory and the local ownAccounts cache.
363
+ */
364
+ async updateOwnAccountMeta(id, meta) {
365
+ if (!this._ownAccounts.has(id)) {
366
+ throw new Error(`Account not found in own accounts: "${id}"`);
367
+ }
368
+ // 1. Update the contact record in the shared directory
369
+ await this._contacts.updateContactMeta(id, meta);
370
+ if (meta.label && meta.label.trim()) {
371
+ await this.keyManager.updateLabel(id, meta.label);
372
+ }
373
+ // 2. Fetch the updated contact and sync the local _ownAccounts map
374
+ const updatedContact = this._contacts.getContact(id);
375
+ if (updatedContact) {
376
+ this._ownAccounts.set(id, updatedContact);
377
+ }
378
+ }
360
379
  async updatePassphrase(id, currentPassphrase, newPassphrase) {
361
380
  try {
362
381
  await this._keys.updatePassphrase(id, currentPassphrase, newPassphrase);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@majikah/majik-signature-client",
3
3
  "type": "module",
4
4
  "description": "Majik Signature Client is a hybrid post-quantum content signing and verification library for the Majikah ecosystem. Built on top of Majik Key, it provides tamper-proof, forgery-resistant digital signatures for any content format — using a dual-algorithm architecture that combines classical Ed25519 with post-quantum ML-DSA-87 (FIPS-204).",
5
- "version": "0.5.0",
5
+ "version": "0.6.0",
6
6
  "license": "Apache-2.0",
7
7
  "author": "Zelijah",
8
8
  "main": "./dist/index.js",