@sphereon/ssi-sdk.ebsi-support 0.34.1-next.91 → 0.36.0

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
@@ -2070,19 +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
2107
  var import_oid4vci_common4 = require("@sphereon/oid4vci-common");
2085
- var import_ssi_types = require("@sphereon/ssi-types");
2108
+ var import_ssi_types2 = require("@sphereon/ssi-types");
2086
2109
  var import_cross_fetch4 = __toESM(require("cross-fetch"), 1);
2087
2110
 
2088
2111
  // src/did/functions.ts
@@ -2102,13 +2125,14 @@ var import_ssi_sdk_ext = require("@sphereon/ssi-sdk-ext.did-utils");
2102
2125
  var import_ssi_sdk_ext2 = require("@sphereon/ssi-sdk-ext.key-utils");
2103
2126
  var import_ssi_sdk3 = require("@sphereon/ssi-sdk.oid4vci-holder");
2104
2127
  var import_ssi_sdk4 = require("@sphereon/ssi-sdk.siopv2-oid4vp-op-auth");
2105
- var import_waitFor = require("xstate/lib/waitFor");
2128
+ var import_waitFor = require("xstate/lib/waitFor.js");
2106
2129
 
2107
2130
  // src/functions/AttestationHeadlessCallbacks.ts
2108
2131
  var import_did_auth_siop = require("@sphereon/did-auth-siop");
2109
2132
  var import_oid4vci_common = require("@sphereon/oid4vci-common");
2110
- var import_ssi_sdk = require("@sphereon/ssi-sdk.data-store");
2133
+ var import_ssi_sdk = require("@sphereon/ssi-sdk.data-store-types");
2111
2134
  var import_ssi_sdk2 = require("@sphereon/ssi-sdk.oid4vci-holder");
2135
+ var import_ssi_types = require("@sphereon/ssi-types");
2112
2136
  var import_cross_fetch = __toESM(require("cross-fetch"), 1);
2113
2137
  var addContactCallback = /* @__PURE__ */ __name((context) => {
2114
2138
  return async (oid4vciMachine, state) => {
@@ -2139,7 +2163,7 @@ var addContactCallback = /* @__PURE__ */ __name((context) => {
2139
2163
  {
2140
2164
  alias: correlationId,
2141
2165
  roles: [
2142
- import_ssi_sdk.CredentialRole.ISSUER
2166
+ import_ssi_types.CredentialRole.ISSUER
2143
2167
  ],
2144
2168
  origin: import_ssi_sdk.IdentityOrigin.EXTERNAL,
2145
2169
  identifier: {
@@ -2352,7 +2376,7 @@ var ebsiCreateAttestationAuthRequestURL = /* @__PURE__ */ __name(async ({ client
2352
2376
  createAuthorizationRequestURL: false,
2353
2377
  retrieveServerMetadata: true
2354
2378
  });
2355
- const allMatches = vciClient.getCredentialsSupported(false);
2379
+ const allMatches = {};
2356
2380
  let arrayMatches;
2357
2381
  if (Array.isArray(allMatches)) {
2358
2382
  arrayMatches = allMatches;
@@ -2369,10 +2393,14 @@ var ebsiCreateAttestationAuthRequestURL = /* @__PURE__ */ __name(async ({ client
2369
2393
  throw Error(`Could not find '${credentialType}' with format(s) '${formats.join(",")}' in list of supported types for issuer: ${credentialIssuer}`);
2370
2394
  }
2371
2395
  const authorizationDetails = supportedConfigurations.map((supported) => {
2396
+ const credential_configuration_id = supported.id;
2397
+ if (!credential_configuration_id) {
2398
+ throw Error(`Credential configuration id missing for credential type: ${credentialType}`);
2399
+ }
2372
2400
  return {
2373
2401
  type: "openid_credential",
2374
- format: supported.format,
2375
- types: (0, import_oid4vci_common2.getTypesFromCredentialSupported)(supported)
2402
+ credential_configuration_id,
2403
+ credential_identifiers: (0, import_oid4vci_common2.getTypesFromCredentialSupported)(supported)
2376
2404
  };
2377
2405
  });
2378
2406
  const signCallbacks = requestObjectOpts.signCallbacks ?? {
@@ -2572,6 +2600,24 @@ var ebsiWaitTillDocumentAnchored = /* @__PURE__ */ __name(async (args) => {
2572
2600
  count
2573
2601
  };
2574
2602
  }, "ebsiWaitTillDocumentAnchored");
2603
+ var ebsiListDidDocuments = /* @__PURE__ */ __name(async (args) => {
2604
+ const { params, apiOpts } = args;
2605
+ const { offset, size, controller } = params;
2606
+ const queryParams = [];
2607
+ if (offset) {
2608
+ queryParams.push(`page[after]=${offset}`);
2609
+ }
2610
+ if (size) {
2611
+ queryParams.push(`page[size]=${size}`);
2612
+ }
2613
+ if (controller) {
2614
+ queryParams.push(`controller=${controller}`);
2615
+ }
2616
+ const query = `?${queryParams.filter(Boolean).join("&")}`;
2617
+ return await (await (0, import_cross_fetch2.default)(`${ebsiGetRegistryAPIUrls({
2618
+ ...apiOpts
2619
+ }).query}/${query}`)).json();
2620
+ }, "ebsiListDidDocuments");
2575
2621
 
2576
2622
  // src/did/services/EbsiRPCService.ts
2577
2623
  var import_cross_fetch3 = __toESM(require("cross-fetch"), 1);
@@ -2729,6 +2775,14 @@ var ebsiGetIssuerMock = /* @__PURE__ */ __name((args) => {
2729
2775
  system: environment
2730
2776
  })}/issuer-mock`;
2731
2777
  }, "ebsiGetIssuerMock");
2778
+ var ebsiGetAuthorisationServer = /* @__PURE__ */ __name((args) => {
2779
+ const { environment = "pilot", version = "v4" } = args;
2780
+ return `${getEbsiApiBaseUrl({
2781
+ environment,
2782
+ version,
2783
+ system: "authorisation"
2784
+ })}`;
2785
+ }, "ebsiGetAuthorisationServer");
2732
2786
  var ebsiGetRegistryAPIUrls = /* @__PURE__ */ __name((args) => {
2733
2787
  const { environment = "pilot", version = "v5" } = args;
2734
2788
  const baseUrl = `${getEbsiApiBaseUrl({
@@ -2842,7 +2896,7 @@ var toMinimalImportableKey = /* @__PURE__ */ __name(async (args) => {
2842
2896
  minimalImportableKey.meta = {
2843
2897
  purposes: assertedPurposes({
2844
2898
  key
2845
- }) ?? setDefaultPurposes({
2899
+ }) ?? setPurposes({
2846
2900
  key,
2847
2901
  type
2848
2902
  }),
@@ -2878,7 +2932,7 @@ var assertedPurposes = /* @__PURE__ */ __name((args) => {
2878
2932
  }
2879
2933
  return key?.purposes;
2880
2934
  }, "assertedPurposes");
2881
- var setDefaultPurposes = /* @__PURE__ */ __name((args) => {
2935
+ var setPurposes = /* @__PURE__ */ __name((args) => {
2882
2936
  const { key, type } = args;
2883
2937
  if (!key?.purposes || key.purposes.length === 0) {
2884
2938
  switch (type) {
@@ -2896,7 +2950,7 @@ var setDefaultPurposes = /* @__PURE__ */ __name((args) => {
2896
2950
  }
2897
2951
  }
2898
2952
  return key.purposes;
2899
- }, "setDefaultPurposes");
2953
+ }, "setPurposes");
2900
2954
  var randomRpcId = /* @__PURE__ */ __name(() => {
2901
2955
  return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
2902
2956
  }, "randomRpcId");
@@ -3229,7 +3283,7 @@ var EbsiSupport = class {
3229
3283
  }
3230
3284
  });
3231
3285
  if (pexResult.filteredCredentials.length > 0) {
3232
- const filtered = pexResult.filteredCredentials.map((cred) => import_ssi_types.CredentialMapper.toUniformCredential(cred, {
3286
+ const filtered = pexResult.filteredCredentials.map((cred) => import_ssi_types2.CredentialMapper.toUniformCredential(cred, {
3233
3287
  hasher: import_ssi_sdk5.defaultHasher
3234
3288
  })).filter((cred) => {
3235
3289
  if (!cred.expirationDate) {
@@ -3546,13 +3600,25 @@ var EbsiDidProvider = class _EbsiDidProvider extends import_did_manager.Abstract
3546
3600
  // src/did/EbsiDidResolver.ts
3547
3601
  var import_did_resolver = require("did-resolver");
3548
3602
  var import_ssi_sdk_ext7 = require("@sphereon/ssi-sdk-ext.did-resolver-ebsi");
3603
+ var resolveDidEbsi = /* @__PURE__ */ __name(async (didUrl, _parsed, _resolver, options) => {
3604
+ const resolver = new import_did_resolver.Resolver({
3605
+ ...(0, import_ssi_sdk_ext7.getResolver)()
3606
+ });
3607
+ return resolver.resolve(didUrl, options);
3608
+ }, "resolveDidEbsi");
3609
+ function getDidEbsiResolver() {
3610
+ return {
3611
+ key: resolveDidEbsi
3612
+ };
3613
+ }
3614
+ __name(getDidEbsiResolver, "getDidEbsiResolver");
3549
3615
 
3550
3616
  // src/index.ts
3551
- var logger = import_ssi_types2.Loggers.DEFAULT.options("sphereon:ebsi-support", {
3552
- defaultLogLevel: import_ssi_types2.LogLevel.DEBUG,
3617
+ var logger = import_ssi_types3.Loggers.DEFAULT.options("sphereon:ebsi-support", {
3618
+ defaultLogLevel: import_ssi_types3.LogLevel.DEBUG,
3553
3619
  methods: [
3554
- import_ssi_types2.LogMethod.CONSOLE,
3555
- import_ssi_types2.LogMethod.DEBUG_PKG
3620
+ import_ssi_types3.LogMethod.CONSOLE,
3621
+ import_ssi_types3.LogMethod.DEBUG_PKG
3556
3622
  ]
3557
3623
  }).get("sphereon:ebsi-support");
3558
3624
  var schema = require_plugin_schema();