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