@sphereon/ssi-sdk.ebsi-support 0.34.1-next.29 → 0.34.1-next.299

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.
package/dist/index.js CHANGED
@@ -356,7 +356,7 @@ var require_plugin_schema = __commonJS({
356
356
  di_vp: {
357
357
  $ref: "#/components/schemas/DiObject"
358
358
  },
359
- "vc+sd-jwt": {
359
+ "dc+sd-jwt": {
360
360
  $ref: "#/components/schemas/SdJwtObject"
361
361
  }
362
362
  }
@@ -2045,7 +2045,6 @@ var require_plugin_schema = __commonJS({
2045
2045
  import { Loggers, LogLevel, LogMethod } from "@sphereon/ssi-types";
2046
2046
 
2047
2047
  // src/agent/EbsiSupport.ts
2048
- import { PresentationDefinitionLocation, SupportedVersion } from "@sphereon/did-auth-siop";
2049
2048
  import { CreateRequestObjectMode as CreateRequestObjectMode2 } from "@sphereon/oid4vci-common";
2050
2049
  import { CredentialMapper } from "@sphereon/ssi-types";
2051
2050
  import fetch4 from "cross-fetch";
@@ -2067,13 +2066,14 @@ import { getAuthenticationKey, SupportedDidMethodEnum } from "@sphereon/ssi-sdk-
2067
2066
  import { calculateJwkThumbprintForKey, signatureAlgorithmFromKey } from "@sphereon/ssi-sdk-ext.key-utils";
2068
2067
  import { OID4VCICallbackStateListener, OID4VCIMachineStates, signCallback } from "@sphereon/ssi-sdk.oid4vci-holder";
2069
2068
  import { OID4VPCallbackStateListener, Siopv2MachineStates, Siopv2OID4VPLinkHandler } from "@sphereon/ssi-sdk.siopv2-oid4vp-op-auth";
2070
- import { waitFor } from "xstate/lib/waitFor";
2069
+ import { waitFor } from "xstate/lib/waitFor.js";
2071
2070
 
2072
2071
  // src/functions/AttestationHeadlessCallbacks.ts
2073
2072
  import { decodeUriAsJson } from "@sphereon/did-auth-siop";
2074
2073
  import { getIssuerName } from "@sphereon/oid4vci-common";
2075
- import { ConnectionType, CorrelationIdentifierType, CredentialRole, IdentityOrigin, PartyOrigin, PartyTypeType } from "@sphereon/ssi-sdk.data-store";
2074
+ import { ConnectionType, CorrelationIdentifierType, IdentityOrigin, PartyOrigin, PartyTypeType } from "@sphereon/ssi-sdk.data-store-types";
2076
2075
  import { OID4VCIMachineEvents } from "@sphereon/ssi-sdk.oid4vci-holder";
2076
+ import { CredentialRole } from "@sphereon/ssi-types";
2077
2077
  import fetch from "cross-fetch";
2078
2078
  var addContactCallback = /* @__PURE__ */ __name((context) => {
2079
2079
  return async (oid4vciMachine, state) => {
@@ -2317,7 +2317,7 @@ var ebsiCreateAttestationAuthRequestURL = /* @__PURE__ */ __name(async ({ client
2317
2317
  createAuthorizationRequestURL: false,
2318
2318
  retrieveServerMetadata: true
2319
2319
  });
2320
- const allMatches = vciClient.getCredentialsSupported(false);
2320
+ const allMatches = {};
2321
2321
  let arrayMatches;
2322
2322
  if (Array.isArray(allMatches)) {
2323
2323
  arrayMatches = allMatches;
@@ -2537,6 +2537,24 @@ var ebsiWaitTillDocumentAnchored = /* @__PURE__ */ __name(async (args) => {
2537
2537
  count
2538
2538
  };
2539
2539
  }, "ebsiWaitTillDocumentAnchored");
2540
+ var ebsiListDidDocuments = /* @__PURE__ */ __name(async (args) => {
2541
+ const { params, apiOpts } = args;
2542
+ const { offset, size, controller } = params;
2543
+ const queryParams = [];
2544
+ if (offset) {
2545
+ queryParams.push(`page[after]=${offset}`);
2546
+ }
2547
+ if (size) {
2548
+ queryParams.push(`page[size]=${size}`);
2549
+ }
2550
+ if (controller) {
2551
+ queryParams.push(`controller=${controller}`);
2552
+ }
2553
+ const query = `?${queryParams.filter(Boolean).join("&")}`;
2554
+ return await (await fetch2(`${ebsiGetRegistryAPIUrls({
2555
+ ...apiOpts
2556
+ }).query}/${query}`)).json();
2557
+ }, "ebsiListDidDocuments");
2540
2558
 
2541
2559
  // src/did/services/EbsiRPCService.ts
2542
2560
  import fetch3 from "cross-fetch";
@@ -2555,12 +2573,12 @@ var EBSI_DID_SPEC_INFOS = {
2555
2573
  method: "did:key:"
2556
2574
  }
2557
2575
  };
2558
- var EbsiPublicKeyPurpose = /* @__PURE__ */ function(EbsiPublicKeyPurpose2) {
2576
+ var EbsiPublicKeyPurpose = /* @__PURE__ */ (function(EbsiPublicKeyPurpose2) {
2559
2577
  EbsiPublicKeyPurpose2["Authentication"] = "authentication";
2560
2578
  EbsiPublicKeyPurpose2["AssertionMethod"] = "assertionMethod";
2561
2579
  EbsiPublicKeyPurpose2["CapabilityInvocation"] = "capabilityInvocation";
2562
2580
  return EbsiPublicKeyPurpose2;
2563
- }({});
2581
+ })({});
2564
2582
  var JSON_RPC_VERSION = "2.0";
2565
2583
  var BASE_CONTEXT_DOC = JSON.stringify({
2566
2584
  "@context": [
@@ -2568,7 +2586,7 @@ var BASE_CONTEXT_DOC = JSON.stringify({
2568
2586
  "https://w3id.org/security/suites/jws-2020/v1"
2569
2587
  ]
2570
2588
  });
2571
- var EbsiRpcMethod = /* @__PURE__ */ function(EbsiRpcMethod2) {
2589
+ var EbsiRpcMethod = /* @__PURE__ */ (function(EbsiRpcMethod2) {
2572
2590
  EbsiRpcMethod2["INSERT_DID_DOCUMENT"] = "insertDidDocument";
2573
2591
  EbsiRpcMethod2["UPDATE_DID_DOCUMENT"] = "updateBaseDocument";
2574
2592
  EbsiRpcMethod2["ADD_VERIFICATION_METHOD"] = "addVerificationMethod";
@@ -2576,7 +2594,7 @@ var EbsiRpcMethod = /* @__PURE__ */ function(EbsiRpcMethod2) {
2576
2594
  EbsiRpcMethod2["ADD_SERVICE"] = "addService";
2577
2595
  EbsiRpcMethod2["SEND_SIGNED_TRANSACTION"] = "sendSignedTransaction";
2578
2596
  return EbsiRpcMethod2;
2579
- }({});
2597
+ })({});
2580
2598
 
2581
2599
  // src/did/services/EbsiRPCService.ts
2582
2600
  var callRpcMethod = /* @__PURE__ */ __name(async (args) => {
@@ -2694,6 +2712,14 @@ var ebsiGetIssuerMock = /* @__PURE__ */ __name((args) => {
2694
2712
  system: environment
2695
2713
  })}/issuer-mock`;
2696
2714
  }, "ebsiGetIssuerMock");
2715
+ var ebsiGetAuthorisationServer = /* @__PURE__ */ __name((args) => {
2716
+ const { environment = "pilot", version = "v4" } = args;
2717
+ return `${getEbsiApiBaseUrl({
2718
+ environment,
2719
+ version,
2720
+ system: "authorisation"
2721
+ })}`;
2722
+ }, "ebsiGetAuthorisationServer");
2697
2723
  var ebsiGetRegistryAPIUrls = /* @__PURE__ */ __name((args) => {
2698
2724
  const { environment = "pilot", version = "v5" } = args;
2699
2725
  const baseUrl = `${getEbsiApiBaseUrl({
@@ -2807,7 +2833,7 @@ var toMinimalImportableKey = /* @__PURE__ */ __name(async (args) => {
2807
2833
  minimalImportableKey.meta = {
2808
2834
  purposes: assertedPurposes({
2809
2835
  key
2810
- }) ?? setDefaultPurposes({
2836
+ }) ?? setPurposes({
2811
2837
  key,
2812
2838
  type
2813
2839
  }),
@@ -2843,7 +2869,7 @@ var assertedPurposes = /* @__PURE__ */ __name((args) => {
2843
2869
  }
2844
2870
  return key?.purposes;
2845
2871
  }, "assertedPurposes");
2846
- var setDefaultPurposes = /* @__PURE__ */ __name((args) => {
2872
+ var setPurposes = /* @__PURE__ */ __name((args) => {
2847
2873
  const { key, type } = args;
2848
2874
  if (!key?.purposes || key.purposes.length === 0) {
2849
2875
  switch (type) {
@@ -2861,7 +2887,7 @@ var setDefaultPurposes = /* @__PURE__ */ __name((args) => {
2861
2887
  }
2862
2888
  }
2863
2889
  return key.purposes;
2864
- }, "setDefaultPurposes");
2890
+ }, "setPurposes");
2865
2891
  var randomRpcId = /* @__PURE__ */ __name(() => {
2866
2892
  return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
2867
2893
  }, "randomRpcId");
@@ -3095,7 +3121,6 @@ var ebsiCreateDidOnLedger = /* @__PURE__ */ __name(async (args, context) => {
3095
3121
 
3096
3122
  // src/agent/EbsiSupport.ts
3097
3123
  import { v4 } from "uuid";
3098
- import { CheckLinkedDomain } from "@sphereon/did-auth-siop-adapter";
3099
3124
  import { defaultHasher } from "@sphereon/ssi-sdk.core";
3100
3125
  var ebsiSupportMethods = [
3101
3126
  "ebsiCreateDidOnLedger",
@@ -3187,15 +3212,15 @@ var EbsiSupport = class {
3187
3212
  let attestationCredential = args.attestationCredential;
3188
3213
  if (hasInputDescriptors && !attestationCredential) {
3189
3214
  if (allVerifiableCredentials && allVerifiableCredentials.length > 0) {
3190
- const pexResult2 = await context.agent.pexDefinitionFilterCredentials({
3215
+ const pexResult = await context.agent.pexDefinitionFilterCredentials({
3191
3216
  presentationDefinition: definitionResponse,
3192
3217
  credentialFilterOpts: {
3193
3218
  credentialRole: args.credentialRole,
3194
3219
  verifiableCredentials: allVerifiableCredentials
3195
3220
  }
3196
3221
  });
3197
- if (pexResult2.filteredCredentials.length > 0) {
3198
- const filtered = pexResult2.filteredCredentials.map((cred) => CredentialMapper.toUniformCredential(cred, {
3222
+ if (pexResult.filteredCredentials.length > 0) {
3223
+ const filtered = pexResult.filteredCredentials.map((cred) => CredentialMapper.toUniformCredential(cred, {
3199
3224
  hasher: defaultHasher
3200
3225
  })).filter((cred) => {
3201
3226
  if (!cred.expirationDate) {
@@ -3240,57 +3265,7 @@ var EbsiSupport = class {
3240
3265
  attestationCredential = attestationResult.credentials[0].rawVerifiableCredential;
3241
3266
  }
3242
3267
  }
3243
- const definition = {
3244
- definition: definitionResponse,
3245
- location: PresentationDefinitionLocation.TOPLEVEL_PRESENTATION_DEF,
3246
- version: SupportedVersion.SIOPv2_D11
3247
- };
3248
- const pexResult = hasInputDescriptors ? await context.agent.pexDefinitionFilterCredentials({
3249
- presentationDefinition: definitionResponse,
3250
- credentialFilterOpts: {
3251
- credentialRole: args.credentialRole,
3252
- verifiableCredentials: [
3253
- attestationCredential
3254
- ]
3255
- }
3256
- }) : {
3257
- // LOL, let's see whether we can trick PEX to create a VP without VCs
3258
- filteredCredentials: [],
3259
- id: definitionResponse.id,
3260
- selectResults: {
3261
- verifiableCredential: [],
3262
- areRequiredCredentialsPresent: "info"
3263
- }
3264
- };
3265
- const opSession = await context.agent.siopRegisterOPSession({
3266
- requestJwtOrUri: "",
3267
- op: {
3268
- checkLinkedDomains: CheckLinkedDomain.NEVER
3269
- },
3270
- providedPresentationDefinitions: [
3271
- definition
3272
- ]
3273
- });
3274
- const oid4vp = await opSession.getOID4VP({
3275
- allIdentifiers: [
3276
- identifier.did
3277
- ]
3278
- });
3279
- const vp = await oid4vp.createVerifiablePresentation(args.credentialRole, {
3280
- definition,
3281
- credentials: pexResult.filteredCredentials
3282
- }, {
3283
- proofOpts: {
3284
- domain: openIDMetadata.issuer,
3285
- nonce: v4(),
3286
- created: new Date(Date.now() - 12e4).toString()
3287
- },
3288
- holder: identifier.did,
3289
- idOpts,
3290
- skipDidResolution,
3291
- forceNoCredentialsInVP: !hasInputDescriptors
3292
- });
3293
- const presentationSubmission = hasInputDescriptors ? vp.presentationSubmission : {
3268
+ const presentationSubmission = {
3294
3269
  id: v4(),
3295
3270
  definition_id: definitionResponse.id,
3296
3271
  descriptor_map: []
@@ -3298,7 +3273,8 @@ var EbsiSupport = class {
3298
3273
  console.log(`Presentation submission`, presentationSubmission);
3299
3274
  const tokenRequestArgs = {
3300
3275
  grant_type: "vp_token",
3301
- vp_token: CredentialMapper.toCompactJWT(vp.verifiablePresentations[0]),
3276
+ // FIXME SSISDK-40
3277
+ vp_token: "",
3302
3278
  scope,
3303
3279
  presentation_submission: presentationSubmission,
3304
3280
  apiOpts: {
@@ -3347,10 +3323,10 @@ ${JSON.stringify(accessTokenResponse)}`);
3347
3323
  };
3348
3324
 
3349
3325
  // src/types/IEbsiSupport.ts
3350
- var TokenType = /* @__PURE__ */ function(TokenType2) {
3326
+ var TokenType = /* @__PURE__ */ (function(TokenType2) {
3351
3327
  TokenType2["BEARER"] = "Bearer";
3352
3328
  return TokenType2;
3353
- }({});
3329
+ })({});
3354
3330
 
3355
3331
  // src/did/EbsiDidProvider.ts
3356
3332
  import { getControllerKey as getControllerKey2, getEthereumAddressFromKey as getEthereumAddressFromKey2 } from "@sphereon/ssi-sdk-ext.did-utils";
@@ -3561,6 +3537,18 @@ var EbsiDidProvider = class _EbsiDidProvider extends AbstractIdentifierProvider
3561
3537
  // src/did/EbsiDidResolver.ts
3562
3538
  import { Resolver } from "did-resolver";
3563
3539
  import { getResolver } from "@sphereon/ssi-sdk-ext.did-resolver-ebsi";
3540
+ var resolveDidEbsi = /* @__PURE__ */ __name(async (didUrl, _parsed, _resolver, options) => {
3541
+ const resolver = new Resolver({
3542
+ ...getResolver()
3543
+ });
3544
+ return resolver.resolve(didUrl, options);
3545
+ }, "resolveDidEbsi");
3546
+ function getDidEbsiResolver() {
3547
+ return {
3548
+ key: resolveDidEbsi
3549
+ };
3550
+ }
3551
+ __name(getDidEbsiResolver, "getDidEbsiResolver");
3564
3552
 
3565
3553
  // src/index.ts
3566
3554
  var logger = Loggers.DEFAULT.options("sphereon:ebsi-support", {
@@ -3572,11 +3560,34 @@ var logger = Loggers.DEFAULT.options("sphereon:ebsi-support", {
3572
3560
  }).get("sphereon:ebsi-support");
3573
3561
  var schema = require_plugin_schema();
3574
3562
  export {
3563
+ BASE_CONTEXT_DOC,
3564
+ EBSI_DID_SPEC_INFOS,
3575
3565
  EbsiDidProvider,
3566
+ EbsiPublicKeyPurpose,
3567
+ EbsiRpcMethod,
3576
3568
  EbsiSupport,
3569
+ JSON_RPC_VERSION,
3577
3570
  TokenType,
3571
+ assertedPurposes,
3572
+ determineWellknownEndpoint,
3573
+ ebsiCreateDidOnLedger,
3574
+ ebsiGenerateOrUseKeyPair,
3575
+ ebsiGetAuthorisationServer,
3576
+ ebsiGetDidDocument,
3577
+ ebsiGetIssuerMock,
3578
+ ebsiGetRegistryAPIUrls,
3579
+ ebsiListDidDocuments,
3580
+ ebsiSignAndSendTransaction,
3578
3581
  ebsiSupportMethods,
3582
+ ebsiWaitTillDocumentAnchored,
3583
+ formatEbsiPublicKey,
3584
+ generateEbsiMethodSpecificId,
3585
+ generateOrUseProvidedEbsiPrivateKeyHex,
3586
+ getDidEbsiResolver,
3579
3587
  logger,
3580
- schema
3588
+ randomRpcId,
3589
+ schema,
3590
+ setPurposes,
3591
+ toMinimalImportableKey
3581
3592
  };
3582
3593
  //# sourceMappingURL=index.js.map