@majikah/majik-universal-id-client 0.0.5 → 0.0.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.
@@ -11,6 +11,7 @@ import { MAJIK_API_RESPONSE } from "./core/types";
11
11
  import { ImageSignatureStub, ImageSignOptions, ImageVerificationResult } from "@majikah/majik-signature/dist/core/stamp";
12
12
  import { CreateUniversalIDOptions, MajikUniversalID } from "@majikah/majik-universal-id";
13
13
  import { MajikUser } from "@thezelijah/majik-user";
14
+ import { MajikSLink } from "@majikah/majik-slink";
14
15
  type MajikUniversalIdClientEvents = "create-id" | "sign" | "verify" | "unlock" | "lock" | "new-account" | "new-contact" | "removed-account" | "removed-contact" | "active-account-change" | "error";
15
16
  interface MajikUniversalIdClientStatic<T extends MajikUniversalIdClient> {
16
17
  new (config: MajikUniversalIdClientConfig, id?: string): T;
@@ -608,6 +609,11 @@ export declare class MajikUniversalIdClient {
608
609
  getFileSignatureInfo(file: Blob, options?: {
609
610
  mimeType?: string;
610
611
  }): Promise<MajikSignature[] | null>;
612
+ signURL(url: string, verified?: boolean): Promise<MajikSLink>;
613
+ verifySLink(slink: MajikSLink): Promise<VerificationResult & {
614
+ handler?: string;
615
+ reason?: string;
616
+ }>;
611
617
  /**
612
618
  * Sign an image with dual-layer embedding.
613
619
  *
@@ -13,6 +13,7 @@ import { clearAllBlobs, idbLoadBlob, idbSaveBlob, } from "./core/utils/idb-majik
13
13
  import { autoSaveMajikFileData, loadSavedMajikFileData, } from "./core/utils/majik-file-utils";
14
14
  import { gunzipSync, gzipSync } from "fflate";
15
15
  import { MajikUniversalID, } from "@majikah/majik-universal-id";
16
+ import { MajikSLink } from "@majikah/majik-slink";
16
17
  // ─── MajikUniversalIdClient ─────────────────────────────────────────────────────
17
18
  export class MajikUniversalIdClient {
18
19
  userProfile = "default";
@@ -1220,6 +1221,51 @@ export class MajikUniversalIdClient {
1220
1221
  throw err;
1221
1222
  }
1222
1223
  }
1224
+ // ── Majik SLink ───────────────────────────
1225
+ async signURL(url, verified = false) {
1226
+ const id = this.getActiveAccount()?.id;
1227
+ if (!id)
1228
+ throw new Error("No active account — call setActiveAccount() first");
1229
+ if (!this.user)
1230
+ throw new Error("Login required - A valid Majikah account is required");
1231
+ try {
1232
+ await MajikKeyStore.ensureUnlocked(id);
1233
+ const key = MajikKeyStore.get(id);
1234
+ if (!key)
1235
+ throw new Error(`Account not found in keystore: "${id}"`);
1236
+ if (!key.hasSigningKeys) {
1237
+ throw new Error(`Account "${id}" has no signing keys. ` +
1238
+ `Re-import via importAccountFromMnemonicBackup() to enable signing.`);
1239
+ }
1240
+ return await MajikSLink.create(url, key, this.user.id, {
1241
+ status: verified ? "verified" : undefined,
1242
+ });
1243
+ }
1244
+ catch (err) {
1245
+ this._emit("error", err, { context: "signURL" });
1246
+ throw err;
1247
+ }
1248
+ }
1249
+ async verifySLink(slink) {
1250
+ try {
1251
+ const id = this.getActiveAccount()?.id;
1252
+ if (!id)
1253
+ throw new Error("No active account — call setActiveAccount() first");
1254
+ await MajikKeyStore.ensureUnlocked(id);
1255
+ const key = MajikKeyStore.get(id);
1256
+ if (!key)
1257
+ throw new Error(`Account not found in keystore: "${id}"`);
1258
+ const publicKeys = await this._resolveSignerPublicKeys({
1259
+ key: key,
1260
+ });
1261
+ const results = slink.verify(publicKeys ?? undefined);
1262
+ return results;
1263
+ }
1264
+ catch (err) {
1265
+ this._emit("error", err, { context: "verifySLink" });
1266
+ throw err;
1267
+ }
1268
+ }
1223
1269
  // ── STAMP (compression-resistant image signing) ───────────────────────────
1224
1270
  //
1225
1271
  // These methods delegate to MajikImageSignature, passing `MajikSignature`
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@majikah/majik-universal-id-client",
3
3
  "type": "module",
4
4
  "description": "The core universal identity model for the Majikah ecosystem, featuring hybrid PQC signatures (Ed25519 + ML-DSA), ML-KEM-768 private info encryption, and multi-stage Didit verification graduation.",
5
- "version": "0.0.5",
5
+ "version": "0.0.6",
6
6
  "license": "Apache-2.0",
7
7
  "author": "Zelijah",
8
8
  "main": "./dist/index.js",
@@ -46,6 +46,8 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@majikah/majik-key": "^0.2.3",
49
+ "@majikah/majik-signature": "^0.0.15",
50
+ "@majikah/majik-slink": "^0.0.1",
49
51
  "@majikah/majik-universal-id": "^0.0.8",
50
52
  "idb": "^8.0.3"
51
53
  },