@sphereon/ssi-sdk.siopv2-oid4vp-op-auth 0.34.1-feature.SSISDK.57.uni.client.206 → 0.34.1-feature.SSISDK.58.host.nonce.endpoint.145
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 +30 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/package.json +22 -22
- package/src/agent/DidAuthSiopOpAuthenticator.ts +1 -1
- package/src/services/Siopv2MachineService.ts +12 -15
- package/src/session/functions.ts +8 -1
- package/src/utils/CredentialUtils.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -423,9 +423,9 @@ var plugin_schema_default = {
|
|
|
423
423
|
};
|
|
424
424
|
|
|
425
425
|
// src/agent/DidAuthSiopOpAuthenticator.ts
|
|
426
|
-
var
|
|
426
|
+
var import_did_auth_siop5 = require("@sphereon/did-auth-siop");
|
|
427
427
|
var import_ssi_sdk6 = require("@sphereon/ssi-sdk.data-store");
|
|
428
|
-
var
|
|
428
|
+
var import_ssi_types8 = require("@sphereon/ssi-types");
|
|
429
429
|
var import_uuid2 = require("uuid");
|
|
430
430
|
|
|
431
431
|
// src/session/functions.ts
|
|
@@ -451,8 +451,10 @@ __name(createOID4VPPresentationSignCallback, "createOID4VPPresentationSignCallba
|
|
|
451
451
|
async function createOPBuilder({ opOptions, idOpts: idOpts1, context }) {
|
|
452
452
|
const eventEmitter = opOptions.eventEmitter ?? new import_events.EventEmitter();
|
|
453
453
|
const builder = import_did_auth_siop.OP.builder().withResponseMode(opOptions.responseMode ?? import_did_auth_siop.ResponseMode.DIRECT_POST).withSupportedVersions(opOptions.supportedVersions ?? [
|
|
454
|
-
import_did_auth_siop.SupportedVersion.
|
|
455
|
-
import_did_auth_siop.SupportedVersion.
|
|
454
|
+
import_did_auth_siop.SupportedVersion.SIOPv2_ID1,
|
|
455
|
+
import_did_auth_siop.SupportedVersion.JWT_VC_PRESENTATION_PROFILE_v1,
|
|
456
|
+
import_did_auth_siop.SupportedVersion.SIOPv2_D11,
|
|
457
|
+
import_did_auth_siop.SupportedVersion.SIOPv2_D12_OID4VP_D18
|
|
456
458
|
]).withExpiresIn(opOptions.expiresIn ?? 300).withEventEmitter(eventEmitter).withRegistration({
|
|
457
459
|
passBy: import_did_auth_siop.PassBy.VALUE
|
|
458
460
|
});
|
|
@@ -1344,12 +1346,13 @@ var Siopv2Machine = class {
|
|
|
1344
1346
|
};
|
|
1345
1347
|
|
|
1346
1348
|
// src/services/Siopv2MachineService.ts
|
|
1347
|
-
var
|
|
1348
|
-
var
|
|
1349
|
-
var import_ssi_sdk3 = require("@sphereon/ssi-sdk.
|
|
1350
|
-
var import_ssi_sdk4 = require("@sphereon/ssi-sdk.
|
|
1351
|
-
var import_ssi_sdk5 = require("@sphereon/ssi-sdk.data-store");
|
|
1349
|
+
var import_did_auth_siop4 = require("@sphereon/did-auth-siop");
|
|
1350
|
+
var import_ssi_sdk_ext3 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
|
|
1351
|
+
var import_ssi_sdk3 = require("@sphereon/ssi-sdk.credential-store");
|
|
1352
|
+
var import_ssi_sdk4 = require("@sphereon/ssi-sdk.data-store");
|
|
1352
1353
|
var import_ssi_types6 = require("@sphereon/ssi-types");
|
|
1354
|
+
var import_ssi_types7 = require("@sphereon/ssi-types");
|
|
1355
|
+
var import_ssi_sdk5 = require("@sphereon/ssi-sdk.core");
|
|
1353
1356
|
var import_dcql = require("dcql");
|
|
1354
1357
|
|
|
1355
1358
|
// src/utils/dcql.ts
|
|
@@ -1390,11 +1393,12 @@ function convertToDcqlCredentials(credential, hasher) {
|
|
|
1390
1393
|
__name(convertToDcqlCredentials, "convertToDcqlCredentials");
|
|
1391
1394
|
|
|
1392
1395
|
// src/services/Siopv2MachineService.ts
|
|
1393
|
-
var
|
|
1396
|
+
var import_ssi_sdk_ext4 = require("@sphereon/ssi-sdk-ext.did-utils");
|
|
1397
|
+
var logger3 = import_ssi_types7.Loggers.DEFAULT.get(LOGGER_NAMESPACE);
|
|
1394
1398
|
var siopSendAuthorizationResponse = /* @__PURE__ */ __name(async (connectionType, args, context) => {
|
|
1395
1399
|
const { agent } = context;
|
|
1396
1400
|
const { credentials } = args;
|
|
1397
|
-
if (connectionType !==
|
|
1401
|
+
if (connectionType !== import_ssi_sdk4.ConnectionType.SIOPv2_OpenID4VP) {
|
|
1398
1402
|
return Promise.reject(Error(`No supported authentication provider for type: ${connectionType}`));
|
|
1399
1403
|
}
|
|
1400
1404
|
const session = await agent.siopGetOPSession({
|
|
@@ -1404,7 +1408,7 @@ var siopSendAuthorizationResponse = /* @__PURE__ */ __name(async (connectionType
|
|
|
1404
1408
|
const aud = request.authorizationRequest.getMergedProperty("aud");
|
|
1405
1409
|
logger3.debug(`AUD: ${aud}`);
|
|
1406
1410
|
logger3.debug(JSON.stringify(request.authorizationRequest));
|
|
1407
|
-
const domain = await request.authorizationRequest.getMergedProperty("client_id") ?? request.issuer ?? "https://self-issued.me/v2";
|
|
1411
|
+
const domain = await request.authorizationRequest.getMergedProperty("client_id") ?? request.issuer ?? (request.versions.includes(import_did_auth_siop4.SupportedVersion.JWT_VC_PRESENTATION_PROFILE_v1) ? "https://self-issued.me/v2/openid-vc" : "https://self-issued.me/v2");
|
|
1408
1412
|
logger3.debug(`NONCE: ${session.nonce}, domain: ${domain}`);
|
|
1409
1413
|
const firstUniqueDC = credentials[0];
|
|
1410
1414
|
if (typeof firstUniqueDC !== "object" || !("digitalCredential" in firstUniqueDC)) {
|
|
@@ -1413,9 +1417,9 @@ var siopSendAuthorizationResponse = /* @__PURE__ */ __name(async (connectionType
|
|
|
1413
1417
|
let identifier;
|
|
1414
1418
|
const digitalCredential = firstUniqueDC.digitalCredential;
|
|
1415
1419
|
const firstVC = firstUniqueDC.uniformVerifiableCredential;
|
|
1416
|
-
const holder =
|
|
1420
|
+
const holder = import_ssi_types7.CredentialMapper.isSdJwtDecodedCredential(firstVC) ? firstVC.decodedPayload.cnf?.jwk ? (
|
|
1417
1421
|
//doesn't apply to did:jwk only, as you can represent any DID key as a JWK. So whenever you encounter a JWK it doesn't mean it had to come from a did:jwk in the system. It just can always be represented as a did:jwk
|
|
1418
|
-
`did:jwk:${(0,
|
|
1422
|
+
`did:jwk:${(0, import_ssi_sdk5.encodeJoseBlob)(firstVC.decodedPayload.cnf?.jwk)}#0`
|
|
1419
1423
|
) : firstVC.decodedPayload.sub : Array.isArray(firstVC.credentialSubject) ? firstVC.credentialSubject[0].id : firstVC.credentialSubject.id;
|
|
1420
1424
|
if (!digitalCredential.kmsKeyRef) {
|
|
1421
1425
|
if (!holder) {
|
|
@@ -1429,7 +1433,7 @@ var siopSendAuthorizationResponse = /* @__PURE__ */ __name(async (connectionType
|
|
|
1429
1433
|
logger3.debug(`Holder DID not found: ${holder}`);
|
|
1430
1434
|
throw e;
|
|
1431
1435
|
}
|
|
1432
|
-
} else if ((0,
|
|
1436
|
+
} else if ((0, import_ssi_sdk_ext3.isOID4VCIssuerIdentifier)(digitalCredential.kmsKeyRef)) {
|
|
1433
1437
|
identifier = await session.context.agent.identifierManagedGetByOID4VCIssuer({
|
|
1434
1438
|
identifier: firstUniqueDC.digitalCredential.kmsKeyRef
|
|
1435
1439
|
});
|
|
@@ -1495,7 +1499,7 @@ var getSelectableCredentials = /* @__PURE__ */ __name(async (dcqlQuery, context)
|
|
|
1495
1499
|
};
|
|
1496
1500
|
const { agent } = agentContext;
|
|
1497
1501
|
const uniqueVerifiableCredentials = await agent.crsGetUniqueCredentials({
|
|
1498
|
-
filter: (0,
|
|
1502
|
+
filter: (0, import_ssi_sdk3.verifiableCredentialForRoleFilter)(import_ssi_types6.CredentialRole.HOLDER)
|
|
1499
1503
|
});
|
|
1500
1504
|
const branding = await agent.ibGetCredentialBranding();
|
|
1501
1505
|
const dcqlCredentialsWithCredentials = new Map(uniqueVerifiableCredentials.map((vc) => [
|
|
@@ -1566,7 +1570,7 @@ var translateCorrelationIdToName = /* @__PURE__ */ __name(async (correlationId,
|
|
|
1566
1570
|
}, "translateCorrelationIdToName");
|
|
1567
1571
|
|
|
1568
1572
|
// src/agent/DidAuthSiopOpAuthenticator.ts
|
|
1569
|
-
var logger4 =
|
|
1573
|
+
var logger4 = import_ssi_types8.Loggers.DEFAULT.options(LOGGER_NAMESPACE, {}).get(LOGGER_NAMESPACE);
|
|
1570
1574
|
var didAuthSiopOpAuthenticatorMethods = [
|
|
1571
1575
|
"cmGetContacts",
|
|
1572
1576
|
"cmGetContact",
|
|
@@ -1724,7 +1728,7 @@ var DidAuthSiopOpAuthenticator = class {
|
|
|
1724
1728
|
const verifiedAuthorizationRequest = await session.getAuthorizationRequest();
|
|
1725
1729
|
const clientName = verifiedAuthorizationRequest.registrationMetadataPayload?.client_name;
|
|
1726
1730
|
const url = verifiedAuthorizationRequest.responseURI ?? (args.url.includes("request_uri") ? decodeURIComponent(args.url.split("?request_uri=")[1].trim()) : verifiedAuthorizationRequest.issuer ?? verifiedAuthorizationRequest.registrationMetadataPayload?.client_id);
|
|
1727
|
-
const uri = url
|
|
1731
|
+
const uri = url.includes("://") ? new URL(url) : void 0;
|
|
1728
1732
|
const correlationId = uri?.hostname ?? await this.determineCorrelationId(uri, verifiedAuthorizationRequest, clientName, context);
|
|
1729
1733
|
const clientId = verifiedAuthorizationRequest.authorizationRequest.getMergedProperty("client_id");
|
|
1730
1734
|
return {
|
|
@@ -1784,7 +1788,7 @@ var DidAuthSiopOpAuthenticator = class {
|
|
|
1784
1788
|
alias: correlationId,
|
|
1785
1789
|
origin: import_ssi_sdk6.IdentityOrigin.EXTERNAL,
|
|
1786
1790
|
roles: [
|
|
1787
|
-
|
|
1791
|
+
import_ssi_types8.CredentialRole.ISSUER
|
|
1788
1792
|
],
|
|
1789
1793
|
identifier: {
|
|
1790
1794
|
type: correlationId.startsWith("did:") ? import_ssi_sdk6.CorrelationIdentifierType.DID : import_ssi_sdk6.CorrelationIdentifierType.URL,
|
|
@@ -1828,7 +1832,7 @@ var DidAuthSiopOpAuthenticator = class {
|
|
|
1828
1832
|
return {
|
|
1829
1833
|
body: responseBody,
|
|
1830
1834
|
url: response?.url,
|
|
1831
|
-
queryParams: (0,
|
|
1835
|
+
queryParams: (0, import_did_auth_siop5.decodeUriAsJson)(response?.url)
|
|
1832
1836
|
};
|
|
1833
1837
|
}
|
|
1834
1838
|
async siopGetSelectableCredentials(args, context) {
|
|
@@ -1841,11 +1845,11 @@ var DidAuthSiopOpAuthenticator = class {
|
|
|
1841
1845
|
};
|
|
1842
1846
|
|
|
1843
1847
|
// src/machine/CallbackStateListener.ts
|
|
1844
|
-
var
|
|
1845
|
-
var logger5 =
|
|
1846
|
-
defaultLogLevel:
|
|
1848
|
+
var import_ssi_types9 = require("@sphereon/ssi-types");
|
|
1849
|
+
var logger5 = import_ssi_types9.Loggers.DEFAULT.options("sphereon:siopv2-oid4vp:op-auth", {
|
|
1850
|
+
defaultLogLevel: import_ssi_types9.LogLevel.DEBUG,
|
|
1847
1851
|
methods: [
|
|
1848
|
-
|
|
1852
|
+
import_ssi_types9.LogMethod.CONSOLE
|
|
1849
1853
|
]
|
|
1850
1854
|
}).get("sphereon:siopv2-oid4vp:op-auth");
|
|
1851
1855
|
var OID4VPCallbackStateListener = /* @__PURE__ */ __name((callbacks) => {
|
|
@@ -1878,8 +1882,8 @@ var OID4VPCallbackStateListener = /* @__PURE__ */ __name((callbacks) => {
|
|
|
1878
1882
|
var import_ssi_sdk7 = require("@sphereon/ssi-sdk.agent-config");
|
|
1879
1883
|
var import_ssi_sdk8 = require("@sphereon/ssi-sdk.core");
|
|
1880
1884
|
var import_ssi_sdk9 = require("@sphereon/ssi-sdk.xstate-machine-persistence");
|
|
1881
|
-
var
|
|
1882
|
-
var logger6 =
|
|
1885
|
+
var import_ssi_types10 = require("@sphereon/ssi-types");
|
|
1886
|
+
var logger6 = import_ssi_types10.Loggers.DEFAULT.options(LOGGER_NAMESPACE, {}).get(LOGGER_NAMESPACE);
|
|
1883
1887
|
var Siopv2OID4VPLinkHandler = class extends import_ssi_sdk8.LinkHandlerAdapter {
|
|
1884
1888
|
static {
|
|
1885
1889
|
__name(this, "Siopv2OID4VPLinkHandler");
|