@sphereon/ssi-sdk.siopv2-oid4vp-op-auth 0.33.0 → 0.33.1-feature.vcdm2.4
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/agent/DidAuthSiopOpAuthenticator.js +319 -340
- package/dist/agent/DidAuthSiopOpAuthenticator.js.map +1 -1
- package/dist/index.js +7 -27
- package/dist/index.js.map +1 -1
- package/dist/link-handler/index.js +35 -47
- package/dist/link-handler/index.js.map +1 -1
- package/dist/localization/Localization.js +38 -43
- package/dist/localization/Localization.js.map +1 -1
- package/dist/machine/CallbackStateListener.js +9 -22
- package/dist/machine/CallbackStateListener.js.map +1 -1
- package/dist/machine/Siopv2Machine.js +129 -131
- package/dist/machine/Siopv2Machine.js.map +1 -1
- package/dist/services/IdentifierService.js +11 -24
- package/dist/services/IdentifierService.js.map +1 -1
- package/dist/services/Siopv2MachineService.js +117 -120
- package/dist/services/Siopv2MachineService.js.map +1 -1
- package/dist/session/OID4VP.js +184 -195
- package/dist/session/OID4VP.js.map +1 -1
- package/dist/session/OpSession.js +252 -288
- package/dist/session/OpSession.js.map +1 -1
- package/dist/session/functions.js +95 -111
- package/dist/session/functions.js.map +1 -1
- package/dist/session/index.js +3 -19
- package/dist/session/index.js.map +1 -1
- package/dist/types/IDidAuthSiopOpAuthenticator.js +4 -7
- package/dist/types/IDidAuthSiopOpAuthenticator.js.map +1 -1
- package/dist/types/error/index.js +1 -2
- package/dist/types/identifier/index.js +1 -4
- package/dist/types/identifier/index.js.map +1 -1
- package/dist/types/index.js +5 -21
- package/dist/types/index.js.map +1 -1
- package/dist/types/machine/index.js +10 -13
- package/dist/types/machine/index.js.map +1 -1
- package/dist/types/siop-service/index.js +4 -7
- package/dist/types/siop-service/index.js.map +1 -1
- package/dist/utils/CredentialUtils.js +18 -28
- package/dist/utils/CredentialUtils.js.map +1 -1
- package/dist/utils/dcql.js +6 -9
- package/dist/utils/dcql.js.map +1 -1
- package/package.json +15 -15
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isUniqueDigitalCredential = exports.getOriginalVerifiableCredential = exports.getMatchingUniqueDigitalCredential = exports.getCredentialTypeAsString = void 0;
|
|
4
|
-
const ssi_types_1 = require("@sphereon/ssi-types");
|
|
1
|
+
import { CredentialMapper } from '@sphereon/ssi-types';
|
|
5
2
|
/**
|
|
6
3
|
* Return the type(s) of a VC minus the VerifiableCredential type which should always be present
|
|
7
4
|
* @param credential The input credential
|
|
8
5
|
*/
|
|
9
|
-
const getCredentialTypeAsString = (credential) => {
|
|
6
|
+
export const getCredentialTypeAsString = (credential) => {
|
|
10
7
|
if (!credential.type) {
|
|
11
8
|
return 'Verifiable Credential';
|
|
12
9
|
}
|
|
@@ -15,35 +12,30 @@ const getCredentialTypeAsString = (credential) => {
|
|
|
15
12
|
}
|
|
16
13
|
return credential.type.filter((type) => type !== 'VerifiableCredential').join(', ');
|
|
17
14
|
};
|
|
18
|
-
exports.getCredentialTypeAsString = getCredentialTypeAsString;
|
|
19
15
|
/**
|
|
20
16
|
* Returns a Unique Verifiable Credential (with hash) as stored in Veramo, based upon matching the id of the input VC or the proof value of the input VC
|
|
21
17
|
* @param uniqueVCs The Unique VCs to search in
|
|
22
18
|
* @param searchVC The VC to search for in the unique VCs array
|
|
23
19
|
*/
|
|
24
|
-
const getMatchingUniqueDigitalCredential = (uniqueVCs, searchVC) => {
|
|
20
|
+
export const getMatchingUniqueDigitalCredential = (uniqueVCs, searchVC) => {
|
|
25
21
|
// Since an ID is optional in a VC according to VCDM, and we really need the matches, we have a fallback match on something which is guaranteed to be unique for any VC (the proof(s))
|
|
26
|
-
return uniqueVCs.find((uniqueVC) =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
'jwt' in uniqueVC.uniformVerifiableCredential.proof &&
|
|
37
|
-
((_f = (_e = (_d = uniqueVC.uniformVerifiableCredential.proof.jwt) === null || _d === void 0 ? void 0 : _d.split('.')) === null || _e === void 0 ? void 0 : _e.slice(0, 2)) === null || _f === void 0 ? void 0 : _f.join('.')) === ((_h = (_g = searchVC.split('.')) === null || _g === void 0 ? void 0 : _g.slice(0, 2)) === null || _h === void 0 ? void 0 : _h.join('.')));
|
|
38
|
-
});
|
|
22
|
+
return uniqueVCs.find((uniqueVC) => (typeof searchVC !== 'string' &&
|
|
23
|
+
(uniqueVC.id === searchVC.id ||
|
|
24
|
+
uniqueVC.originalVerifiableCredential.proof === searchVC.proof)) ||
|
|
25
|
+
(typeof searchVC === 'string' && uniqueVC.uniformVerifiableCredential?.proof?.jwt === searchVC) ||
|
|
26
|
+
// We are ignoring the signature of the sd-jwt as PEX signs the vc again and it will not match anymore with the jwt in the proof of the stored jsonld vc
|
|
27
|
+
(typeof searchVC === 'string' &&
|
|
28
|
+
CredentialMapper.isSdJwtEncoded(searchVC) &&
|
|
29
|
+
uniqueVC.uniformVerifiableCredential?.proof &&
|
|
30
|
+
'jwt' in uniqueVC.uniformVerifiableCredential.proof &&
|
|
31
|
+
uniqueVC.uniformVerifiableCredential.proof.jwt?.split('.')?.slice(0, 2)?.join('.') === searchVC.split('.')?.slice(0, 2)?.join('.')));
|
|
39
32
|
};
|
|
40
|
-
exports.getMatchingUniqueDigitalCredential = getMatchingUniqueDigitalCredential;
|
|
41
33
|
/**
|
|
42
34
|
* Get an original verifiable credential. Maps to wrapped Verifiable Credential first, to get an original JWT as Veramo stores these with a special proof value
|
|
43
35
|
* @param credential The input VC
|
|
44
36
|
*/
|
|
45
|
-
const getOriginalVerifiableCredential = (credential) => {
|
|
46
|
-
if (
|
|
37
|
+
export const getOriginalVerifiableCredential = (credential) => {
|
|
38
|
+
if (isUniqueDigitalCredential(credential)) {
|
|
47
39
|
if (!credential.originalVerifiableCredential) {
|
|
48
40
|
throw new Error('originalVerifiableCredential is not defined in UniqueDigitalCredential');
|
|
49
41
|
}
|
|
@@ -51,15 +43,13 @@ const getOriginalVerifiableCredential = (credential) => {
|
|
|
51
43
|
}
|
|
52
44
|
return getCredentialFromProofOrWrapped(credential);
|
|
53
45
|
};
|
|
54
|
-
exports.getOriginalVerifiableCredential = getOriginalVerifiableCredential;
|
|
55
46
|
const getCredentialFromProofOrWrapped = (cred, hasher) => {
|
|
56
|
-
if (typeof cred === 'object' && 'proof' in cred && 'jwt' in cred.proof &&
|
|
47
|
+
if (typeof cred === 'object' && 'proof' in cred && 'jwt' in cred.proof && CredentialMapper.isSdJwtEncoded(cred.proof.jwt)) {
|
|
57
48
|
return cred.proof.jwt;
|
|
58
49
|
}
|
|
59
|
-
return
|
|
50
|
+
return CredentialMapper.toWrappedVerifiableCredential(cred, { hasher }).original;
|
|
60
51
|
};
|
|
61
|
-
const isUniqueDigitalCredential = (credential) => {
|
|
52
|
+
export const isUniqueDigitalCredential = (credential) => {
|
|
62
53
|
return credential.digitalCredential !== undefined;
|
|
63
54
|
};
|
|
64
|
-
exports.isUniqueDigitalCredential = isUniqueDigitalCredential;
|
|
65
55
|
//# sourceMappingURL=CredentialUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialUtils.js","sourceRoot":"","sources":["../../src/utils/CredentialUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CredentialUtils.js","sourceRoot":"","sources":["../../src/utils/CredentialUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAgF,MAAM,qBAAqB,CAAA;AAIpI;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,UAA8C,EAAU,EAAE;IAClG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACrB,OAAO,uBAAuB,CAAA;IAChC,CAAC;SAAM,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC/C,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IAAI,yBAAyB,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1C,IAAI,CAAC,UAAU,CAAC,4BAA4B,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAA;QAC3F,CAAC;QACD,OAAO,+BAA+B,CAAC,UAAU,CAAC,4BAA4B,CAAC,CAAA;IACjF,CAAC;IAED,OAAO,+BAA+B,CAAC,UAAU,CAAC,CAAA;AACpD,CAAC,CAAA;AAED,MAAM,+BAA+B,GAAG,CAAC,IAAS,EAAE,MAAmB,EAAgC,EAAE;IACvG,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,gBAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1H,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAA;IACvB,CAAC;IAED,OAAO,gBAAgB,CAAC,6BAA6B,CAAC,IAAoC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAA;AAClH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,UAA2B,EAAyC,EAAE;IAC9G,OAAQ,UAAsC,CAAC,iBAAiB,KAAK,SAAS,CAAA;AAChF,CAAC,CAAA"}
|
package/dist/utils/dcql.js
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const ssi_types_1 = require("@sphereon/ssi-types");
|
|
5
|
-
const CredentialUtils_1 = require("./CredentialUtils");
|
|
6
|
-
function convertToDcqlCredentials(credential, hasher) {
|
|
1
|
+
import { CredentialMapper } from '@sphereon/ssi-types';
|
|
2
|
+
import { isUniqueDigitalCredential } from './CredentialUtils';
|
|
3
|
+
export function convertToDcqlCredentials(credential, hasher) {
|
|
7
4
|
let payload;
|
|
8
|
-
if (
|
|
5
|
+
if (isUniqueDigitalCredential(credential)) {
|
|
9
6
|
if (!credential.originalVerifiableCredential) {
|
|
10
7
|
throw new Error('originalVerifiableCredential is not defined in UniqueDigitalCredential');
|
|
11
8
|
}
|
|
12
|
-
payload =
|
|
9
|
+
payload = CredentialMapper.decodeVerifiableCredential(credential.originalVerifiableCredential, hasher);
|
|
13
10
|
}
|
|
14
11
|
else {
|
|
15
|
-
payload =
|
|
12
|
+
payload = CredentialMapper.decodeVerifiableCredential(credential, hasher);
|
|
16
13
|
}
|
|
17
14
|
if (!payload) {
|
|
18
15
|
throw new Error('No payload found');
|
package/dist/utils/dcql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dcql.js","sourceRoot":"","sources":["../../src/utils/dcql.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dcql.js","sourceRoot":"","sources":["../../src/utils/dcql.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAA4C,MAAM,qBAAqB,CAAA;AAChG,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAE7D,MAAM,UAAU,wBAAwB,CAAC,UAAkE,EAAE,MAAmB;IAC9H,IAAI,OAAO,CAAA;IACX,IAAI,yBAAyB,CAAC,UAAU,CAAC,EAAE,CAAC;QAC1C,IAAI,CAAC,UAAU,CAAC,4BAA4B,EAAE,CAAC;YAC7C,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAA;QAC3F,CAAC;QACD,OAAO,GAAG,gBAAgB,CAAC,0BAA0B,CAAC,UAAU,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAA;IACxG,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,gBAAgB,CAAC,0BAA0B,CAAC,UAA0C,EAAE,MAAM,CAAC,CAAA;IAC3G,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;IACrC,CAAC;IAED,IAAI,gBAAgB,IAAI,OAAO,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;QAC1D,OAAO,GAAG,OAAO,CAAC,cAAc,CAAA;IAClC,CAAC;IAED,IAAI,KAAK,IAAI,OAAQ,EAAE,CAAC;QACtB,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAkC,CAAA,CAAC,0BAA0B;IACzI,CAAC;SAAM,IAAI,SAAS,IAAI,OAAQ,IAAI,YAAY,IAAI,OAAO,EAAE,CAAC;QAC5D,OAAO;QACP,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;IACtF,CAAC;SAAM,CAAC;QACN,OAAO;YACL,MAAM,EAAE,OAAO;YACf,iBAAiB,EAAE,aAAa,EAAE,8BAA8B;SAC1C,CAAA;IAC1B,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk.siopv2-oid4vp-op-auth",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"@sphereon/ssi-sdk-ext.did-utils": "0.28.0",
|
|
23
23
|
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.28.0",
|
|
24
24
|
"@sphereon/ssi-sdk-ext.jwt-service": "0.28.0",
|
|
25
|
-
"@sphereon/ssi-sdk.contact-manager": "0.33.
|
|
26
|
-
"@sphereon/ssi-sdk.core": "0.33.
|
|
27
|
-
"@sphereon/ssi-sdk.credential-store": "0.33.
|
|
28
|
-
"@sphereon/ssi-sdk.credential-validation": "0.33.
|
|
29
|
-
"@sphereon/ssi-sdk.data-store": "0.33.
|
|
30
|
-
"@sphereon/ssi-sdk.issuance-branding": "0.33.
|
|
31
|
-
"@sphereon/ssi-sdk.pd-manager": "0.33.
|
|
32
|
-
"@sphereon/ssi-sdk.presentation-exchange": "0.33.
|
|
33
|
-
"@sphereon/ssi-sdk.sd-jwt": "0.33.
|
|
34
|
-
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.33.
|
|
35
|
-
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.33.
|
|
36
|
-
"@sphereon/ssi-types": "0.33.
|
|
25
|
+
"@sphereon/ssi-sdk.contact-manager": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
26
|
+
"@sphereon/ssi-sdk.core": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
27
|
+
"@sphereon/ssi-sdk.credential-store": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
28
|
+
"@sphereon/ssi-sdk.credential-validation": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
29
|
+
"@sphereon/ssi-sdk.data-store": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
30
|
+
"@sphereon/ssi-sdk.issuance-branding": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
31
|
+
"@sphereon/ssi-sdk.pd-manager": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
32
|
+
"@sphereon/ssi-sdk.presentation-exchange": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
33
|
+
"@sphereon/ssi-sdk.sd-jwt": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
34
|
+
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
35
|
+
"@sphereon/ssi-sdk.xstate-machine-persistence": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
36
|
+
"@sphereon/ssi-types": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
37
37
|
"@sphereon/wellknown-dids-client": "^0.1.3",
|
|
38
38
|
"@veramo/core": "4.2.0",
|
|
39
39
|
"@veramo/credential-w3c": "4.2.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@sphereon/did-uni-client": "^0.6.3",
|
|
50
50
|
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.28.0",
|
|
51
|
-
"@sphereon/ssi-sdk.agent-config": "0.33.
|
|
51
|
+
"@sphereon/ssi-sdk.agent-config": "0.33.1-feature.vcdm2.4+9f634bdb",
|
|
52
52
|
"@types/i18n-js": "^3.8.9",
|
|
53
53
|
"@types/lodash.memoize": "^4.1.9",
|
|
54
54
|
"@types/sha.js": "^2.4.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"Authenticator"
|
|
92
92
|
],
|
|
93
93
|
"nx": {},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "9f634bdb714061141e277508c124b08d626f6036"
|
|
95
95
|
}
|