@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.cjs CHANGED
@@ -382,7 +382,7 @@ var require_plugin_schema = __commonJS({
382
382
  di_vp: {
383
383
  $ref: "#/components/schemas/DiObject"
384
384
  },
385
- "vc+sd-jwt": {
385
+ "dc+sd-jwt": {
386
386
  $ref: "#/components/schemas/SdJwtObject"
387
387
  }
388
388
  }
@@ -2070,20 +2070,42 @@ var require_plugin_schema = __commonJS({
2070
2070
  // src/index.ts
2071
2071
  var index_exports = {};
2072
2072
  __export(index_exports, {
2073
+ BASE_CONTEXT_DOC: () => BASE_CONTEXT_DOC,
2074
+ EBSI_DID_SPEC_INFOS: () => EBSI_DID_SPEC_INFOS,
2073
2075
  EbsiDidProvider: () => EbsiDidProvider,
2076
+ EbsiPublicKeyPurpose: () => EbsiPublicKeyPurpose,
2077
+ EbsiRpcMethod: () => EbsiRpcMethod,
2074
2078
  EbsiSupport: () => EbsiSupport,
2079
+ JSON_RPC_VERSION: () => JSON_RPC_VERSION,
2075
2080
  TokenType: () => TokenType,
2081
+ assertedPurposes: () => assertedPurposes,
2082
+ determineWellknownEndpoint: () => determineWellknownEndpoint,
2083
+ ebsiCreateDidOnLedger: () => ebsiCreateDidOnLedger,
2084
+ ebsiGenerateOrUseKeyPair: () => ebsiGenerateOrUseKeyPair,
2085
+ ebsiGetAuthorisationServer: () => ebsiGetAuthorisationServer,
2086
+ ebsiGetDidDocument: () => ebsiGetDidDocument,
2087
+ ebsiGetIssuerMock: () => ebsiGetIssuerMock,
2088
+ ebsiGetRegistryAPIUrls: () => ebsiGetRegistryAPIUrls,
2089
+ ebsiListDidDocuments: () => ebsiListDidDocuments,
2090
+ ebsiSignAndSendTransaction: () => ebsiSignAndSendTransaction,
2076
2091
  ebsiSupportMethods: () => ebsiSupportMethods,
2092
+ ebsiWaitTillDocumentAnchored: () => ebsiWaitTillDocumentAnchored,
2093
+ formatEbsiPublicKey: () => formatEbsiPublicKey,
2094
+ generateEbsiMethodSpecificId: () => generateEbsiMethodSpecificId,
2095
+ generateOrUseProvidedEbsiPrivateKeyHex: () => generateOrUseProvidedEbsiPrivateKeyHex,
2096
+ getDidEbsiResolver: () => getDidEbsiResolver,
2077
2097
  logger: () => logger,
2078
- schema: () => schema
2098
+ randomRpcId: () => randomRpcId,
2099
+ schema: () => schema,
2100
+ setPurposes: () => setPurposes,
2101
+ toMinimalImportableKey: () => toMinimalImportableKey
2079
2102
  });
2080
2103
  module.exports = __toCommonJS(index_exports);
2081
- var import_ssi_types2 = require("@sphereon/ssi-types");
2104
+ var import_ssi_types3 = require("@sphereon/ssi-types");
2082
2105
 
2083
2106
  // src/agent/EbsiSupport.ts
2084
- var import_did_auth_siop2 = require("@sphereon/did-auth-siop");
2085
2107
  var import_oid4vci_common4 = require("@sphereon/oid4vci-common");
2086
- var import_ssi_types = require("@sphereon/ssi-types");
2108
+ var import_ssi_types2 = require("@sphereon/ssi-types");
2087
2109
  var import_cross_fetch4 = __toESM(require("cross-fetch"), 1);
2088
2110
 
2089
2111
  // src/did/functions.ts
@@ -2103,13 +2125,14 @@ var import_ssi_sdk_ext = require("@sphereon/ssi-sdk-ext.did-utils");
2103
2125
  var import_ssi_sdk_ext2 = require("@sphereon/ssi-sdk-ext.key-utils");
2104
2126
  var import_ssi_sdk3 = require("@sphereon/ssi-sdk.oid4vci-holder");
2105
2127
  var import_ssi_sdk4 = require("@sphereon/ssi-sdk.siopv2-oid4vp-op-auth");
2106
- var import_waitFor = require("xstate/lib/waitFor");
2128
+ var import_waitFor = require("xstate/lib/waitFor.js");
2107
2129
 
2108
2130
  // src/functions/AttestationHeadlessCallbacks.ts
2109
2131
  var import_did_auth_siop = require("@sphereon/did-auth-siop");
2110
2132
  var import_oid4vci_common = require("@sphereon/oid4vci-common");
2111
- var import_ssi_sdk = require("@sphereon/ssi-sdk.data-store");
2133
+ var import_ssi_sdk = require("@sphereon/ssi-sdk.data-store-types");
2112
2134
  var import_ssi_sdk2 = require("@sphereon/ssi-sdk.oid4vci-holder");
2135
+ var import_ssi_types = require("@sphereon/ssi-types");
2113
2136
  var import_cross_fetch = __toESM(require("cross-fetch"), 1);
2114
2137
  var addContactCallback = /* @__PURE__ */ __name((context) => {
2115
2138
  return async (oid4vciMachine, state) => {
@@ -2140,7 +2163,7 @@ var addContactCallback = /* @__PURE__ */ __name((context) => {
2140
2163
  {
2141
2164
  alias: correlationId,
2142
2165
  roles: [
2143
- import_ssi_sdk.CredentialRole.ISSUER
2166
+ import_ssi_types.CredentialRole.ISSUER
2144
2167
  ],
2145
2168
  origin: import_ssi_sdk.IdentityOrigin.EXTERNAL,
2146
2169
  identifier: {
@@ -2353,7 +2376,7 @@ var ebsiCreateAttestationAuthRequestURL = /* @__PURE__ */ __name(async ({ client
2353
2376
  createAuthorizationRequestURL: false,
2354
2377
  retrieveServerMetadata: true
2355
2378
  });
2356
- const allMatches = vciClient.getCredentialsSupported(false);
2379
+ const allMatches = {};
2357
2380
  let arrayMatches;
2358
2381
  if (Array.isArray(allMatches)) {
2359
2382
  arrayMatches = allMatches;
@@ -2573,6 +2596,24 @@ var ebsiWaitTillDocumentAnchored = /* @__PURE__ */ __name(async (args) => {
2573
2596
  count
2574
2597
  };
2575
2598
  }, "ebsiWaitTillDocumentAnchored");
2599
+ var ebsiListDidDocuments = /* @__PURE__ */ __name(async (args) => {
2600
+ const { params, apiOpts } = args;
2601
+ const { offset, size, controller } = params;
2602
+ const queryParams = [];
2603
+ if (offset) {
2604
+ queryParams.push(`page[after]=${offset}`);
2605
+ }
2606
+ if (size) {
2607
+ queryParams.push(`page[size]=${size}`);
2608
+ }
2609
+ if (controller) {
2610
+ queryParams.push(`controller=${controller}`);
2611
+ }
2612
+ const query = `?${queryParams.filter(Boolean).join("&")}`;
2613
+ return await (await (0, import_cross_fetch2.default)(`${ebsiGetRegistryAPIUrls({
2614
+ ...apiOpts
2615
+ }).query}/${query}`)).json();
2616
+ }, "ebsiListDidDocuments");
2576
2617
 
2577
2618
  // src/did/services/EbsiRPCService.ts
2578
2619
  var import_cross_fetch3 = __toESM(require("cross-fetch"), 1);
@@ -2591,12 +2632,12 @@ var EBSI_DID_SPEC_INFOS = {
2591
2632
  method: "did:key:"
2592
2633
  }
2593
2634
  };
2594
- var EbsiPublicKeyPurpose = /* @__PURE__ */ function(EbsiPublicKeyPurpose2) {
2635
+ var EbsiPublicKeyPurpose = /* @__PURE__ */ (function(EbsiPublicKeyPurpose2) {
2595
2636
  EbsiPublicKeyPurpose2["Authentication"] = "authentication";
2596
2637
  EbsiPublicKeyPurpose2["AssertionMethod"] = "assertionMethod";
2597
2638
  EbsiPublicKeyPurpose2["CapabilityInvocation"] = "capabilityInvocation";
2598
2639
  return EbsiPublicKeyPurpose2;
2599
- }({});
2640
+ })({});
2600
2641
  var JSON_RPC_VERSION = "2.0";
2601
2642
  var BASE_CONTEXT_DOC = JSON.stringify({
2602
2643
  "@context": [
@@ -2604,7 +2645,7 @@ var BASE_CONTEXT_DOC = JSON.stringify({
2604
2645
  "https://w3id.org/security/suites/jws-2020/v1"
2605
2646
  ]
2606
2647
  });
2607
- var EbsiRpcMethod = /* @__PURE__ */ function(EbsiRpcMethod2) {
2648
+ var EbsiRpcMethod = /* @__PURE__ */ (function(EbsiRpcMethod2) {
2608
2649
  EbsiRpcMethod2["INSERT_DID_DOCUMENT"] = "insertDidDocument";
2609
2650
  EbsiRpcMethod2["UPDATE_DID_DOCUMENT"] = "updateBaseDocument";
2610
2651
  EbsiRpcMethod2["ADD_VERIFICATION_METHOD"] = "addVerificationMethod";
@@ -2612,7 +2653,7 @@ var EbsiRpcMethod = /* @__PURE__ */ function(EbsiRpcMethod2) {
2612
2653
  EbsiRpcMethod2["ADD_SERVICE"] = "addService";
2613
2654
  EbsiRpcMethod2["SEND_SIGNED_TRANSACTION"] = "sendSignedTransaction";
2614
2655
  return EbsiRpcMethod2;
2615
- }({});
2656
+ })({});
2616
2657
 
2617
2658
  // src/did/services/EbsiRPCService.ts
2618
2659
  var callRpcMethod = /* @__PURE__ */ __name(async (args) => {
@@ -2730,6 +2771,14 @@ var ebsiGetIssuerMock = /* @__PURE__ */ __name((args) => {
2730
2771
  system: environment
2731
2772
  })}/issuer-mock`;
2732
2773
  }, "ebsiGetIssuerMock");
2774
+ var ebsiGetAuthorisationServer = /* @__PURE__ */ __name((args) => {
2775
+ const { environment = "pilot", version = "v4" } = args;
2776
+ return `${getEbsiApiBaseUrl({
2777
+ environment,
2778
+ version,
2779
+ system: "authorisation"
2780
+ })}`;
2781
+ }, "ebsiGetAuthorisationServer");
2733
2782
  var ebsiGetRegistryAPIUrls = /* @__PURE__ */ __name((args) => {
2734
2783
  const { environment = "pilot", version = "v5" } = args;
2735
2784
  const baseUrl = `${getEbsiApiBaseUrl({
@@ -2843,7 +2892,7 @@ var toMinimalImportableKey = /* @__PURE__ */ __name(async (args) => {
2843
2892
  minimalImportableKey.meta = {
2844
2893
  purposes: assertedPurposes({
2845
2894
  key
2846
- }) ?? setDefaultPurposes({
2895
+ }) ?? setPurposes({
2847
2896
  key,
2848
2897
  type
2849
2898
  }),
@@ -2879,7 +2928,7 @@ var assertedPurposes = /* @__PURE__ */ __name((args) => {
2879
2928
  }
2880
2929
  return key?.purposes;
2881
2930
  }, "assertedPurposes");
2882
- var setDefaultPurposes = /* @__PURE__ */ __name((args) => {
2931
+ var setPurposes = /* @__PURE__ */ __name((args) => {
2883
2932
  const { key, type } = args;
2884
2933
  if (!key?.purposes || key.purposes.length === 0) {
2885
2934
  switch (type) {
@@ -2897,7 +2946,7 @@ var setDefaultPurposes = /* @__PURE__ */ __name((args) => {
2897
2946
  }
2898
2947
  }
2899
2948
  return key.purposes;
2900
- }, "setDefaultPurposes");
2949
+ }, "setPurposes");
2901
2950
  var randomRpcId = /* @__PURE__ */ __name(() => {
2902
2951
  return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
2903
2952
  }, "randomRpcId");
@@ -3131,7 +3180,6 @@ var ebsiCreateDidOnLedger = /* @__PURE__ */ __name(async (args, context) => {
3131
3180
 
3132
3181
  // src/agent/EbsiSupport.ts
3133
3182
  var import_uuid = require("uuid");
3134
- var import_did_auth_siop_adapter = require("@sphereon/did-auth-siop-adapter");
3135
3183
  var import_ssi_sdk5 = require("@sphereon/ssi-sdk.core");
3136
3184
  var ebsiSupportMethods = [
3137
3185
  "ebsiCreateDidOnLedger",
@@ -3223,15 +3271,15 @@ var EbsiSupport = class {
3223
3271
  let attestationCredential = args.attestationCredential;
3224
3272
  if (hasInputDescriptors && !attestationCredential) {
3225
3273
  if (allVerifiableCredentials && allVerifiableCredentials.length > 0) {
3226
- const pexResult2 = await context.agent.pexDefinitionFilterCredentials({
3274
+ const pexResult = await context.agent.pexDefinitionFilterCredentials({
3227
3275
  presentationDefinition: definitionResponse,
3228
3276
  credentialFilterOpts: {
3229
3277
  credentialRole: args.credentialRole,
3230
3278
  verifiableCredentials: allVerifiableCredentials
3231
3279
  }
3232
3280
  });
3233
- if (pexResult2.filteredCredentials.length > 0) {
3234
- const filtered = pexResult2.filteredCredentials.map((cred) => import_ssi_types.CredentialMapper.toUniformCredential(cred, {
3281
+ if (pexResult.filteredCredentials.length > 0) {
3282
+ const filtered = pexResult.filteredCredentials.map((cred) => import_ssi_types2.CredentialMapper.toUniformCredential(cred, {
3235
3283
  hasher: import_ssi_sdk5.defaultHasher
3236
3284
  })).filter((cred) => {
3237
3285
  if (!cred.expirationDate) {
@@ -3276,57 +3324,7 @@ var EbsiSupport = class {
3276
3324
  attestationCredential = attestationResult.credentials[0].rawVerifiableCredential;
3277
3325
  }
3278
3326
  }
3279
- const definition = {
3280
- definition: definitionResponse,
3281
- location: import_did_auth_siop2.PresentationDefinitionLocation.TOPLEVEL_PRESENTATION_DEF,
3282
- version: import_did_auth_siop2.SupportedVersion.SIOPv2_D11
3283
- };
3284
- const pexResult = hasInputDescriptors ? await context.agent.pexDefinitionFilterCredentials({
3285
- presentationDefinition: definitionResponse,
3286
- credentialFilterOpts: {
3287
- credentialRole: args.credentialRole,
3288
- verifiableCredentials: [
3289
- attestationCredential
3290
- ]
3291
- }
3292
- }) : {
3293
- // LOL, let's see whether we can trick PEX to create a VP without VCs
3294
- filteredCredentials: [],
3295
- id: definitionResponse.id,
3296
- selectResults: {
3297
- verifiableCredential: [],
3298
- areRequiredCredentialsPresent: "info"
3299
- }
3300
- };
3301
- const opSession = await context.agent.siopRegisterOPSession({
3302
- requestJwtOrUri: "",
3303
- op: {
3304
- checkLinkedDomains: import_did_auth_siop_adapter.CheckLinkedDomain.NEVER
3305
- },
3306
- providedPresentationDefinitions: [
3307
- definition
3308
- ]
3309
- });
3310
- const oid4vp = await opSession.getOID4VP({
3311
- allIdentifiers: [
3312
- identifier.did
3313
- ]
3314
- });
3315
- const vp = await oid4vp.createVerifiablePresentation(args.credentialRole, {
3316
- definition,
3317
- credentials: pexResult.filteredCredentials
3318
- }, {
3319
- proofOpts: {
3320
- domain: openIDMetadata.issuer,
3321
- nonce: (0, import_uuid.v4)(),
3322
- created: new Date(Date.now() - 12e4).toString()
3323
- },
3324
- holder: identifier.did,
3325
- idOpts,
3326
- skipDidResolution,
3327
- forceNoCredentialsInVP: !hasInputDescriptors
3328
- });
3329
- const presentationSubmission = hasInputDescriptors ? vp.presentationSubmission : {
3327
+ const presentationSubmission = {
3330
3328
  id: (0, import_uuid.v4)(),
3331
3329
  definition_id: definitionResponse.id,
3332
3330
  descriptor_map: []
@@ -3334,7 +3332,8 @@ var EbsiSupport = class {
3334
3332
  console.log(`Presentation submission`, presentationSubmission);
3335
3333
  const tokenRequestArgs = {
3336
3334
  grant_type: "vp_token",
3337
- vp_token: import_ssi_types.CredentialMapper.toCompactJWT(vp.verifiablePresentations[0]),
3335
+ // FIXME SSISDK-40
3336
+ vp_token: "",
3338
3337
  scope,
3339
3338
  presentation_submission: presentationSubmission,
3340
3339
  apiOpts: {
@@ -3383,10 +3382,10 @@ ${JSON.stringify(accessTokenResponse)}`);
3383
3382
  };
3384
3383
 
3385
3384
  // src/types/IEbsiSupport.ts
3386
- var TokenType = /* @__PURE__ */ function(TokenType2) {
3385
+ var TokenType = /* @__PURE__ */ (function(TokenType2) {
3387
3386
  TokenType2["BEARER"] = "Bearer";
3388
3387
  return TokenType2;
3389
- }({});
3388
+ })({});
3390
3389
 
3391
3390
  // src/did/EbsiDidProvider.ts
3392
3391
  var import_ssi_sdk_ext5 = require("@sphereon/ssi-sdk-ext.did-utils");
@@ -3597,13 +3596,25 @@ var EbsiDidProvider = class _EbsiDidProvider extends import_did_manager.Abstract
3597
3596
  // src/did/EbsiDidResolver.ts
3598
3597
  var import_did_resolver = require("did-resolver");
3599
3598
  var import_ssi_sdk_ext7 = require("@sphereon/ssi-sdk-ext.did-resolver-ebsi");
3599
+ var resolveDidEbsi = /* @__PURE__ */ __name(async (didUrl, _parsed, _resolver, options) => {
3600
+ const resolver = new import_did_resolver.Resolver({
3601
+ ...(0, import_ssi_sdk_ext7.getResolver)()
3602
+ });
3603
+ return resolver.resolve(didUrl, options);
3604
+ }, "resolveDidEbsi");
3605
+ function getDidEbsiResolver() {
3606
+ return {
3607
+ key: resolveDidEbsi
3608
+ };
3609
+ }
3610
+ __name(getDidEbsiResolver, "getDidEbsiResolver");
3600
3611
 
3601
3612
  // src/index.ts
3602
- var logger = import_ssi_types2.Loggers.DEFAULT.options("sphereon:ebsi-support", {
3603
- defaultLogLevel: import_ssi_types2.LogLevel.DEBUG,
3613
+ var logger = import_ssi_types3.Loggers.DEFAULT.options("sphereon:ebsi-support", {
3614
+ defaultLogLevel: import_ssi_types3.LogLevel.DEBUG,
3604
3615
  methods: [
3605
- import_ssi_types2.LogMethod.CONSOLE,
3606
- import_ssi_types2.LogMethod.DEBUG_PKG
3616
+ import_ssi_types3.LogMethod.CONSOLE,
3617
+ import_ssi_types3.LogMethod.DEBUG_PKG
3607
3618
  ]
3608
3619
  }).get("sphereon:ebsi-support");
3609
3620
  var schema = require_plugin_schema();