@sphereon/ssi-sdk.ebsi-support 0.34.1-next.3 → 0.34.1-next.322
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 +95 -80
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +327 -5
- package/dist/index.d.ts +327 -5
- package/dist/index.js +88 -73
- package/dist/index.js.map +1 -1
- package/package.json +26 -25
- package/plugin.schema.json +1 -1
- package/src/agent/EbsiSupport.ts +42 -40
- package/src/did/functions.ts +2 -2
- package/src/did/index.ts +1 -0
- package/src/did/types.ts +1 -1
- package/src/functions/Attestation.ts +11 -6
- package/src/functions/AttestationHeadlessCallbacks.ts +2 -2
- package/src/index.ts +1 -1
- package/src/types/IEbsiSupport.ts +2 -1
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
|
-
"
|
|
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,
|
|
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 =
|
|
2320
|
+
const allMatches = {};
|
|
2321
2321
|
let arrayMatches;
|
|
2322
2322
|
if (Array.isArray(allMatches)) {
|
|
2323
2323
|
arrayMatches = allMatches;
|
|
@@ -2334,10 +2334,14 @@ var ebsiCreateAttestationAuthRequestURL = /* @__PURE__ */ __name(async ({ client
|
|
|
2334
2334
|
throw Error(`Could not find '${credentialType}' with format(s) '${formats.join(",")}' in list of supported types for issuer: ${credentialIssuer}`);
|
|
2335
2335
|
}
|
|
2336
2336
|
const authorizationDetails = supportedConfigurations.map((supported) => {
|
|
2337
|
+
const credential_configuration_id = supported.id;
|
|
2338
|
+
if (!credential_configuration_id) {
|
|
2339
|
+
throw Error(`Credential configuration id missing for credential type: ${credentialType}`);
|
|
2340
|
+
}
|
|
2337
2341
|
return {
|
|
2338
2342
|
type: "openid_credential",
|
|
2339
|
-
|
|
2340
|
-
|
|
2343
|
+
credential_configuration_id,
|
|
2344
|
+
credential_identifiers: getTypesFromCredentialSupported(supported)
|
|
2341
2345
|
};
|
|
2342
2346
|
});
|
|
2343
2347
|
const signCallbacks = requestObjectOpts.signCallbacks ?? {
|
|
@@ -2537,6 +2541,24 @@ var ebsiWaitTillDocumentAnchored = /* @__PURE__ */ __name(async (args) => {
|
|
|
2537
2541
|
count
|
|
2538
2542
|
};
|
|
2539
2543
|
}, "ebsiWaitTillDocumentAnchored");
|
|
2544
|
+
var ebsiListDidDocuments = /* @__PURE__ */ __name(async (args) => {
|
|
2545
|
+
const { params, apiOpts } = args;
|
|
2546
|
+
const { offset, size, controller } = params;
|
|
2547
|
+
const queryParams = [];
|
|
2548
|
+
if (offset) {
|
|
2549
|
+
queryParams.push(`page[after]=${offset}`);
|
|
2550
|
+
}
|
|
2551
|
+
if (size) {
|
|
2552
|
+
queryParams.push(`page[size]=${size}`);
|
|
2553
|
+
}
|
|
2554
|
+
if (controller) {
|
|
2555
|
+
queryParams.push(`controller=${controller}`);
|
|
2556
|
+
}
|
|
2557
|
+
const query = `?${queryParams.filter(Boolean).join("&")}`;
|
|
2558
|
+
return await (await fetch2(`${ebsiGetRegistryAPIUrls({
|
|
2559
|
+
...apiOpts
|
|
2560
|
+
}).query}/${query}`)).json();
|
|
2561
|
+
}, "ebsiListDidDocuments");
|
|
2540
2562
|
|
|
2541
2563
|
// src/did/services/EbsiRPCService.ts
|
|
2542
2564
|
import fetch3 from "cross-fetch";
|
|
@@ -2555,12 +2577,12 @@ var EBSI_DID_SPEC_INFOS = {
|
|
|
2555
2577
|
method: "did:key:"
|
|
2556
2578
|
}
|
|
2557
2579
|
};
|
|
2558
|
-
var EbsiPublicKeyPurpose = /* @__PURE__ */ function(EbsiPublicKeyPurpose2) {
|
|
2580
|
+
var EbsiPublicKeyPurpose = /* @__PURE__ */ (function(EbsiPublicKeyPurpose2) {
|
|
2559
2581
|
EbsiPublicKeyPurpose2["Authentication"] = "authentication";
|
|
2560
2582
|
EbsiPublicKeyPurpose2["AssertionMethod"] = "assertionMethod";
|
|
2561
2583
|
EbsiPublicKeyPurpose2["CapabilityInvocation"] = "capabilityInvocation";
|
|
2562
2584
|
return EbsiPublicKeyPurpose2;
|
|
2563
|
-
}({});
|
|
2585
|
+
})({});
|
|
2564
2586
|
var JSON_RPC_VERSION = "2.0";
|
|
2565
2587
|
var BASE_CONTEXT_DOC = JSON.stringify({
|
|
2566
2588
|
"@context": [
|
|
@@ -2568,7 +2590,7 @@ var BASE_CONTEXT_DOC = JSON.stringify({
|
|
|
2568
2590
|
"https://w3id.org/security/suites/jws-2020/v1"
|
|
2569
2591
|
]
|
|
2570
2592
|
});
|
|
2571
|
-
var EbsiRpcMethod = /* @__PURE__ */ function(EbsiRpcMethod2) {
|
|
2593
|
+
var EbsiRpcMethod = /* @__PURE__ */ (function(EbsiRpcMethod2) {
|
|
2572
2594
|
EbsiRpcMethod2["INSERT_DID_DOCUMENT"] = "insertDidDocument";
|
|
2573
2595
|
EbsiRpcMethod2["UPDATE_DID_DOCUMENT"] = "updateBaseDocument";
|
|
2574
2596
|
EbsiRpcMethod2["ADD_VERIFICATION_METHOD"] = "addVerificationMethod";
|
|
@@ -2576,7 +2598,7 @@ var EbsiRpcMethod = /* @__PURE__ */ function(EbsiRpcMethod2) {
|
|
|
2576
2598
|
EbsiRpcMethod2["ADD_SERVICE"] = "addService";
|
|
2577
2599
|
EbsiRpcMethod2["SEND_SIGNED_TRANSACTION"] = "sendSignedTransaction";
|
|
2578
2600
|
return EbsiRpcMethod2;
|
|
2579
|
-
}({});
|
|
2601
|
+
})({});
|
|
2580
2602
|
|
|
2581
2603
|
// src/did/services/EbsiRPCService.ts
|
|
2582
2604
|
var callRpcMethod = /* @__PURE__ */ __name(async (args) => {
|
|
@@ -2694,6 +2716,14 @@ var ebsiGetIssuerMock = /* @__PURE__ */ __name((args) => {
|
|
|
2694
2716
|
system: environment
|
|
2695
2717
|
})}/issuer-mock`;
|
|
2696
2718
|
}, "ebsiGetIssuerMock");
|
|
2719
|
+
var ebsiGetAuthorisationServer = /* @__PURE__ */ __name((args) => {
|
|
2720
|
+
const { environment = "pilot", version = "v4" } = args;
|
|
2721
|
+
return `${getEbsiApiBaseUrl({
|
|
2722
|
+
environment,
|
|
2723
|
+
version,
|
|
2724
|
+
system: "authorisation"
|
|
2725
|
+
})}`;
|
|
2726
|
+
}, "ebsiGetAuthorisationServer");
|
|
2697
2727
|
var ebsiGetRegistryAPIUrls = /* @__PURE__ */ __name((args) => {
|
|
2698
2728
|
const { environment = "pilot", version = "v5" } = args;
|
|
2699
2729
|
const baseUrl = `${getEbsiApiBaseUrl({
|
|
@@ -2807,7 +2837,7 @@ var toMinimalImportableKey = /* @__PURE__ */ __name(async (args) => {
|
|
|
2807
2837
|
minimalImportableKey.meta = {
|
|
2808
2838
|
purposes: assertedPurposes({
|
|
2809
2839
|
key
|
|
2810
|
-
}) ??
|
|
2840
|
+
}) ?? setPurposes({
|
|
2811
2841
|
key,
|
|
2812
2842
|
type
|
|
2813
2843
|
}),
|
|
@@ -2843,7 +2873,7 @@ var assertedPurposes = /* @__PURE__ */ __name((args) => {
|
|
|
2843
2873
|
}
|
|
2844
2874
|
return key?.purposes;
|
|
2845
2875
|
}, "assertedPurposes");
|
|
2846
|
-
var
|
|
2876
|
+
var setPurposes = /* @__PURE__ */ __name((args) => {
|
|
2847
2877
|
const { key, type } = args;
|
|
2848
2878
|
if (!key?.purposes || key.purposes.length === 0) {
|
|
2849
2879
|
switch (type) {
|
|
@@ -2861,7 +2891,7 @@ var setDefaultPurposes = /* @__PURE__ */ __name((args) => {
|
|
|
2861
2891
|
}
|
|
2862
2892
|
}
|
|
2863
2893
|
return key.purposes;
|
|
2864
|
-
}, "
|
|
2894
|
+
}, "setPurposes");
|
|
2865
2895
|
var randomRpcId = /* @__PURE__ */ __name(() => {
|
|
2866
2896
|
return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER);
|
|
2867
2897
|
}, "randomRpcId");
|
|
@@ -3095,7 +3125,6 @@ var ebsiCreateDidOnLedger = /* @__PURE__ */ __name(async (args, context) => {
|
|
|
3095
3125
|
|
|
3096
3126
|
// src/agent/EbsiSupport.ts
|
|
3097
3127
|
import { v4 } from "uuid";
|
|
3098
|
-
import { CheckLinkedDomain } from "@sphereon/did-auth-siop-adapter";
|
|
3099
3128
|
import { defaultHasher } from "@sphereon/ssi-sdk.core";
|
|
3100
3129
|
var ebsiSupportMethods = [
|
|
3101
3130
|
"ebsiCreateDidOnLedger",
|
|
@@ -3187,15 +3216,15 @@ var EbsiSupport = class {
|
|
|
3187
3216
|
let attestationCredential = args.attestationCredential;
|
|
3188
3217
|
if (hasInputDescriptors && !attestationCredential) {
|
|
3189
3218
|
if (allVerifiableCredentials && allVerifiableCredentials.length > 0) {
|
|
3190
|
-
const
|
|
3219
|
+
const pexResult = await context.agent.pexDefinitionFilterCredentials({
|
|
3191
3220
|
presentationDefinition: definitionResponse,
|
|
3192
3221
|
credentialFilterOpts: {
|
|
3193
3222
|
credentialRole: args.credentialRole,
|
|
3194
3223
|
verifiableCredentials: allVerifiableCredentials
|
|
3195
3224
|
}
|
|
3196
3225
|
});
|
|
3197
|
-
if (
|
|
3198
|
-
const filtered =
|
|
3226
|
+
if (pexResult.filteredCredentials.length > 0) {
|
|
3227
|
+
const filtered = pexResult.filteredCredentials.map((cred) => CredentialMapper.toUniformCredential(cred, {
|
|
3199
3228
|
hasher: defaultHasher
|
|
3200
3229
|
})).filter((cred) => {
|
|
3201
3230
|
if (!cred.expirationDate) {
|
|
@@ -3240,57 +3269,7 @@ var EbsiSupport = class {
|
|
|
3240
3269
|
attestationCredential = attestationResult.credentials[0].rawVerifiableCredential;
|
|
3241
3270
|
}
|
|
3242
3271
|
}
|
|
3243
|
-
const
|
|
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 : {
|
|
3272
|
+
const presentationSubmission = {
|
|
3294
3273
|
id: v4(),
|
|
3295
3274
|
definition_id: definitionResponse.id,
|
|
3296
3275
|
descriptor_map: []
|
|
@@ -3298,7 +3277,8 @@ var EbsiSupport = class {
|
|
|
3298
3277
|
console.log(`Presentation submission`, presentationSubmission);
|
|
3299
3278
|
const tokenRequestArgs = {
|
|
3300
3279
|
grant_type: "vp_token",
|
|
3301
|
-
|
|
3280
|
+
// FIXME SSISDK-40
|
|
3281
|
+
vp_token: "",
|
|
3302
3282
|
scope,
|
|
3303
3283
|
presentation_submission: presentationSubmission,
|
|
3304
3284
|
apiOpts: {
|
|
@@ -3347,10 +3327,10 @@ ${JSON.stringify(accessTokenResponse)}`);
|
|
|
3347
3327
|
};
|
|
3348
3328
|
|
|
3349
3329
|
// src/types/IEbsiSupport.ts
|
|
3350
|
-
var TokenType = /* @__PURE__ */ function(TokenType2) {
|
|
3330
|
+
var TokenType = /* @__PURE__ */ (function(TokenType2) {
|
|
3351
3331
|
TokenType2["BEARER"] = "Bearer";
|
|
3352
3332
|
return TokenType2;
|
|
3353
|
-
}({});
|
|
3333
|
+
})({});
|
|
3354
3334
|
|
|
3355
3335
|
// src/did/EbsiDidProvider.ts
|
|
3356
3336
|
import { getControllerKey as getControllerKey2, getEthereumAddressFromKey as getEthereumAddressFromKey2 } from "@sphereon/ssi-sdk-ext.did-utils";
|
|
@@ -3561,6 +3541,18 @@ var EbsiDidProvider = class _EbsiDidProvider extends AbstractIdentifierProvider
|
|
|
3561
3541
|
// src/did/EbsiDidResolver.ts
|
|
3562
3542
|
import { Resolver } from "did-resolver";
|
|
3563
3543
|
import { getResolver } from "@sphereon/ssi-sdk-ext.did-resolver-ebsi";
|
|
3544
|
+
var resolveDidEbsi = /* @__PURE__ */ __name(async (didUrl, _parsed, _resolver, options) => {
|
|
3545
|
+
const resolver = new Resolver({
|
|
3546
|
+
...getResolver()
|
|
3547
|
+
});
|
|
3548
|
+
return resolver.resolve(didUrl, options);
|
|
3549
|
+
}, "resolveDidEbsi");
|
|
3550
|
+
function getDidEbsiResolver() {
|
|
3551
|
+
return {
|
|
3552
|
+
key: resolveDidEbsi
|
|
3553
|
+
};
|
|
3554
|
+
}
|
|
3555
|
+
__name(getDidEbsiResolver, "getDidEbsiResolver");
|
|
3564
3556
|
|
|
3565
3557
|
// src/index.ts
|
|
3566
3558
|
var logger = Loggers.DEFAULT.options("sphereon:ebsi-support", {
|
|
@@ -3572,11 +3564,34 @@ var logger = Loggers.DEFAULT.options("sphereon:ebsi-support", {
|
|
|
3572
3564
|
}).get("sphereon:ebsi-support");
|
|
3573
3565
|
var schema = require_plugin_schema();
|
|
3574
3566
|
export {
|
|
3567
|
+
BASE_CONTEXT_DOC,
|
|
3568
|
+
EBSI_DID_SPEC_INFOS,
|
|
3575
3569
|
EbsiDidProvider,
|
|
3570
|
+
EbsiPublicKeyPurpose,
|
|
3571
|
+
EbsiRpcMethod,
|
|
3576
3572
|
EbsiSupport,
|
|
3573
|
+
JSON_RPC_VERSION,
|
|
3577
3574
|
TokenType,
|
|
3575
|
+
assertedPurposes,
|
|
3576
|
+
determineWellknownEndpoint,
|
|
3577
|
+
ebsiCreateDidOnLedger,
|
|
3578
|
+
ebsiGenerateOrUseKeyPair,
|
|
3579
|
+
ebsiGetAuthorisationServer,
|
|
3580
|
+
ebsiGetDidDocument,
|
|
3581
|
+
ebsiGetIssuerMock,
|
|
3582
|
+
ebsiGetRegistryAPIUrls,
|
|
3583
|
+
ebsiListDidDocuments,
|
|
3584
|
+
ebsiSignAndSendTransaction,
|
|
3578
3585
|
ebsiSupportMethods,
|
|
3586
|
+
ebsiWaitTillDocumentAnchored,
|
|
3587
|
+
formatEbsiPublicKey,
|
|
3588
|
+
generateEbsiMethodSpecificId,
|
|
3589
|
+
generateOrUseProvidedEbsiPrivateKeyHex,
|
|
3590
|
+
getDidEbsiResolver,
|
|
3579
3591
|
logger,
|
|
3580
|
-
|
|
3592
|
+
randomRpcId,
|
|
3593
|
+
schema,
|
|
3594
|
+
setPurposes,
|
|
3595
|
+
toMinimalImportableKey
|
|
3581
3596
|
};
|
|
3582
3597
|
//# sourceMappingURL=index.js.map
|