@sphereon/oid4vci-common 0.10.3 → 0.10.4-next.119
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/events/index.d.ts +17 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +21 -0
- package/dist/events/index.js.map +1 -0
- package/dist/experimental/holder-vci.d.ts +13 -0
- package/dist/experimental/holder-vci.d.ts.map +1 -0
- package/dist/experimental/holder-vci.js +9 -0
- package/dist/experimental/holder-vci.js.map +1 -0
- package/dist/functions/CredentialOfferUtil.d.ts +3 -3
- package/dist/functions/CredentialOfferUtil.d.ts.map +1 -1
- package/dist/functions/CredentialOfferUtil.js +71 -28
- package/dist/functions/CredentialOfferUtil.js.map +1 -1
- package/dist/functions/CredentialRequestUtil.d.ts +3 -3
- package/dist/functions/CredentialRequestUtil.d.ts.map +1 -1
- package/dist/functions/CredentialRequestUtil.js +13 -4
- package/dist/functions/CredentialRequestUtil.js.map +1 -1
- package/dist/functions/CredentialResponseUtil.d.ts +3 -1
- package/dist/functions/CredentialResponseUtil.d.ts.map +1 -1
- package/dist/functions/CredentialResponseUtil.js +1 -1
- package/dist/functions/CredentialResponseUtil.js.map +1 -1
- package/dist/functions/Encoding.d.ts +7 -6
- package/dist/functions/Encoding.d.ts.map +1 -1
- package/dist/functions/Encoding.js +9 -8
- package/dist/functions/Encoding.js.map +1 -1
- package/dist/functions/IssuerMetadataUtils.d.ts +19 -12
- package/dist/functions/IssuerMetadataUtils.d.ts.map +1 -1
- package/dist/functions/IssuerMetadataUtils.js +155 -88
- package/dist/functions/IssuerMetadataUtils.js.map +1 -1
- package/dist/functions/ProofUtil.d.ts +38 -0
- package/dist/functions/ProofUtil.d.ts.map +1 -0
- package/dist/functions/ProofUtil.js +141 -0
- package/dist/functions/ProofUtil.js.map +1 -0
- package/dist/functions/index.d.ts +1 -0
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/index.js +1 -0
- package/dist/functions/index.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/types/Authorization.types.d.ts +26 -4
- package/dist/types/Authorization.types.d.ts.map +1 -1
- package/dist/types/Authorization.types.js +7 -1
- package/dist/types/Authorization.types.js.map +1 -1
- package/dist/types/CredentialIssuance.types.d.ts +17 -10
- package/dist/types/CredentialIssuance.types.d.ts.map +1 -1
- package/dist/types/CredentialIssuance.types.js.map +1 -1
- package/dist/types/Generic.types.d.ts +104 -17
- package/dist/types/Generic.types.d.ts.map +1 -1
- package/dist/types/Generic.types.js.map +1 -1
- package/dist/types/OpenID4VCIErrors.d.ts +1 -0
- package/dist/types/OpenID4VCIErrors.d.ts.map +1 -1
- package/dist/types/OpenID4VCIErrors.js +2 -1
- package/dist/types/OpenID4VCIErrors.js.map +1 -1
- package/dist/types/OpenID4VCIVersions.types.d.ts +1 -0
- package/dist/types/OpenID4VCIVersions.types.d.ts.map +1 -1
- package/dist/types/OpenID4VCIVersions.types.js +1 -0
- package/dist/types/OpenID4VCIVersions.types.js.map +1 -1
- package/dist/types/ServerMetadata.d.ts +0 -7
- package/dist/types/ServerMetadata.d.ts.map +1 -1
- package/dist/types/ServerMetadata.js.map +1 -1
- package/dist/types/StateManager.types.d.ts +1 -0
- package/dist/types/StateManager.types.d.ts.map +1 -1
- package/dist/types/StateManager.types.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/v1_0_11.types.d.ts +35 -5
- package/dist/types/v1_0_11.types.d.ts.map +1 -1
- package/dist/types/v1_0_11.types.js.map +1 -1
- package/dist/types/v1_0_12.types.d.ts +30 -1
- package/dist/types/v1_0_12.types.d.ts.map +1 -1
- package/dist/types/v1_0_13.types.d.ts +120 -0
- package/dist/types/v1_0_13.types.d.ts.map +1 -0
- package/dist/types/v1_0_13.types.js +3 -0
- package/dist/types/v1_0_13.types.js.map +1 -0
- package/lib/__tests__/CredentialOfferUtil.spec.ts +25 -9
- package/lib/__tests__/IssuerMetadataUtils.spec.ts +38 -0
- package/lib/events/index.ts +20 -0
- package/lib/experimental/holder-vci.ts +19 -0
- package/lib/functions/CredentialOfferUtil.ts +78 -26
- package/lib/functions/CredentialRequestUtil.ts +23 -8
- package/lib/functions/CredentialResponseUtil.ts +4 -4
- package/lib/functions/Encoding.ts +10 -8
- package/lib/functions/IssuerMetadataUtils.ts +164 -93
- package/lib/functions/ProofUtil.ts +185 -0
- package/lib/functions/index.ts +1 -0
- package/lib/index.ts +7 -0
- package/lib/types/Authorization.types.ts +31 -4
- package/lib/types/CredentialIssuance.types.ts +26 -10
- package/lib/types/Generic.types.ts +150 -27
- package/lib/types/OpenID4VCIErrors.ts +1 -0
- package/lib/types/OpenID4VCIVersions.types.ts +1 -0
- package/lib/types/ServerMetadata.ts +0 -10
- package/lib/types/StateManager.types.ts +1 -0
- package/lib/types/index.ts +1 -0
- package/lib/types/v1_0_11.types.ts +41 -4
- package/lib/types/v1_0_12.types.ts +39 -1
- package/lib/types/v1_0_13.types.ts +158 -0
- package/package.json +3 -11
|
@@ -1,26 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CredentialDefinitionV1_0_13, CredentialOfferFormat, JsonLdIssuerCredentialDefinition } from '../index';
|
|
2
|
+
import { AuthorizationServerMetadata, CredentialConfigurationSupported, CredentialConfigurationSupportedV1_0_13, CredentialIssuerMetadata, CredentialSupportedTypeV1_0_08, CredentialSupportedV1_0_08, IssuerMetadata, MetadataDisplay, OID4VCICredentialFormat, OpenId4VCIVersion } from '../types';
|
|
2
3
|
export declare function getSupportedCredentials(opts?: {
|
|
3
|
-
issuerMetadata?: CredentialIssuerMetadata |
|
|
4
|
+
issuerMetadata?: CredentialIssuerMetadata | IssuerMetadata;
|
|
4
5
|
version: OpenId4VCIVersion;
|
|
5
6
|
types?: string[][];
|
|
6
|
-
format?:
|
|
7
|
-
}):
|
|
7
|
+
format?: OID4VCICredentialFormat | string | (OID4VCICredentialFormat | string)[];
|
|
8
|
+
}): Record<string, CredentialConfigurationSupportedV1_0_13> | Array<CredentialConfigurationSupported>;
|
|
9
|
+
export declare function determineVersionsFromIssuerMetadata(issuerMetadata: CredentialIssuerMetadata | IssuerMetadata): Array<OpenId4VCIVersion>;
|
|
8
10
|
export declare function getSupportedCredential(opts?: {
|
|
9
|
-
issuerMetadata?: CredentialIssuerMetadata |
|
|
11
|
+
issuerMetadata?: CredentialIssuerMetadata | IssuerMetadata;
|
|
10
12
|
version: OpenId4VCIVersion;
|
|
11
13
|
types?: string | string[];
|
|
12
|
-
format?:
|
|
13
|
-
}):
|
|
14
|
-
export declare function getTypesFromCredentialSupported(credentialSupported:
|
|
14
|
+
format?: OID4VCICredentialFormat | string | (OID4VCICredentialFormat | string)[];
|
|
15
|
+
}): Record<string, CredentialConfigurationSupportedV1_0_13> | Array<CredentialConfigurationSupported>;
|
|
16
|
+
export declare function getTypesFromCredentialSupported(credentialSupported: CredentialConfigurationSupported, opts?: {
|
|
15
17
|
filterVerifiableCredential: boolean;
|
|
16
18
|
}): string[];
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function getIssuerDisplays(metadata: CredentialIssuerMetadata |
|
|
19
|
+
export declare function credentialsSupportedV8ToV13(supportedV8: CredentialSupportedTypeV1_0_08): Record<string, CredentialConfigurationSupported>;
|
|
20
|
+
export declare function credentialSupportedV8ToV13(key: string, supportedV8: CredentialSupportedV1_0_08): Record<string, CredentialConfigurationSupported>;
|
|
21
|
+
export declare function getIssuerDisplays(metadata: CredentialIssuerMetadata | IssuerMetadata, opts?: {
|
|
20
22
|
prefLocales: string[];
|
|
21
23
|
}): MetadataDisplay[];
|
|
22
24
|
/**
|
|
23
25
|
* TODO check again when WAL-617 is done to replace how we get the issuer name.
|
|
24
26
|
*/
|
|
25
|
-
export declare function getIssuerName(url: string, credentialIssuerMetadata?: Partial<AuthorizationServerMetadata> & (CredentialIssuerMetadata |
|
|
27
|
+
export declare function getIssuerName(url: string, credentialIssuerMetadata?: Partial<AuthorizationServerMetadata> & (CredentialIssuerMetadata | IssuerMetadata)): string;
|
|
28
|
+
/**
|
|
29
|
+
* The specs had many places where types could be expressed. This method ensures we get them in any way possible
|
|
30
|
+
* @param subject
|
|
31
|
+
*/
|
|
32
|
+
export declare function getTypesFromObject(subject: CredentialConfigurationSupported | CredentialOfferFormat | CredentialDefinitionV1_0_13 | JsonLdIssuerCredentialDefinition | string): string[] | undefined;
|
|
26
33
|
//# sourceMappingURL=IssuerMetadataUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IssuerMetadataUtils.d.ts","sourceRoot":"","sources":["../../lib/functions/IssuerMetadataUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,
|
|
1
|
+
{"version":3,"file":"IssuerMetadataUtils.d.ts","sourceRoot":"","sources":["../../lib/functions/IssuerMetadataUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAE,gCAAgC,EAAkB,MAAM,UAAU,CAAC;AAChI,OAAO,EACL,2BAA2B,EAC3B,gCAAgC,EAChC,uCAAuC,EACvC,wBAAwB,EACxB,8BAA8B,EAC9B,0BAA0B,EAC1B,cAAc,EACd,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAElB,wBAAgB,uBAAuB,CAAC,IAAI,CAAC,EAAE;IAC7C,cAAc,CAAC,EAAE,wBAAwB,GAAG,cAAc,CAAC;IAC3D,OAAO,EAAE,iBAAiB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,uBAAuB,GAAG,MAAM,GAAG,CAAC,uBAAuB,GAAG,MAAM,CAAC,EAAE,CAAC;CAClF,GAAG,MAAM,CAAC,MAAM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kBAAkB,CAChC,OAAO,EAAE,gCAAgC,GAAG,qBAAqB,GAAG,2BAA2B,GAAG,gCAAgC,GAAG,MAAM,GAC1I,MAAM,EAAE,GAAG,SAAS,CAiBtB"}
|
|
@@ -1,96 +1,145 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getIssuerName = exports.getIssuerDisplays = exports.
|
|
3
|
+
exports.getTypesFromObject = exports.getIssuerName = exports.getIssuerDisplays = exports.credentialSupportedV8ToV13 = exports.credentialsSupportedV8ToV13 = exports.getTypesFromCredentialSupported = exports.getSupportedCredential = exports.determineVersionsFromIssuerMetadata = exports.getSupportedCredentials = void 0;
|
|
4
|
+
const index_1 = require("../index");
|
|
4
5
|
const types_1 = require("../types");
|
|
5
6
|
function getSupportedCredentials(opts) {
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
const { version = types_1.OpenId4VCIVersion.VER_1_0_13, types } = opts !== null && opts !== void 0 ? opts : {};
|
|
8
|
+
if (types && Array.isArray(types)) {
|
|
9
|
+
if (version < types_1.OpenId4VCIVersion.VER_1_0_13) {
|
|
10
|
+
return types.flatMap((typeSet) => getSupportedCredential(Object.assign(Object.assign({}, opts), { version, types: typeSet })));
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
return types
|
|
14
|
+
.map((typeSet) => {
|
|
15
|
+
return getSupportedCredential(Object.assign(Object.assign({}, opts), { version, types: typeSet }));
|
|
16
|
+
})
|
|
17
|
+
.reduce((acc, result) => {
|
|
18
|
+
Object.assign(acc, result);
|
|
19
|
+
return acc;
|
|
20
|
+
}, {});
|
|
21
|
+
}
|
|
8
22
|
}
|
|
9
23
|
return getSupportedCredential(opts ? Object.assign(Object.assign({}, opts), { types: undefined }) : undefined);
|
|
10
24
|
}
|
|
11
25
|
exports.getSupportedCredentials = getSupportedCredentials;
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
let credentialsSupported;
|
|
26
|
-
if (!issuerMetadata) {
|
|
27
|
-
return [];
|
|
28
|
-
}
|
|
29
|
-
const { version, types } = opts !== null && opts !== void 0 ? opts : { version: types_1.OpenId4VCIVersion.VER_1_0_11 };
|
|
30
|
-
if (version === types_1.OpenId4VCIVersion.VER_1_0_08 || !Array.isArray(issuerMetadata.credentials_supported)) {
|
|
31
|
-
credentialsSupported = credentialsSupportedV8ToV11((_a = issuerMetadata.credentials_supported) !== null && _a !== void 0 ? _a : {});
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
credentialsSupported = issuerMetadata.credentials_supported;
|
|
35
|
-
}
|
|
36
|
-
if (credentialsSupported === undefined || credentialsSupported.length === 0) {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
else if (!types || types.length === 0) {
|
|
40
|
-
return credentialsSupported;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* the following (not array part is a legacy code from version 1_0-08 which JFF plugfest 2 implementors used)
|
|
44
|
-
*/
|
|
45
|
-
let initiationTypes;
|
|
46
|
-
if (opts === null || opts === void 0 ? void 0 : opts.types) {
|
|
47
|
-
if (typeof opts.types === 'string') {
|
|
48
|
-
initiationTypes = [opts.types];
|
|
26
|
+
function determineVersionsFromIssuerMetadata(issuerMetadata) {
|
|
27
|
+
const versions = new Set();
|
|
28
|
+
if ('authorization_server' in issuerMetadata) {
|
|
29
|
+
versions.add(types_1.OpenId4VCIVersion.VER_1_0_11);
|
|
30
|
+
}
|
|
31
|
+
else if ('authorization_servers' in issuerMetadata) {
|
|
32
|
+
versions.add(types_1.OpenId4VCIVersion.VER_1_0_13);
|
|
33
|
+
}
|
|
34
|
+
if (versions.size === 0) {
|
|
35
|
+
// The above checks where already very specific and only applicable to single versions we support, so let's skip if we encounter them
|
|
36
|
+
if ('credential_configurations_supported' in issuerMetadata) {
|
|
37
|
+
versions.add(types_1.OpenId4VCIVersion.VER_1_0_13);
|
|
49
38
|
}
|
|
50
|
-
else {
|
|
51
|
-
|
|
39
|
+
else if ('credentials_supported' in issuerMetadata) {
|
|
40
|
+
if (typeof issuerMetadata.credentials_supported === 'object') {
|
|
41
|
+
versions.add(types_1.OpenId4VCIVersion.VER_1_0_08);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
versions.add(types_1.OpenId4VCIVersion.VER_1_0_09).add(types_1.OpenId4VCIVersion.VER_1_0_11);
|
|
45
|
+
}
|
|
52
46
|
}
|
|
53
47
|
}
|
|
54
|
-
if (
|
|
55
|
-
|
|
48
|
+
if (versions.size === 0) {
|
|
49
|
+
versions.add(types_1.OpenId4VCIVersion.VER_UNKNOWN);
|
|
56
50
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
return Array.from(versions).sort().reverse(); // highest version first
|
|
52
|
+
}
|
|
53
|
+
exports.determineVersionsFromIssuerMetadata = determineVersionsFromIssuerMetadata;
|
|
54
|
+
function getSupportedCredential(opts) {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
const { issuerMetadata, types, format, version = types_1.OpenId4VCIVersion.VER_1_0_13 } = opts !== null && opts !== void 0 ? opts : {};
|
|
57
|
+
let credentialConfigurationsV11 = undefined;
|
|
58
|
+
let credentialConfigurationsV13 = undefined;
|
|
59
|
+
if (version < types_1.OpenId4VCIVersion.VER_1_0_12 || (issuerMetadata === null || issuerMetadata === void 0 ? void 0 : issuerMetadata.credentials_supported)) {
|
|
60
|
+
if ((issuerMetadata === null || issuerMetadata === void 0 ? void 0 : issuerMetadata.credentials_supported) && !Array.isArray(issuerMetadata === null || issuerMetadata === void 0 ? void 0 : issuerMetadata.credentials_supported)) {
|
|
61
|
+
// The current code duplication and logic is such a mess, that we re-adjust the object to the proper type again
|
|
62
|
+
credentialConfigurationsV11 = [];
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
64
|
+
Object.entries(issuerMetadata.credentials_supported).forEach(([id, supported]) => {
|
|
65
|
+
if (!supported.id) {
|
|
66
|
+
supported.id = id;
|
|
67
|
+
}
|
|
68
|
+
credentialConfigurationsV11 === null || credentialConfigurationsV11 === void 0 ? void 0 : credentialConfigurationsV11.push(supported);
|
|
69
|
+
});
|
|
64
70
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// Make sure we include Verifiable Credential both on the offer side as well as in the metadata side, to ensure consistency of the issuer does not.
|
|
68
|
-
if (initiationTypes && !initiationTypes.includes('VerifiableCredential')) {
|
|
69
|
-
initiationTypes.push('VerifiableCredential');
|
|
71
|
+
else {
|
|
72
|
+
credentialConfigurationsV11 = (_a = issuerMetadata === null || issuerMetadata === void 0 ? void 0 : issuerMetadata.credentials_supported) !== null && _a !== void 0 ? _a : [];
|
|
70
73
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
credentialConfigurationsV13 =
|
|
77
|
+
(_b = issuerMetadata === null || issuerMetadata === void 0 ? void 0 : issuerMetadata.credential_configurations_supported) !== null && _b !== void 0 ? _b : {};
|
|
78
|
+
}
|
|
79
|
+
if (!issuerMetadata || (!issuerMetadata.credential_configurations_supported && !issuerMetadata.credentials_supported)) {
|
|
80
|
+
index_1.VCI_LOG_COMMON.warning(`No credential issuer metadata or supported credentials found for issuer}`);
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
82
|
+
return version < types_1.OpenId4VCIVersion.VER_1_0_13 ? credentialConfigurationsV11 : credentialConfigurationsV13;
|
|
83
|
+
}
|
|
84
|
+
const normalizedTypes = Array.isArray(types) ? types : types ? [types] : [];
|
|
85
|
+
const normalizedFormats = Array.isArray(format) ? format : format ? [format] : [];
|
|
86
|
+
function filterMatchingConfig(config) {
|
|
87
|
+
let isTypeMatch = normalizedTypes.length === 0;
|
|
88
|
+
const types = getTypesFromObject(config);
|
|
89
|
+
if (!isTypeMatch) {
|
|
90
|
+
if (normalizedTypes.length === 1 && config.id === normalizedTypes[0]) {
|
|
91
|
+
isTypeMatch = true;
|
|
92
|
+
}
|
|
93
|
+
else if (types) {
|
|
94
|
+
isTypeMatch = normalizedTypes.every((type) => types.includes(type));
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
if ('credential_definition' in config) {
|
|
98
|
+
isTypeMatch = normalizedTypes.every((type) => { var _a; return (_a = config.credential_definition.type) === null || _a === void 0 ? void 0 : _a.includes(type); });
|
|
99
|
+
}
|
|
100
|
+
else if ('type' in config && Array.isArray(config.type)) {
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
102
|
+
// @ts-ignore
|
|
103
|
+
isTypeMatch = normalizedTypes.every((type) => config.type.includes(type));
|
|
104
|
+
}
|
|
105
|
+
else if ('types' in config) {
|
|
106
|
+
isTypeMatch = normalizedTypes.every((type) => { var _a; return (_a = config.types) === null || _a === void 0 ? void 0 : _a.includes(type); });
|
|
107
|
+
}
|
|
75
108
|
}
|
|
76
|
-
return (!initiationTypes || arrayEqualsIgnoreOrder(supTypes, initiationTypes)) && supportedFormats.includes(sup.format);
|
|
77
|
-
});
|
|
78
|
-
if (supported) {
|
|
79
|
-
credentialSupportedOverlap.push(...supported);
|
|
80
109
|
}
|
|
110
|
+
const isFormatMatch = normalizedFormats.length === 0 || normalizedFormats.includes(config.format);
|
|
111
|
+
return isTypeMatch && isFormatMatch ? config : undefined;
|
|
112
|
+
}
|
|
113
|
+
if (credentialConfigurationsV13) {
|
|
114
|
+
return Object.entries(credentialConfigurationsV13).reduce((filteredConfigs, [id, config]) => {
|
|
115
|
+
if (filterMatchingConfig(config)) {
|
|
116
|
+
filteredConfigs[id] = config;
|
|
117
|
+
// Added to enable support < 13. We basically assign the
|
|
118
|
+
if (!config.id) {
|
|
119
|
+
config.id = id;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return filteredConfigs;
|
|
123
|
+
}, {});
|
|
81
124
|
}
|
|
82
|
-
|
|
125
|
+
else if (credentialConfigurationsV11) {
|
|
126
|
+
return credentialConfigurationsV11.filter((config) => filterMatchingConfig(config));
|
|
127
|
+
}
|
|
128
|
+
throw Error(`Either < v11 configurations or V13 configurations should have been filtered at this point`);
|
|
83
129
|
}
|
|
84
130
|
exports.getSupportedCredential = getSupportedCredential;
|
|
85
131
|
function getTypesFromCredentialSupported(credentialSupported, opts) {
|
|
132
|
+
var _a;
|
|
86
133
|
let types = [];
|
|
87
134
|
if (credentialSupported.format === 'jwt_vc_json' ||
|
|
88
135
|
credentialSupported.format === 'jwt_vc' ||
|
|
89
136
|
credentialSupported.format === 'jwt_vc_json-ld' ||
|
|
90
137
|
credentialSupported.format === 'ldp_vc') {
|
|
91
|
-
types = credentialSupported
|
|
138
|
+
types = (_a = getTypesFromObject(credentialSupported)) !== null && _a !== void 0 ? _a : [];
|
|
92
139
|
}
|
|
93
140
|
else if (credentialSupported.format === 'vc+sd-jwt') {
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
142
|
+
// @ts-ignore
|
|
94
143
|
types = [credentialSupported.vct];
|
|
95
144
|
}
|
|
96
145
|
if (!types || types.length === 0) {
|
|
@@ -102,39 +151,30 @@ function getTypesFromCredentialSupported(credentialSupported, opts) {
|
|
|
102
151
|
return types;
|
|
103
152
|
}
|
|
104
153
|
exports.getTypesFromCredentialSupported = getTypesFromCredentialSupported;
|
|
105
|
-
function
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const uniqueValues = new Set([...a, ...b]);
|
|
109
|
-
for (const v of uniqueValues) {
|
|
110
|
-
const aCount = a.filter((e) => e === v).length;
|
|
111
|
-
const bCount = b.filter((e) => e === v).length;
|
|
112
|
-
if (aCount !== bCount)
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
function credentialsSupportedV8ToV11(supportedV8) {
|
|
118
|
-
return Object.entries(supportedV8).flatMap((entry) => {
|
|
154
|
+
function credentialsSupportedV8ToV13(supportedV8) {
|
|
155
|
+
const credentialConfigsSupported = {};
|
|
156
|
+
Object.entries(supportedV8).flatMap((entry) => {
|
|
119
157
|
const type = entry[0];
|
|
120
158
|
const supportedV8 = entry[1];
|
|
121
|
-
|
|
159
|
+
Object.assign(credentialConfigsSupported, credentialSupportedV8ToV13(type, supportedV8));
|
|
122
160
|
});
|
|
161
|
+
return credentialConfigsSupported;
|
|
123
162
|
}
|
|
124
|
-
exports.
|
|
125
|
-
function
|
|
126
|
-
|
|
163
|
+
exports.credentialsSupportedV8ToV13 = credentialsSupportedV8ToV13;
|
|
164
|
+
function credentialSupportedV8ToV13(key, supportedV8) {
|
|
165
|
+
const credentialConfigsSupported = {};
|
|
166
|
+
Object.entries(supportedV8.formats).map((entry) => {
|
|
127
167
|
const format = entry[0];
|
|
128
168
|
const credentialSupportBrief = entry[1];
|
|
129
169
|
if (typeof format !== 'string') {
|
|
130
170
|
throw Error(`Unknown format received ${JSON.stringify(format)}`);
|
|
131
171
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return credentialSupport;
|
|
172
|
+
const credentialConfigSupported = Object.assign(Object.assign({ format: format, display: supportedV8.display }, credentialSupportBrief), { credentialSubject: supportedV8.claims });
|
|
173
|
+
credentialConfigsSupported[key] = credentialConfigSupported;
|
|
135
174
|
});
|
|
175
|
+
return credentialConfigsSupported;
|
|
136
176
|
}
|
|
137
|
-
exports.
|
|
177
|
+
exports.credentialSupportedV8ToV13 = credentialSupportedV8ToV13;
|
|
138
178
|
function getIssuerDisplays(metadata, opts) {
|
|
139
179
|
var _a, _b;
|
|
140
180
|
const matchedDisplays = (_b = (_a = metadata.display) === null || _a === void 0 ? void 0 : _a.filter((item) => !(opts === null || opts === void 0 ? void 0 : opts.prefLocales) || opts.prefLocales.length === 0 || (item.locale && opts.prefLocales.includes(item.locale)) || !item.locale)) !== null && _b !== void 0 ? _b : [];
|
|
@@ -156,4 +196,31 @@ function getIssuerName(url, credentialIssuerMetadata) {
|
|
|
156
196
|
return url;
|
|
157
197
|
}
|
|
158
198
|
exports.getIssuerName = getIssuerName;
|
|
199
|
+
/**
|
|
200
|
+
* The specs had many places where types could be expressed. This method ensures we get them in any way possible
|
|
201
|
+
* @param subject
|
|
202
|
+
*/
|
|
203
|
+
function getTypesFromObject(subject) {
|
|
204
|
+
if (subject === undefined) {
|
|
205
|
+
return undefined;
|
|
206
|
+
}
|
|
207
|
+
else if (typeof subject === 'string') {
|
|
208
|
+
return [subject];
|
|
209
|
+
}
|
|
210
|
+
else if ('credential_definition' in subject && subject.credential_definition) {
|
|
211
|
+
return getTypesFromObject(subject.credential_definition);
|
|
212
|
+
}
|
|
213
|
+
else if ('types' in subject && subject.types) {
|
|
214
|
+
return Array.isArray(subject.types) ? subject.types : [subject.types];
|
|
215
|
+
}
|
|
216
|
+
else if ('type' in subject && subject.type) {
|
|
217
|
+
return Array.isArray(subject.type) ? subject.type : [subject.type];
|
|
218
|
+
}
|
|
219
|
+
else if ('vct' in subject && subject.vct) {
|
|
220
|
+
return [subject.vct];
|
|
221
|
+
}
|
|
222
|
+
index_1.VCI_LOG_COMMON.warning('Could not deduce credential types. Probably a failure down the line will happen!');
|
|
223
|
+
return undefined;
|
|
224
|
+
}
|
|
225
|
+
exports.getTypesFromObject = getTypesFromObject;
|
|
159
226
|
//# sourceMappingURL=IssuerMetadataUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IssuerMetadataUtils.js","sourceRoot":"","sources":["../../lib/functions/IssuerMetadataUtils.ts"],"names":[],"mappings":";;;AAAA,oCAWkB;AAElB,SAAgB,uBAAuB,CAAC,IAKvC;IACC,
|
|
1
|
+
{"version":3,"file":"IssuerMetadataUtils.js","sourceRoot":"","sources":["../../lib/functions/I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K,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACxE,CAAC;SAAM,IAAI,MAAM,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QAC7C,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;SAAM,IAAI,KAAK,IAAI,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAC3C,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,sBAAc,CAAC,OAAO,CAAC,kFAAkF,CAAC,CAAC;IAC3G,OAAO,SAAS,CAAC;AACnB,CAAC;AAnBD,gDAmBC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PoPMode } from '..';
|
|
2
|
+
import { JWK, Jwt, JWTVerifyCallback, JwtVerifyResult, ProofOfPossession, ProofOfPossessionCallbacks, Typ } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* - proofOfPossessionCallback: JWTSignerCallback
|
|
6
|
+
* Mandatory if you want to create (sign) ProofOfPossession
|
|
7
|
+
* - proofOfPossessionVerifierCallback?: JWTVerifyCallback
|
|
8
|
+
* If exists, verifies the ProofOfPossession
|
|
9
|
+
* - proofOfPossessionCallbackArgs: ProofOfPossessionCallbackArgs
|
|
10
|
+
* arguments needed for signing ProofOfPossession
|
|
11
|
+
* @param callbacks:
|
|
12
|
+
* - proofOfPossessionCallback: JWTSignerCallback
|
|
13
|
+
* Mandatory to create (sign) ProofOfPossession
|
|
14
|
+
* - proofOfPossessionVerifierCallback?: JWTVerifyCallback
|
|
15
|
+
* If exists, verifies the ProofOfPossession
|
|
16
|
+
* @param jwtProps
|
|
17
|
+
* @param existingJwt
|
|
18
|
+
* - Optional, clientId of the party requesting the credential
|
|
19
|
+
*/
|
|
20
|
+
export declare const createProofOfPossession: <DIDDoc>(popMode: PoPMode, callbacks: ProofOfPossessionCallbacks<DIDDoc>, jwtProps?: JwtProps, existingJwt?: Jwt) => Promise<ProofOfPossession>;
|
|
21
|
+
export declare const isJWS: (token: string) => boolean;
|
|
22
|
+
export declare const extractBearerToken: (authorizationHeader?: string) => string | undefined;
|
|
23
|
+
export declare const validateJWT: (jwt?: string, opts?: {
|
|
24
|
+
kid?: string;
|
|
25
|
+
accessTokenVerificationCallback?: JWTVerifyCallback<never>;
|
|
26
|
+
}) => Promise<JwtVerifyResult<any>>;
|
|
27
|
+
export interface JwtProps {
|
|
28
|
+
typ?: Typ;
|
|
29
|
+
kid?: string;
|
|
30
|
+
jwk?: JWK;
|
|
31
|
+
aud?: string | string[];
|
|
32
|
+
issuer?: string;
|
|
33
|
+
clientId?: string;
|
|
34
|
+
alg?: string;
|
|
35
|
+
jti?: string;
|
|
36
|
+
nonce?: string;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=ProofUtil.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProofUtil.d.ts","sourceRoot":"","sources":["../../lib/functions/ProofUtil.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAkB,MAAM,IAAI,CAAC;AAC7C,OAAO,EAGL,GAAG,EAEH,GAAG,EAGH,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,0BAA0B,EAC1B,GAAG,EACJ,MAAM,UAAU,CAAC;AAIlB;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,oBACzB,OAAO,aACL,2BAA2B,MAAM,CAAC,aAClC,QAAQ,gBACL,GAAG,KAChB,QAAQ,iBAAiB,CA0B3B,CAAC;AAQF,eAAO,MAAM,KAAK,UAAW,MAAM,KAAG,OAOrC,CAAC;AAEF,eAAO,MAAM,kBAAkB,yBAA0B,MAAM,KAAG,MAAM,GAAG,SAE1E,CAAC;AAEF,eAAO,MAAM,WAAW,SAChB,MAAM,SACL;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,+BAA+B,CAAC,EAAE,kBAAkB,KAAK,CAAC,CAAA;CAAE,KAClF,QAAQ,gBAAgB,GAAG,CAAC,CAkB9B,CAAC;AAEF,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.validateJWT = exports.extractBearerToken = exports.isJWS = exports.createProofOfPossession = void 0;
|
|
16
|
+
const debug_1 = __importDefault(require("debug"));
|
|
17
|
+
const jwt_decode_1 = __importDefault(require("jwt-decode"));
|
|
18
|
+
const __1 = require("..");
|
|
19
|
+
const types_1 = require("../types");
|
|
20
|
+
const debug = (0, debug_1.default)('sphereon:openid4vci:common');
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* - proofOfPossessionCallback: JWTSignerCallback
|
|
24
|
+
* Mandatory if you want to create (sign) ProofOfPossession
|
|
25
|
+
* - proofOfPossessionVerifierCallback?: JWTVerifyCallback
|
|
26
|
+
* If exists, verifies the ProofOfPossession
|
|
27
|
+
* - proofOfPossessionCallbackArgs: ProofOfPossessionCallbackArgs
|
|
28
|
+
* arguments needed for signing ProofOfPossession
|
|
29
|
+
* @param callbacks:
|
|
30
|
+
* - proofOfPossessionCallback: JWTSignerCallback
|
|
31
|
+
* Mandatory to create (sign) ProofOfPossession
|
|
32
|
+
* - proofOfPossessionVerifierCallback?: JWTVerifyCallback
|
|
33
|
+
* If exists, verifies the ProofOfPossession
|
|
34
|
+
* @param jwtProps
|
|
35
|
+
* @param existingJwt
|
|
36
|
+
* - Optional, clientId of the party requesting the credential
|
|
37
|
+
*/
|
|
38
|
+
const createProofOfPossession = (popMode, callbacks, jwtProps, existingJwt) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
if (!callbacks.signCallback) {
|
|
40
|
+
debug(`no jwt signer callback or arguments supplied!`);
|
|
41
|
+
throw new Error(types_1.BAD_PARAMS);
|
|
42
|
+
}
|
|
43
|
+
const signerArgs = createJWT(popMode, jwtProps, existingJwt);
|
|
44
|
+
const jwt = yield callbacks.signCallback(signerArgs, signerArgs.header.kid);
|
|
45
|
+
const proof = {
|
|
46
|
+
proof_type: 'jwt',
|
|
47
|
+
jwt,
|
|
48
|
+
};
|
|
49
|
+
try {
|
|
50
|
+
partiallyValidateJWS(jwt);
|
|
51
|
+
if (callbacks.verifyCallback) {
|
|
52
|
+
debug(`Calling supplied verify callback....`);
|
|
53
|
+
yield callbacks.verifyCallback({ jwt, kid: signerArgs.header.kid });
|
|
54
|
+
debug(`Supplied verify callback return success result`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (_a) {
|
|
58
|
+
debug(`JWS was not valid`);
|
|
59
|
+
throw new Error(types_1.JWS_NOT_VALID);
|
|
60
|
+
}
|
|
61
|
+
debug(`Proof of Possession JWT:\r\n${jwt}`);
|
|
62
|
+
return proof;
|
|
63
|
+
});
|
|
64
|
+
exports.createProofOfPossession = createProofOfPossession;
|
|
65
|
+
const partiallyValidateJWS = (jws) => {
|
|
66
|
+
if (jws.split('.').length !== 3 || !jws.startsWith('ey')) {
|
|
67
|
+
throw new Error(types_1.JWS_NOT_VALID);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const isJWS = (token) => {
|
|
71
|
+
try {
|
|
72
|
+
partiallyValidateJWS(token);
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
exports.isJWS = isJWS;
|
|
80
|
+
const extractBearerToken = (authorizationHeader) => {
|
|
81
|
+
var _a;
|
|
82
|
+
return authorizationHeader ? (_a = /Bearer (.*)/i.exec(authorizationHeader)) === null || _a === void 0 ? void 0 : _a[1] : undefined;
|
|
83
|
+
};
|
|
84
|
+
exports.extractBearerToken = extractBearerToken;
|
|
85
|
+
const validateJWT = (jwt, opts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
if (!jwt) {
|
|
87
|
+
throw Error('No JWT was supplied');
|
|
88
|
+
}
|
|
89
|
+
if (!(opts === null || opts === void 0 ? void 0 : opts.accessTokenVerificationCallback)) {
|
|
90
|
+
__1.VCI_LOG_COMMON.warning(`No access token verification callback supplied. Access tokens will not be verified, except for a very basic check`);
|
|
91
|
+
partiallyValidateJWS(jwt);
|
|
92
|
+
const header = (0, jwt_decode_1.default)(jwt, { header: true });
|
|
93
|
+
const payload = (0, jwt_decode_1.default)(jwt, { header: false });
|
|
94
|
+
return Object.assign(Object.assign({ jwt: { header, payload } }, header), payload);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
return yield opts.accessTokenVerificationCallback({ jwt, kid: opts.kid });
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
exports.validateJWT = validateJWT;
|
|
101
|
+
const createJWT = (mode, jwtProps, existingJwt) => {
|
|
102
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
103
|
+
const aud = mode === 'pop'
|
|
104
|
+
? getJwtProperty('aud', true, jwtProps === null || jwtProps === void 0 ? void 0 : jwtProps.issuer, (_a = existingJwt === null || existingJwt === void 0 ? void 0 : existingJwt.payload) === null || _a === void 0 ? void 0 : _a.aud)
|
|
105
|
+
: getJwtProperty('aud', false, jwtProps === null || jwtProps === void 0 ? void 0 : jwtProps.aud, (_b = existingJwt === null || existingJwt === void 0 ? void 0 : existingJwt.payload) === null || _b === void 0 ? void 0 : _b.aud);
|
|
106
|
+
const iss =
|
|
107
|
+
// mode === 'pop'
|
|
108
|
+
getJwtProperty('iss', false, jwtProps === null || jwtProps === void 0 ? void 0 : jwtProps.clientId, (_c = existingJwt === null || existingJwt === void 0 ? void 0 : existingJwt.payload) === null || _c === void 0 ? void 0 : _c.iss);
|
|
109
|
+
// : getJwtProperty<string>('iss', false, jwtProps?.issuer, existingJwt?.payload?.iss);
|
|
110
|
+
const client_id = mode === 'jwt' ? getJwtProperty('client_id', false, jwtProps === null || jwtProps === void 0 ? void 0 : jwtProps.clientId, (_d = existingJwt === null || existingJwt === void 0 ? void 0 : existingJwt.payload) === null || _d === void 0 ? void 0 : _d.client_id) : undefined;
|
|
111
|
+
const jti = getJwtProperty('jti', false, jwtProps === null || jwtProps === void 0 ? void 0 : jwtProps.jti, (_e = existingJwt === null || existingJwt === void 0 ? void 0 : existingJwt.payload) === null || _e === void 0 ? void 0 : _e.jti);
|
|
112
|
+
const typ = getJwtProperty('typ', true, jwtProps === null || jwtProps === void 0 ? void 0 : jwtProps.typ, (_f = existingJwt === null || existingJwt === void 0 ? void 0 : existingJwt.header) === null || _f === void 0 ? void 0 : _f.typ, 'jwt');
|
|
113
|
+
const nonce = getJwtProperty('nonce', false, jwtProps === null || jwtProps === void 0 ? void 0 : jwtProps.nonce, (_g = existingJwt === null || existingJwt === void 0 ? void 0 : existingJwt.payload) === null || _g === void 0 ? void 0 : _g.nonce); // Officially this is required, but some implementations don't have it
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
115
|
+
const alg = getJwtProperty('alg', false, jwtProps === null || jwtProps === void 0 ? void 0 : jwtProps.alg, (_h = existingJwt === null || existingJwt === void 0 ? void 0 : existingJwt.header) === null || _h === void 0 ? void 0 : _h.alg, 'ES256');
|
|
116
|
+
const kid = getJwtProperty('kid', false, jwtProps === null || jwtProps === void 0 ? void 0 : jwtProps.kid, (_j = existingJwt === null || existingJwt === void 0 ? void 0 : existingJwt.header) === null || _j === void 0 ? void 0 : _j.kid);
|
|
117
|
+
const jwk = getJwtProperty('jwk', false, jwtProps === null || jwtProps === void 0 ? void 0 : jwtProps.jwk, (_k = existingJwt === null || existingJwt === void 0 ? void 0 : existingJwt.header) === null || _k === void 0 ? void 0 : _k.jwk);
|
|
118
|
+
const jwt = existingJwt ? existingJwt : {};
|
|
119
|
+
const now = +new Date();
|
|
120
|
+
const jwtPayload = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (aud && { aud })), { iat: (_m = (_l = jwt.payload) === null || _l === void 0 ? void 0 : _l.iat) !== null && _m !== void 0 ? _m : Math.round(now / 1000 - 60), exp: (_p = (_o = jwt.payload) === null || _o === void 0 ? void 0 : _o.exp) !== null && _p !== void 0 ? _p : Math.round(now / 1000 + 10 * 60), nonce }), (client_id && { client_id })), (iss && { iss })), (jti && { jti }));
|
|
121
|
+
const jwtHeader = Object.assign(Object.assign({ typ,
|
|
122
|
+
alg }, (kid && { kid })), (jwk && { jwk }));
|
|
123
|
+
return {
|
|
124
|
+
payload: Object.assign(Object.assign({}, jwt.payload), jwtPayload),
|
|
125
|
+
header: Object.assign(Object.assign({}, jwt.header), jwtHeader),
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const getJwtProperty = (propertyName, required, option, jwtProperty, defaultValue) => {
|
|
129
|
+
if (typeof option === 'string' && option && jwtProperty && option !== jwtProperty) {
|
|
130
|
+
throw Error(`Cannot have a property '${propertyName}' with value '${option}' and different JWT value '${jwtProperty}' at the same time`);
|
|
131
|
+
}
|
|
132
|
+
let result = (jwtProperty ? jwtProperty : option);
|
|
133
|
+
if (!result) {
|
|
134
|
+
if (required) {
|
|
135
|
+
throw Error(`No ${propertyName} property provided either in a JWT or as option`);
|
|
136
|
+
}
|
|
137
|
+
result = defaultValue;
|
|
138
|
+
}
|
|
139
|
+
return result;
|
|
140
|
+
};
|
|
141
|
+
//# sourceMappingURL=ProofUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProofUtil.js","sourceRoot":"","sources":["../../lib/functions/ProofUtil.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,4DAAmC;AAEnC,0BAA6C;AAC7C,oCAakB;AAElB,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,4BAA4B,CAAC,CAAC;AAElD;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,uBAAuB,GAAG,CACrC,OAAgB,EAChB,SAA6C,EAC7C,QAAmB,EACnB,WAAiB,EACW,EAAE;IAC9B,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;QAC5B,KAAK,CAAC,+CAA+C,CAAC,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,kBAAU,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC7D,MAAM,GAAG,GAAG,MAAM,SAA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AC,GAC5B,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC,GAChB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC,CACpB,CAAC;IAEF,MAAM,SAAS,iCACb,GAAG;QACH,GAAG,IACA,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC,GAChB,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,CAAC,CACpB,CAAC;IACF,OAAO;QACL,OAAO,kCAAO,GAAG,CAAC,OAAO,GAAK,UAAU,CAAE;QAC1C,MAAM,kCAAO,GAAG,CAAC,MAAM,GAAK,SAAS,CAAE;KACxC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CACrB,YAAoB,EACpB,QAAiB,EACjB,MAAgC,EAChC,WAAe,EACf,YAAgB,EACD,EAAE;IACjB,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,IAAI,WAAW,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;QAClF,MAAM,KAAK,CAAC,2BAA2B,YAAY,iBAAiB,MAAM,8BAA8B,WAAW,oBAAoB,CAAC,CAAC;IAC3I,CAAC;IACD,IAAI,MAAM,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAkB,CAAC;IACnE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,KAAK,CAAC,MAAM,YAAY,iDAAiD,CAAC,CAAC;QACnF,CAAC;QACD,MAAM,GAAG,YAAY,CAAC;IACxB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
|
|
@@ -7,6 +7,7 @@ export * from './TypeConversionUtils';
|
|
|
7
7
|
export * from './IssuerMetadataUtils';
|
|
8
8
|
export * from './FormatUtils';
|
|
9
9
|
export * from './HttpUtils';
|
|
10
|
+
export * from './ProofUtil';
|
|
10
11
|
export * from './AuthorizationResponseUtil';
|
|
11
12
|
export { randomBytes };
|
|
12
13
|
export * from './RandomUtils';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/functions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,cAAc,eAAe,CAAC"}
|