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