ns-auth-sdk 1.14.2 → 1.14.3

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.
@@ -4,7 +4,6 @@ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).export
4
4
  //#endregion
5
5
  const require_prf_handler = require('./prf-handler-BNd7gmXJ.cjs');
6
6
  const require_group_coordination = require('./group-coordination-DL39hJ3R.cjs');
7
- const require_zkm_service = require('./zkm.service-DX06sSfB.cjs');
8
7
  let applesauce_core_helpers = require("applesauce-core/helpers");
9
8
  let _noble_curves_secp256k1_js = require("@noble/curves/secp256k1.js");
10
9
  let _noble_hashes_sha2_js = require("@noble/hashes/sha2.js");
@@ -214,7 +213,7 @@ async function checkPRFSupport() {
214
213
  }
215
214
  }
216
215
  async function generatePasswordProtectedKey(password) {
217
- const privateKey = _noble_curves_secp256k1_js.secp256k1.utils.randomPrivateKey();
216
+ const privateKey = _noble_curves_secp256k1_js.secp256k1.utils.randomSecretKey();
218
217
  const publicKeySpkiBase64 = toBase64(_noble_curves_secp256k1_js.secp256k1.getPublicKey(privateKey));
219
218
  const salt = (0, _noble_hashes_utils_js.randomBytes)(16);
220
219
  const derivedKey = (0, _noble_hashes_pbkdf2_js.pbkdf2)(_noble_hashes_sha2_js.sha256, new TextEncoder().encode(password), salt, {
@@ -260,11 +259,11 @@ let createAndConnectNodeFn = null;
260
259
  let cleanupBifrostNodeFn = null;
261
260
  let extractPeersFromCredentialsFn = null;
262
261
  let checkPeerStatusFn = null;
263
- let loadPromise$2 = null;
262
+ let loadPromise$1 = null;
264
263
  async function loadFrostrModules() {
265
264
  if (IglooCoreClass) return;
266
- if (loadPromise$2) return loadPromise$2;
267
- loadPromise$2 = (async () => {
265
+ if (loadPromise$1) return loadPromise$1;
266
+ loadPromise$1 = (async () => {
268
267
  try {
269
268
  const [iglooCore] = await Promise.all([import("@frostr/igloo-core"), import("@frostr/bifrost")]);
270
269
  IglooCoreClass = iglooCore.IglooCore;
@@ -276,7 +275,7 @@ async function loadFrostrModules() {
276
275
  throw new Error("FROSTR multisig requires @frostr/bifrost and @frostr/igloo-core as peer dependencies. Install them with: npm install @frostr/bifrost @frostr/igloo-core");
277
276
  }
278
277
  })();
279
- return loadPromise$2;
278
+ return loadPromise$1;
280
279
  }
281
280
  var MultisigManager = class {
282
281
  #relays;
@@ -10245,11 +10244,11 @@ let InviteReaderClass = null;
10245
10244
  let deserializeApplicationRumorFn = null;
10246
10245
  let KEY_PACKAGE_KIND = 443;
10247
10246
  let GIFT_WRAP_KIND = 1059;
10248
- let loadPromise$1 = null;
10247
+ let loadPromise = null;
10249
10248
  async function loadMarmotModules() {
10250
10249
  if (MarmotClientClass) return;
10251
- if (loadPromise$1) return loadPromise$1;
10252
- loadPromise$1 = (async () => {
10250
+ if (loadPromise) return loadPromise;
10251
+ loadPromise = (async () => {
10253
10252
  try {
10254
10253
  const marmot = await import("@internet-privacy/marmot-ts");
10255
10254
  MarmotClientClass = marmot.MarmotClient;
@@ -10261,7 +10260,7 @@ async function loadMarmotModules() {
10261
10260
  throw new Error("Group messaging requires @internet-privacy/marmot-ts as a peer dependency. Install it with: npm install @internet-privacy/marmot-ts");
10262
10261
  }
10263
10262
  })();
10264
- return loadPromise$1;
10263
+ return loadPromise;
10265
10264
  }
10266
10265
  var GroupManager = class {
10267
10266
  #client = null;
@@ -10666,14 +10665,6 @@ var GroupManager = class {
10666
10665
 
10667
10666
  //#endregion
10668
10667
  //#region src/types/vlei.ts
10669
- /**
10670
- * vLEI Root of Trust Types
10671
- * @packageDocumentation
10672
- */
10673
- const VLEI_SCHEMAS = {
10674
- legalEntity: "E46jrVPTzlSkUPqGGeIZ8a8FWS7a6s4reAXRZOkogZ2A",
10675
- officialRole: "EDg-Ji3kmi_G97Jctxeajpmp1-A8gSpeyElm-XCzTxiE"
10676
- };
10677
10668
  function parseVLEITag(tag) {
10678
10669
  if (tag[0] !== "vlei" || tag.length < 8) return null;
10679
10670
  return {
@@ -11258,7 +11249,7 @@ async function generateSiopIdToken(config) {
11258
11249
  };
11259
11250
  const signingInput = `${base64urlEncode$1(new TextEncoder().encode(JSON.stringify(header)))}.${base64urlEncode$1(new TextEncoder().encode(JSON.stringify(payload)))}`;
11260
11251
  const messageHash = (0, _noble_hashes_sha2_js.sha256)(new TextEncoder().encode(signingInput));
11261
- return `${signingInput}.${base64urlEncode$1(_noble_curves_secp256k1_js.secp256k1.sign(messageHash, secretKey).toCompactRawBytes())}`;
11252
+ return `${signingInput}.${base64urlEncode$1(_noble_curves_secp256k1_js.secp256k1.sign(messageHash, secretKey).toBytes())}`;
11262
11253
  }
11263
11254
  /**
11264
11255
  * Verify a SIOP v2 Self-Issued ID Token
@@ -12087,7 +12078,7 @@ var AuthService = class {
12087
12078
  console.error("No key info available for ZK membership");
12088
12079
  return;
12089
12080
  }
12090
- const _zkmService = new (await (Promise.resolve().then(() => require("./zkm.service-D2BZ_aqA.cjs")))).ZKMService();
12081
+ const _zkmService = new (await (Promise.resolve().then(() => require("./zkm.service-B1MBvBEu.cjs")))).ZKMService();
12091
12082
  await _zkmService.generateIdentity();
12092
12083
  const _group = await _zkmService.createGroup(`group-${Date.now()}`);
12093
12084
  const proof = await _zkmService.generateProof();
@@ -13335,614 +13326,6 @@ function isEUDIAvailable() {
13335
13326
  return Promise.resolve(true);
13336
13327
  }
13337
13328
 
13338
- //#endregion
13339
- //#region src/services/zkp.service.ts
13340
- let ZKPPackage = null;
13341
- async function loadZKPassport() {
13342
- if (!ZKPPackage) ZKPPackage = await import("@zkpassport/sdk");
13343
- return ZKPPackage;
13344
- }
13345
- var ZKPService = class {
13346
- #config = null;
13347
- #connected = false;
13348
- #zkPassport = null;
13349
- #currentSession = null;
13350
- async connect(config) {
13351
- if (this.#connected && this.#config?.appId === config.appId) return;
13352
- this.#zkPassport = new (await (loadZKPassport())).ZKPassport(window.location.hostname);
13353
- this.#config = config;
13354
- this.#connected = true;
13355
- }
13356
- async disconnect() {
13357
- this.#config = null;
13358
- this.#connected = false;
13359
- this.#zkPassport = null;
13360
- this.#currentSession = null;
13361
- }
13362
- isConnected() {
13363
- return this.#connected && this.#zkPassport !== null;
13364
- }
13365
- getConfig() {
13366
- return this.#config;
13367
- }
13368
- async verifyZKP(options = {}) {
13369
- if (!this.#zkPassport) throw new Error("Not connected to ZKP verifier. Call connect() first.");
13370
- return new Promise((resolve, reject) => {
13371
- const requestOptions = {
13372
- name: options.name || "ZKPassport Verification",
13373
- logo: options.logo || "https://zkpassport.id/favicon.png",
13374
- purpose: options.purpose || "Proof of identity",
13375
- scope: options.scope || "eu-adult",
13376
- mode: options.mode || "fast",
13377
- devMode: options.devMode ?? true
13378
- };
13379
- const query = this.#zkPassport.request(requestOptions).in("nationality", [...getAllCountryCodes(), "Zero Knowledge Republic"]).disclose("firstname").gte("age", 18).disclose("document_type").facematch("strict").sanctions().gte("age", 18).done();
13380
- const { url } = query;
13381
- this.#currentSession = {
13382
- queryUrl: url,
13383
- resolve,
13384
- reject
13385
- };
13386
- query.onRequestReceived(() => {
13387
- console.log("ZKPassport: Request received");
13388
- }).onGeneratingProof(() => {
13389
- console.log("ZKPassport: Generating proof");
13390
- }).onProofGenerated((result) => {
13391
- console.log("ZKPassport: Proof generated", result);
13392
- }).onResult(async (result) => {
13393
- console.log("ZKPassport: Result", result);
13394
- const verified = result.verified;
13395
- const uniqueIdentifier = result.uniqueIdentifier;
13396
- const data = result.result;
13397
- const proofSaid = result.proofId || result.proofSaid || uniqueIdentifier;
13398
- const expiresAt = result.expiresAt ? new Date(result.expiresAt).toISOString() : void 0;
13399
- if (!verified || !uniqueIdentifier) {
13400
- this.#currentSession?.reject(/* @__PURE__ */ new Error("ZKPassport verification failed"));
13401
- this.#currentSession = null;
13402
- return;
13403
- }
13404
- const claims = {
13405
- uniqueIdentifier,
13406
- proofSaid,
13407
- firstName: data?.firstname?.disclose?.result,
13408
- nationality: data?.nationality?.in?.result,
13409
- isOver18: data?.age?.gte?.result,
13410
- isEUCitizen: data?.nationality?.in?.result !== void 0,
13411
- documentType: data?.document_type?.disclose?.result,
13412
- verifiedAt: (/* @__PURE__ */ new Date()).toISOString(),
13413
- expiresAt
13414
- };
13415
- this.#currentSession?.resolve(claims);
13416
- this.#currentSession = null;
13417
- }).onReject(() => {
13418
- this.#currentSession?.reject(/* @__PURE__ */ new Error("User rejected ZKPassport request"));
13419
- this.#currentSession = null;
13420
- }).onError((error) => {
13421
- this.#currentSession?.reject(error);
13422
- this.#currentSession = null;
13423
- });
13424
- });
13425
- }
13426
- getCurrentQueryUrl() {
13427
- return this.#currentSession?.queryUrl || null;
13428
- }
13429
- cancelVerification() {
13430
- if (this.#currentSession) {
13431
- this.#currentSession.reject(/* @__PURE__ */ new Error("Verification cancelled"));
13432
- this.#currentSession = null;
13433
- }
13434
- }
13435
- };
13436
- function getAllCountryCodes() {
13437
- return [
13438
- "AD",
13439
- "AE",
13440
- "AF",
13441
- "AG",
13442
- "AI",
13443
- "AL",
13444
- "AM",
13445
- "AO",
13446
- "AQ",
13447
- "AR",
13448
- "AS",
13449
- "AT",
13450
- "AU",
13451
- "AW",
13452
- "AX",
13453
- "AZ",
13454
- "BA",
13455
- "BB",
13456
- "BD",
13457
- "BE",
13458
- "BF",
13459
- "BG",
13460
- "BH",
13461
- "BI",
13462
- "BJ",
13463
- "BL",
13464
- "BM",
13465
- "BN",
13466
- "BO",
13467
- "BQ",
13468
- "BR",
13469
- "BS",
13470
- "BT",
13471
- "BV",
13472
- "BW",
13473
- "BY",
13474
- "BZ",
13475
- "CA",
13476
- "CC",
13477
- "CD",
13478
- "CF",
13479
- "CG",
13480
- "CH",
13481
- "CI",
13482
- "CK",
13483
- "CL",
13484
- "CM",
13485
- "CN",
13486
- "CO",
13487
- "CR",
13488
- "CU",
13489
- "CV",
13490
- "CW",
13491
- "CX",
13492
- "CY",
13493
- "CZ",
13494
- "DE",
13495
- "DJ",
13496
- "DK",
13497
- "DM",
13498
- "DO",
13499
- "DZ",
13500
- "EC",
13501
- "EE",
13502
- "EG",
13503
- "EH",
13504
- "ER",
13505
- "ES",
13506
- "ET",
13507
- "FI",
13508
- "FJ",
13509
- "FK",
13510
- "FM",
13511
- "FO",
13512
- "FR",
13513
- "GA",
13514
- "GB",
13515
- "GD",
13516
- "GE",
13517
- "GF",
13518
- "GG",
13519
- "GH",
13520
- "GI",
13521
- "GL",
13522
- "GM",
13523
- "GN",
13524
- "GP",
13525
- "GQ",
13526
- "GR",
13527
- "GS",
13528
- "GT",
13529
- "GU",
13530
- "GW",
13531
- "GY",
13532
- "HK",
13533
- "HM",
13534
- "HN",
13535
- "HR",
13536
- "HT",
13537
- "HU",
13538
- "ID",
13539
- "IE",
13540
- "IL",
13541
- "IM",
13542
- "IN",
13543
- "IO",
13544
- "IQ",
13545
- "IR",
13546
- "IS",
13547
- "IT",
13548
- "JE",
13549
- "JM",
13550
- "JO",
13551
- "JP",
13552
- "KE",
13553
- "KG",
13554
- "KH",
13555
- "KI",
13556
- "KM",
13557
- "KN",
13558
- "KP",
13559
- "KR",
13560
- "KW",
13561
- "KY",
13562
- "KZ",
13563
- "LA",
13564
- "LB",
13565
- "LC",
13566
- "LI",
13567
- "LK",
13568
- "LR",
13569
- "LS",
13570
- "LT",
13571
- "LU",
13572
- "LV",
13573
- "LY",
13574
- "MA",
13575
- "MC",
13576
- "MD",
13577
- "ME",
13578
- "MF",
13579
- "MG",
13580
- "MH",
13581
- "MK",
13582
- "ML",
13583
- "MM",
13584
- "MN",
13585
- "MO",
13586
- "MP",
13587
- "MQ",
13588
- "MR",
13589
- "MS",
13590
- "MT",
13591
- "MU",
13592
- "MV",
13593
- "MW",
13594
- "MX",
13595
- "MY",
13596
- "MZ",
13597
- "NA",
13598
- "NC",
13599
- "NE",
13600
- "NF",
13601
- "NG",
13602
- "NI",
13603
- "NL",
13604
- "NO",
13605
- "NP",
13606
- "NR",
13607
- "NU",
13608
- "NZ",
13609
- "OM",
13610
- "PA",
13611
- "PE",
13612
- "PF",
13613
- "PG",
13614
- "PH",
13615
- "PK",
13616
- "PL",
13617
- "PM",
13618
- "PN",
13619
- "PR",
13620
- "PS",
13621
- "PT",
13622
- "PW",
13623
- "PY",
13624
- "QA",
13625
- "RE",
13626
- "RO",
13627
- "RS",
13628
- "RU",
13629
- "RW",
13630
- "SA",
13631
- "SB",
13632
- "SC",
13633
- "SD",
13634
- "SE",
13635
- "SG",
13636
- "SH",
13637
- "SI",
13638
- "SJ",
13639
- "SK",
13640
- "SL",
13641
- "SM",
13642
- "SN",
13643
- "SO",
13644
- "SR",
13645
- "SS",
13646
- "ST",
13647
- "SV",
13648
- "SX",
13649
- "SY",
13650
- "SZ",
13651
- "TC",
13652
- "TD",
13653
- "TF",
13654
- "TG",
13655
- "TH",
13656
- "TJ",
13657
- "TK",
13658
- "TL",
13659
- "TM",
13660
- "TN",
13661
- "TO",
13662
- "TR",
13663
- "TT",
13664
- "TV",
13665
- "TW",
13666
- "TZ",
13667
- "UA",
13668
- "UG",
13669
- "UM",
13670
- "US",
13671
- "UY",
13672
- "UZ",
13673
- "VA",
13674
- "VC",
13675
- "VE",
13676
- "VG",
13677
- "VI",
13678
- "VN",
13679
- "VU",
13680
- "WF",
13681
- "WS",
13682
- "YE",
13683
- "YT",
13684
- "ZA",
13685
- "ZM",
13686
- "ZW"
13687
- ];
13688
- }
13689
- function isZKPAvailable() {
13690
- return import("@zkpassport/sdk").then(() => true).catch(() => false);
13691
- }
13692
-
13693
- //#endregion
13694
- //#region src/services/individual-trust.service.ts
13695
- var IndividualTrustService = class {
13696
- #eudiService;
13697
- #zkpService;
13698
- constructor() {
13699
- this.#eudiService = new EUDIService();
13700
- this.#zkpService = new ZKPService();
13701
- }
13702
- get eudi() {
13703
- return this.#eudiService;
13704
- }
13705
- get zkp() {
13706
- return this.#zkpService;
13707
- }
13708
- async connectEUDI(config) {
13709
- await this.#eudiService.connect(config);
13710
- }
13711
- async connectZKP(config) {
13712
- await this.#zkpService.connect(config);
13713
- }
13714
- async disconnect() {
13715
- await this.#eudiService.disconnect();
13716
- await this.#zkpService.disconnect();
13717
- }
13718
- isConnected() {
13719
- return this.#eudiService.isConnected() || this.#zkpService.isConnected();
13720
- }
13721
- async verifyEUDI() {
13722
- return this.#eudiService.verifyEUDI();
13723
- }
13724
- async verifyZKP(options) {
13725
- return this.#zkpService.verifyZKP(options);
13726
- }
13727
- getVerificationStatus() {
13728
- return {
13729
- eudi: this.#eudiService.isConnected(),
13730
- zkp: this.#zkpService.isConnected()
13731
- };
13732
- }
13733
- };
13734
-
13735
- //#endregion
13736
- //#region src/services/keria.service.ts
13737
- let SignifyClientClass = null;
13738
- let loadPromise = null;
13739
- async function loadSignify() {
13740
- if (loadPromise) return loadPromise;
13741
- loadPromise = import("@global-vlei/signify-ts");
13742
- const signify = await loadPromise;
13743
- SignifyClientClass = signify.SignifyClient;
13744
- return signify;
13745
- }
13746
- var KERIAService = class {
13747
- #client = null;
13748
- #aidName = null;
13749
- #aidPrefix = null;
13750
- #url = null;
13751
- #connected = false;
13752
- #cachedCredentials = null;
13753
- async connect(url, bran) {
13754
- if (this.#connected && this.#url === url) return {
13755
- url: this.#url,
13756
- aidName: this.#aidName,
13757
- aidPrefix: this.#aidPrefix
13758
- };
13759
- const { ready, Tier } = await loadSignify();
13760
- await ready();
13761
- const bootUrl = url.replace(/:\d+$/, ":3903");
13762
- const client = new SignifyClientClass(url, bran, Tier.low, bootUrl);
13763
- try {
13764
- await client.connect();
13765
- } catch (e) {
13766
- const error = e;
13767
- if (error.message?.includes("404") || error.message?.includes("boot")) try {
13768
- await client.boot();
13769
- await client.approveDelegation();
13770
- await client.connect();
13771
- } catch (bootError) {
13772
- throw new Error(`Failed to boot KERIA agent: ${bootError.message}`);
13773
- }
13774
- else throw new Error(`Failed to connect to KERIA: ${error.message}`);
13775
- }
13776
- const identifiers = await client.identifiers().list();
13777
- if (!identifiers || identifiers.length === 0) throw new Error("No identifiers found in KERIA agent. Create an AID first.");
13778
- const aid = identifiers[0];
13779
- this.#client = client;
13780
- this.#aidName = aid.name;
13781
- this.#aidPrefix = aid.prefix;
13782
- this.#url = url;
13783
- this.#connected = true;
13784
- this.#cachedCredentials = null;
13785
- return {
13786
- url,
13787
- aidName: aid.name,
13788
- aidPrefix: aid.prefix
13789
- };
13790
- }
13791
- async disconnect() {
13792
- this.#client = null;
13793
- this.#aidName = null;
13794
- this.#aidPrefix = null;
13795
- this.#url = null;
13796
- this.#connected = false;
13797
- this.#cachedCredentials = null;
13798
- }
13799
- isConnected() {
13800
- return this.#connected && this.#client !== null;
13801
- }
13802
- getConnection() {
13803
- if (!this.#connected || !this.#aidName || !this.#aidPrefix || !this.#url) return null;
13804
- return {
13805
- url: this.#url,
13806
- aidName: this.#aidName,
13807
- aidPrefix: this.#aidPrefix
13808
- };
13809
- }
13810
- async fetchCredentials() {
13811
- if (!this.#client) throw new Error("Not connected to KERIA");
13812
- if (this.#cachedCredentials) return this.#cachedCredentials;
13813
- this.#cachedCredentials = (await this.#client.credentials().list({ limit: 100 })).map((c) => {
13814
- const cred = c;
13815
- return {
13816
- said: cred.sad?.d || cred.said || "",
13817
- schema: cred.sad?.s || cred.schema || "",
13818
- issuer: cred.sad?.i || "",
13819
- subject: cred.sad?.a || cred.attributes || {},
13820
- issuanceDate: cred.sad?.a?.dt || "",
13821
- raw: c
13822
- };
13823
- });
13824
- return this.#cachedCredentials;
13825
- }
13826
- async findVLEICredentials() {
13827
- const creds = await this.fetchCredentials();
13828
- const entityCred = creds.find((c) => c.schema === VLEI_SCHEMAS.legalEntity);
13829
- const roleCred = creds.find((c) => c.schema === VLEI_SCHEMAS.officialRole);
13830
- if (!entityCred || !roleCred) return null;
13831
- return {
13832
- entity: entityCred,
13833
- role: roleCred
13834
- };
13835
- }
13836
- async verifyCredentials() {
13837
- const vlei = await this.findVLEICredentials();
13838
- if (!vlei) throw new Error("No vLEI credentials found");
13839
- const roleSubject = vlei.role.subject;
13840
- const entitySubject = vlei.entity.subject;
13841
- const now = (/* @__PURE__ */ new Date()).toISOString();
13842
- const expiresAt = roleSubject["e"];
13843
- const expiresAtISO = expiresAt ? (/* @__PURE__ */ new Date(expiresAt * 1e3)).toISOString() : void 0;
13844
- if (expiresAt && expiresAt < Math.floor(Date.now() / 1e3)) throw new Error("vLEI credentials have expired");
13845
- return {
13846
- aidPrefix: this.#aidPrefix,
13847
- lei: entitySubject["lei"] || "",
13848
- legalName: entitySubject["legalName"] || "",
13849
- role: roleSubject["role"] || "",
13850
- roleCredentialSaid: vlei.role.said,
13851
- entityCredentialSaid: vlei.entity.said,
13852
- verifiedAt: now,
13853
- expiresAt: expiresAtISO
13854
- };
13855
- }
13856
- async signChallenge(challenge) {
13857
- if (!this.#client || !this.#aidName) throw new Error("Not connected to KERIA");
13858
- const hab = await this.#client.identifiers().get(this.#aidName);
13859
- const keeper = this.#client.manager.get(hab);
13860
- const challengeBytes = new TextEncoder().encode(challenge);
13861
- return {
13862
- signature: (await keeper.sign(challengeBytes))[0],
13863
- signer: this.#aidPrefix
13864
- };
13865
- }
13866
- getCachedCredentials() {
13867
- return this.#cachedCredentials ?? [];
13868
- }
13869
- clearCache() {
13870
- this.#cachedCredentials = null;
13871
- }
13872
- };
13873
- function isKERIAAvailable() {
13874
- return import("@global-vlei/signify-ts").then(() => true).catch(() => false);
13875
- }
13876
-
13877
- //#endregion
13878
- //#region src/services/organization-trust.service.ts
13879
- var OrganizationTrustService = class {
13880
- #keriaService;
13881
- #eudiService;
13882
- constructor() {
13883
- this.#keriaService = new KERIAService();
13884
- this.#eudiService = new EUDIService();
13885
- }
13886
- get keria() {
13887
- return this.#keriaService;
13888
- }
13889
- get eudi() {
13890
- return this.#eudiService;
13891
- }
13892
- async connectKERIA(url, bran) {
13893
- return this.#keriaService.connect(url, bran);
13894
- }
13895
- async connectEUDI(config) {
13896
- await this.#eudiService.connect(config);
13897
- }
13898
- async disconnect() {
13899
- await this.#keriaService.disconnect();
13900
- await this.#eudiService.disconnect();
13901
- }
13902
- isConnected() {
13903
- return this.#keriaService.isConnected() || this.#eudiService.isConnected();
13904
- }
13905
- async verifyVLEI() {
13906
- return this.#keriaService.verifyCredentials();
13907
- }
13908
- async verifyEUDILegal() {
13909
- const session = await this.#eudiService.createLegalPIDVerificationSession();
13910
- const maxAttempts = 60;
13911
- const pollInterval = 2e3;
13912
- let attempts = 0;
13913
- while (attempts < maxAttempts) {
13914
- const result = await this.#eudiService.pollVerificationResult(session.sessionId);
13915
- if (result.status === "verified") {
13916
- const config = this.#eudiService.getConfig();
13917
- if (!config) throw new Error("EUDI service not configured");
13918
- const vpResponse = await this.#fetchVPToken(config.url, session.sessionId);
13919
- if (vpResponse?.vp_token) return this.#eudiService.extractLegalPIDClaims(vpResponse.vp_token, session.challenge);
13920
- }
13921
- if (result.status === "failed") throw new Error("EUDI Legal PID verification failed or was rejected");
13922
- await new Promise((resolve) => setTimeout(resolve, pollInterval));
13923
- attempts++;
13924
- }
13925
- throw new Error("EUDI Legal PID verification timed out");
13926
- }
13927
- async #fetchVPToken(baseUrl, sessionId) {
13928
- try {
13929
- const response = await fetch(`${baseUrl}/api/v1/presentations/sessions/${sessionId}`, {
13930
- method: "GET",
13931
- headers: { Accept: "application/json" }
13932
- });
13933
- return response.ok ? await response.json() : null;
13934
- } catch {
13935
- return null;
13936
- }
13937
- }
13938
- getVerificationStatus() {
13939
- return {
13940
- vlei: this.#keriaService.isConnected(),
13941
- eudiLegal: this.#eudiService.isConnected()
13942
- };
13943
- }
13944
- };
13945
-
13946
13329
  //#endregion
13947
13330
  //#region src/types/trust.ts
13948
13331
  function isTrustExpired(trust) {
@@ -13961,14 +13344,9 @@ exports.GroupManager = GroupManager;
13961
13344
  exports.IndexedDBGroupStateBackend = IndexedDBGroupStateBackend;
13962
13345
  exports.IndexedDBKeyPackageStore = IndexedDBKeyPackageStore;
13963
13346
  exports.IndexedDBKeyValueBackend = IndexedDBKeyValueBackend;
13964
- exports.IndividualTrustService = IndividualTrustService;
13965
- exports.KERIAService = KERIAService;
13966
13347
  exports.KeyManager = KeyManager;
13967
13348
  exports.MultisigManager = MultisigManager;
13968
- exports.OrganizationTrustService = OrganizationTrustService;
13969
13349
  exports.RelayService = RelayService;
13970
- exports.ZKMService = require_zkm_service.ZKMService;
13971
- exports.ZKPService = ZKPService;
13972
13350
  exports.aesGcmDecrypt = aesGcmDecrypt;
13973
13351
  exports.aesGcmEncrypt = aesGcmEncrypt;
13974
13352
  exports.buildAuthEvent = buildAuthEvent;
@@ -14006,12 +13384,9 @@ exports.hexToBytes = hexToBytes;
14006
13384
  exports.importPublicKeyFromBundle = importPublicKeyFromBundle;
14007
13385
  exports.initiateOAuthFlow = initiateOAuthFlow;
14008
13386
  exports.isEUDIAvailable = isEUDIAvailable;
14009
- exports.isKERIAAvailable = isKERIAAvailable;
14010
13387
  exports.isPrfSupported = require_prf_handler.isPrfSupported;
14011
13388
  exports.isTrustExpired = isTrustExpired;
14012
13389
  exports.isValidDidNostr = isValidDidNostr;
14013
- exports.isZKMAvailable = require_zkm_service.isZKMAvailable;
14014
- exports.isZKPAvailable = isZKPAvailable;
14015
13390
  exports.nip42Authenticate = authenticateToRelay;
14016
13391
  exports.normalizeRelayUrl = normalizeRelayUrl;
14017
13392
  exports.parseRecoveryTag = parseRecoveryTag;