@verana-labs/vs-agent-plugin-openid4vc 1.12.0-oidc4vc.6 → 2.0.0-dev.100
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/README.md +175 -164
- package/build/config.d.ts +19 -3
- package/build/config.js +161 -242
- package/build/config.js.map +1 -1
- package/build/events/openId4VcEvents.d.ts +6 -0
- package/build/events/openId4VcEvents.js +17 -0
- package/build/events/openId4VcEvents.js.map +1 -0
- package/build/index.d.ts +20 -12
- package/build/index.js +39 -16
- package/build/index.js.map +1 -1
- package/build/nestjs/OpenId4VcPlugin.js +27 -43
- package/build/nestjs/OpenId4VcPlugin.js.map +1 -1
- package/build/nestjs/V2OpenId4VcCredentialExchangesController.d.ts +19 -0
- package/build/nestjs/V2OpenId4VcCredentialExchangesController.js +161 -0
- package/build/nestjs/V2OpenId4VcCredentialExchangesController.js.map +1 -0
- package/build/nestjs/V2OpenId4VcPresentationsController.d.ts +19 -0
- package/build/nestjs/V2OpenId4VcPresentationsController.js +147 -0
- package/build/nestjs/V2OpenId4VcPresentationsController.js.map +1 -0
- package/build/nestjs/V2OpenId4VcSigningCertificatesController.d.ts +17 -0
- package/build/nestjs/V2OpenId4VcSigningCertificatesController.js +58 -0
- package/build/nestjs/V2OpenId4VcSigningCertificatesController.js.map +1 -0
- package/build/nestjs/dto/credential-exchange.dto.d.ts +31 -0
- package/build/nestjs/dto/credential-exchange.dto.js +150 -0
- package/build/nestjs/dto/credential-exchange.dto.js.map +1 -0
- package/build/nestjs/dto/index.d.ts +3 -0
- package/build/nestjs/dto/index.js +20 -0
- package/build/nestjs/dto/index.js.map +1 -0
- package/build/nestjs/dto/presentation.dto.d.ts +57 -0
- package/build/nestjs/dto/presentation.dto.js +246 -0
- package/build/nestjs/dto/presentation.dto.js.map +1 -0
- package/build/nestjs/dto/signing-certificate.dto.d.ts +8 -0
- package/build/nestjs/dto/signing-certificate.dto.js +40 -0
- package/build/nestjs/dto/signing-certificate.dto.js.map +1 -0
- package/build/nestjs/mappers.d.ts +5 -0
- package/build/nestjs/mappers.js +31 -0
- package/build/nestjs/mappers.js.map +1 -0
- package/build/sdk/credentialConfigurationHandlers.d.ts +4 -0
- package/build/sdk/credentialConfigurationHandlers.js +57 -0
- package/build/sdk/credentialConfigurationHandlers.js.map +1 -0
- package/build/sdk/setupOpenId4Vc.d.ts +8 -12
- package/build/sdk/setupOpenId4Vc.js +88 -80
- package/build/sdk/setupOpenId4Vc.js.map +1 -1
- package/build/services/CertificateService.d.ts +6 -22
- package/build/services/CertificateService.js +104 -71
- package/build/services/CertificateService.js.map +1 -1
- package/build/services/IssuerService.d.ts +57 -44
- package/build/services/IssuerService.js +284 -103
- package/build/services/IssuerService.js.map +1 -1
- package/build/services/VerifierService.d.ts +44 -44
- package/build/services/VerifierService.js +227 -223
- package/build/services/VerifierService.js.map +1 -1
- package/build/services/credentialConfigurationBuilder.d.ts +10 -0
- package/build/services/credentialConfigurationBuilder.js +88 -0
- package/build/services/credentialConfigurationBuilder.js.map +1 -0
- package/build/services/presentationRequest.d.ts +51 -0
- package/build/services/presentationRequest.js +72 -0
- package/build/services/presentationRequest.js.map +1 -0
- package/build/services/presentationVerification.d.ts +12 -0
- package/build/services/presentationVerification.js +13 -0
- package/build/services/presentationVerification.js.map +1 -0
- package/build/services/typeMetadataIntegrity.d.ts +6 -0
- package/build/services/typeMetadataIntegrity.js +32 -0
- package/build/services/typeMetadataIntegrity.js.map +1 -0
- package/build/trust/CertificateTrust.d.ts +1 -4
- package/build/trust/CertificateTrust.js +10 -15
- package/build/trust/CertificateTrust.js.map +1 -1
- package/build/trust/keyBinding.d.ts +15 -16
- package/build/trust/keyBinding.js +54 -174
- package/build/trust/keyBinding.js.map +1 -1
- package/build/trust/presentedIssuer.d.ts +9 -0
- package/build/trust/presentedIssuer.js +23 -0
- package/build/trust/presentedIssuer.js.map +1 -0
- package/build/trust/trustDecision.d.ts +31 -0
- package/build/trust/trustDecision.js +204 -0
- package/build/trust/trustDecision.js.map +1 -0
- package/build/trust/types.d.ts +7 -16
- package/build/trust/types.js +8 -0
- package/build/trust/types.js.map +1 -1
- package/build/types.d.ts +29 -51
- package/build/types.js +4 -0
- package/build/types.js.map +1 -1
- package/build/utils/isRecord.d.ts +1 -0
- package/build/utils/isRecord.js +7 -0
- package/build/utils/isRecord.js.map +1 -0
- package/build/utils/serviceDisplay.d.ts +8 -0
- package/build/utils/serviceDisplay.js +11 -0
- package/build/utils/serviceDisplay.js.map +1 -0
- package/package.json +10 -8
- package/build/nestjs/CertificatesController.d.ts +0 -11
- package/build/nestjs/CertificatesController.js +0 -58
- package/build/nestjs/CertificatesController.js.map +0 -1
- package/build/nestjs/IssuerController.d.ts +0 -8
- package/build/nestjs/IssuerController.js +0 -66
- package/build/nestjs/IssuerController.js.map +0 -1
- package/build/nestjs/VerifierController.d.ts +0 -8
- package/build/nestjs/VerifierController.js +0 -66
- package/build/nestjs/VerifierController.js.map +0 -1
- package/build/nestjs/dto.d.ts +0 -7
- package/build/nestjs/dto.js +0 -34
- package/build/nestjs/dto.js.map +0 -1
- package/build/services/StatusListService.d.ts +0 -42
- package/build/services/StatusListService.js +0 -132
- package/build/services/StatusListService.js.map +0 -1
- package/build/trust/TrustClient.d.ts +0 -12
- package/build/trust/TrustClient.js +0 -120
- package/build/trust/TrustClient.js.map +0 -1
- package/build/trust/verdict.d.ts +0 -2
- package/build/trust/verdict.js +0 -13
- package/build/trust/verdict.js.map +0 -1
|
@@ -4,25 +4,28 @@ exports.signingCertificateInfo = signingCertificateInfo;
|
|
|
4
4
|
exports.loadSigningCertificate = loadSigningCertificate;
|
|
5
5
|
exports.didFromValidatedCertificate = didFromValidatedCertificate;
|
|
6
6
|
exports.publishDevelopmentSigningKey = publishDevelopmentSigningKey;
|
|
7
|
-
exports.
|
|
7
|
+
exports.x5cCertificateChain = x5cCertificateChain;
|
|
8
8
|
const core_1 = require("@credo-ts/core");
|
|
9
|
-
const
|
|
9
|
+
const crypto_1 = require("crypto");
|
|
10
|
+
const CertificateTrust_1 = require("../trust/CertificateTrust");
|
|
11
|
+
const isRecord_1 = require("../utils/isRecord");
|
|
10
12
|
const DEVELOPMENT_CERTIFICATE_VALIDITY_MS = 365 * 24 * 60 * 60 * 1000;
|
|
11
13
|
const DEVELOPMENT_RECORD_PREFIX = 'openid4vc-development-signing';
|
|
14
|
+
const JSON_WEB_KEY_2020_CONTEXT = 'https://w3id.org/security/suites/jws-2020/v1';
|
|
15
|
+
/** [VSA-ADM-OID-CS] Public signing material of one capability. */
|
|
12
16
|
function signingCertificateInfo(role, handle) {
|
|
13
|
-
const digest = (0, node_crypto_1.createHash)('sha256').update(handle.certificate.rawCertificate).digest('hex');
|
|
14
17
|
return {
|
|
15
18
|
role,
|
|
16
19
|
development: handle.development,
|
|
17
|
-
fingerprint:
|
|
20
|
+
fingerprint: (0, CertificateTrust_1.certificateFingerprint)(handle.certificate),
|
|
18
21
|
certificateChain: handle.chain.map(certificate => certificate.toString('base64')),
|
|
19
22
|
};
|
|
20
23
|
}
|
|
21
24
|
async function loadSigningCertificate(agent, signing, publicApiBaseUrl = agent.publicApiBaseUrl, role = 'issuer') {
|
|
22
|
-
if (signing
|
|
23
|
-
return await loadConfiguredSigningCertificate(agent, signing.configured);
|
|
25
|
+
if (signing) {
|
|
26
|
+
return await loadConfiguredSigningCertificate(agent, signing.configured, publicApiBaseUrl, role);
|
|
24
27
|
}
|
|
25
|
-
return await loadDevelopmentSigningCertificate(agent,
|
|
28
|
+
return await loadDevelopmentSigningCertificate(agent, publicApiBaseUrl, role);
|
|
26
29
|
}
|
|
27
30
|
function didFromValidatedCertificate(certificate) {
|
|
28
31
|
const did = certificate.sanUriNames.map(uri => { var _a; return (_a = (0, core_1.tryParseDid)(uri)) === null || _a === void 0 ? void 0 : _a.did; }).find(value => value !== undefined);
|
|
@@ -31,76 +34,98 @@ function didFromValidatedCertificate(certificate) {
|
|
|
31
34
|
}
|
|
32
35
|
return did;
|
|
33
36
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
*/
|
|
39
|
-
async function publishDevelopmentSigningKey(agent, signingCertificate, role, extraPurposes = []) {
|
|
40
|
-
var _a, _b, _c, _d;
|
|
37
|
+
// Nest calls every onModuleInit hook of a module concurrently, and two capabilities publishing into one DID
|
|
38
|
+
// document would each drop the verification method the other added.
|
|
39
|
+
let didDocumentPublication = Promise.resolve();
|
|
40
|
+
function publishDevelopmentSigningKey(agent, signingCertificate, role) {
|
|
41
41
|
if (!signingCertificate.development)
|
|
42
|
-
return;
|
|
42
|
+
return Promise.resolve(undefined);
|
|
43
|
+
const publication = didDocumentPublication
|
|
44
|
+
.catch(() => undefined)
|
|
45
|
+
.then(() => publishSigningKeyToDidDocument(agent, signingCertificate, role));
|
|
46
|
+
didDocumentPublication = publication.catch(() => undefined);
|
|
47
|
+
return publication;
|
|
48
|
+
}
|
|
49
|
+
async function publishSigningKeyToDidDocument(agent, signingCertificate, role) {
|
|
50
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
43
51
|
const did = agent.did;
|
|
44
52
|
if (!did)
|
|
45
53
|
throw new Error('development signing key publication requires an agent DID');
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
catch (_e) {
|
|
51
|
-
throw new Error('development signing key DID resolution failed');
|
|
52
|
-
}
|
|
54
|
+
const resolution = await agent.dids.resolve(did).catch((error) => {
|
|
55
|
+
throw new Error(`development signing key DID resolution failed: ${errorMessage(error)}`);
|
|
56
|
+
});
|
|
53
57
|
if (((_a = resolution.didResolutionMetadata) === null || _a === void 0 ? void 0 : _a.error) || !resolution.didDocument) {
|
|
54
|
-
throw new Error(
|
|
58
|
+
throw new Error(`development signing key DID resolution failed: ${(_c = (_b = resolution.didResolutionMetadata) === null || _b === void 0 ? void 0 : _b.error) !== null && _c !== void 0 ? _c : 'no DID document'}`);
|
|
55
59
|
}
|
|
56
60
|
if (resolution.didDocument.id !== did) {
|
|
57
61
|
throw new Error('development signing key DID resolution returned a different DID');
|
|
58
62
|
}
|
|
59
63
|
const methodId = `${did}#openid4vc-development-${role}`;
|
|
60
|
-
const
|
|
61
|
-
const purposes = [...new Set([basePurpose, ...extraPurposes])];
|
|
64
|
+
const purposes = [role === 'issuer' ? 'assertionMethod' : 'authentication'];
|
|
62
65
|
const publicJwk = canonicalP256PublicJwk(signingCertificate.certificate.publicJwk.toJson());
|
|
63
|
-
|
|
66
|
+
await ensureCreatedDidRecordKeyMapping(agent, did, methodId.slice(did.length), signingCertificate.keyId);
|
|
67
|
+
const existingMethod = (_d = resolution.didDocument.verificationMethod) === null || _d === void 0 ? void 0 : _d.find(method => method.id === methodId);
|
|
64
68
|
const published = (purpose) => {
|
|
65
69
|
var _a, _b;
|
|
66
70
|
return ((_b = (_a = resolution.didDocument) === null || _a === void 0 ? void 0 : _a[purpose]) !== null && _b !== void 0 ? _b : []).some(method => (typeof method === 'string' ? method : method.id) === methodId);
|
|
67
71
|
};
|
|
68
|
-
if (existingMethod &&
|
|
69
|
-
|
|
72
|
+
if (existingMethod &&
|
|
73
|
+
equalVerificationMethodJwk(existingMethod, publicJwk) &&
|
|
74
|
+
purposes.every(published) &&
|
|
75
|
+
contextValues(resolution.didDocument.context).includes(JSON_WEB_KEY_2020_CONTEXT)) {
|
|
76
|
+
return methodId;
|
|
70
77
|
}
|
|
71
78
|
const didDocument = core_1.DidDocument.fromJSON(resolution.didDocument.toJSON());
|
|
79
|
+
// A resolver that doesn't recognise JsonWebKey2020 rejects the method without this context, so it is
|
|
80
|
+
// published alongside the type.
|
|
81
|
+
didDocument.context = [...new Set([...contextValues(didDocument.context), JSON_WEB_KEY_2020_CONTEXT])];
|
|
72
82
|
didDocument.verificationMethod = [
|
|
73
|
-
...((
|
|
83
|
+
...((_e = didDocument.verificationMethod) !== null && _e !== void 0 ? _e : []).filter(method => method.id !== methodId),
|
|
74
84
|
new core_1.VerificationMethod({
|
|
75
85
|
id: methodId,
|
|
76
86
|
type: 'JsonWebKey2020',
|
|
77
|
-
// The kid ties the published method back to the KMS key. Without it Credo derives a
|
|
78
|
-
// legacy key id from the JWK when signing through the DID, which no backend holds.
|
|
79
87
|
publicKeyJwk: Object.assign(Object.assign({}, publicJwk), { kid: signingCertificate.keyId }),
|
|
80
88
|
controller: did,
|
|
81
89
|
}),
|
|
82
90
|
];
|
|
83
91
|
for (const purpose of purposes) {
|
|
84
92
|
didDocument[purpose] = [
|
|
85
|
-
...((
|
|
93
|
+
...((_f = didDocument[purpose]) !== null && _f !== void 0 ? _f : []).filter(method => (typeof method === 'string' ? method : method.id) !== methodId),
|
|
86
94
|
methodId,
|
|
87
95
|
];
|
|
88
96
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
catch (_f) {
|
|
94
|
-
throw new Error('development signing key DID update failed');
|
|
95
|
-
}
|
|
97
|
+
const update = await agent.dids.update({ did, didDocument }).catch((error) => {
|
|
98
|
+
throw new Error(`development signing key DID update failed: ${errorMessage(error)}`);
|
|
99
|
+
});
|
|
96
100
|
if (update.didState.state !== 'finished') {
|
|
97
|
-
|
|
101
|
+
const reason = (_g = update.didState.reason) !== null && _g !== void 0 ? _g : 'unknown reason';
|
|
102
|
+
throw new Error(`development signing key DID update failed: ${reason}`);
|
|
98
103
|
}
|
|
99
104
|
if (update.didState.did !== did || update.didState.didDocument.id !== did) {
|
|
100
105
|
throw new Error('development signing key DID update returned a different DID');
|
|
101
106
|
}
|
|
107
|
+
return methodId;
|
|
108
|
+
}
|
|
109
|
+
// Credo reads the KMS key-id mapping on the DidRecord, never the published `kid`, and registrars like
|
|
110
|
+
// did:webvh don't maintain it on update, so it is written here directly.
|
|
111
|
+
async function ensureCreatedDidRecordKeyMapping(agent, did, didDocumentRelativeKeyId, kmsKeyId) {
|
|
112
|
+
var _a;
|
|
113
|
+
const agentContext = agent.context;
|
|
114
|
+
const didRepository = agentContext.dependencyManager.resolve(core_1.DidRepository);
|
|
115
|
+
const didRecord = await didRepository.findCreatedDid(agentContext, did);
|
|
116
|
+
if (!didRecord)
|
|
117
|
+
throw new Error('development signing key DID record was not found');
|
|
118
|
+
const keys = (_a = didRecord.keys) !== null && _a !== void 0 ? _a : [];
|
|
119
|
+
if (keys.some(key => key.didDocumentRelativeKeyId === didDocumentRelativeKeyId && key.kmsKeyId === kmsKeyId)) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
didRecord.keys = [
|
|
123
|
+
...keys.filter(key => key.didDocumentRelativeKeyId !== didDocumentRelativeKeyId),
|
|
124
|
+
{ didDocumentRelativeKeyId, kmsKeyId },
|
|
125
|
+
];
|
|
126
|
+
await didRepository.update(agentContext, didRecord);
|
|
102
127
|
}
|
|
103
|
-
async function loadConfiguredSigningCertificate(agent, configured) {
|
|
128
|
+
async function loadConfiguredSigningCertificate(agent, configured, publicApiBaseUrl, role) {
|
|
104
129
|
var _a;
|
|
105
130
|
if (configured.certificateChain.length === 0) {
|
|
106
131
|
throw new Error('configured certificate chain must not be empty');
|
|
@@ -108,7 +133,6 @@ async function loadConfiguredSigningCertificate(agent, configured) {
|
|
|
108
133
|
const chain = configured.certificateChain.map(encoded => core_1.X509Certificate.fromEncodedCertificate(encoded));
|
|
109
134
|
assertCertificateChainUsable(chain);
|
|
110
135
|
const configuredChainEndpoint = configured.certificateChain[configured.certificateChain.length - 1];
|
|
111
|
-
// This trust endpoint is operator-configured signing material, never a peer-provided chain.
|
|
112
136
|
const validatedRootToLeafChain = await agent.x509.validateCertificateChain({
|
|
113
137
|
certificateChain: configured.certificateChain,
|
|
114
138
|
trustedCertificates: [configuredChainEndpoint],
|
|
@@ -123,6 +147,8 @@ async function loadConfiguredSigningCertificate(agent, configured) {
|
|
|
123
147
|
if (certificate.subject === certificate.issuer) {
|
|
124
148
|
throw new Error('configured leaf certificate must not be self-signed');
|
|
125
149
|
}
|
|
150
|
+
if (role === 'issuer')
|
|
151
|
+
assertCertificateSignsIssuedCredentials(certificate, publicApiBaseUrl);
|
|
126
152
|
const privatePublicJwk = canonicalP256PublicJwk(configured.privateJwk);
|
|
127
153
|
const certificatePublicJwk = canonicalP256PublicJwk(certificate.publicJwk.toJson());
|
|
128
154
|
if (!equalPublicJwk(privatePublicJwk, certificatePublicJwk)) {
|
|
@@ -147,18 +173,16 @@ async function loadConfiguredSigningCertificate(agent, configured) {
|
|
|
147
173
|
certificate.keyId = keyId;
|
|
148
174
|
return { certificate, chain: validatedChain, keyId, development: false };
|
|
149
175
|
}
|
|
150
|
-
async function loadDevelopmentSigningCertificate(agent,
|
|
151
|
-
if (development.enabled !== true) {
|
|
152
|
-
throw new Error('development certificate mode must be explicitly enabled');
|
|
153
|
-
}
|
|
176
|
+
async function loadDevelopmentSigningCertificate(agent, publicApiBaseUrl, role = 'issuer') {
|
|
154
177
|
if (!agent.did || !(0, core_1.tryParseDid)(agent.did)) {
|
|
155
178
|
throw new Error('development certificate mode requires an agent DID');
|
|
156
179
|
}
|
|
157
180
|
if (!publicApiBaseUrl) {
|
|
158
181
|
throw new Error('development certificate mode requires publicApiBaseUrl');
|
|
159
182
|
}
|
|
160
|
-
const hostname =
|
|
161
|
-
const
|
|
183
|
+
const hostname = new URL(publicApiBaseUrl).hostname;
|
|
184
|
+
const commonName = developmentCommonName(hostname, role);
|
|
185
|
+
const recordId = developmentRecordId(agent.did, hostname, role);
|
|
162
186
|
const existing = await agent.genericRecords.findById(recordId);
|
|
163
187
|
if (existing) {
|
|
164
188
|
try {
|
|
@@ -174,15 +198,9 @@ async function loadDevelopmentSigningCertificate(agent, development, publicApiBa
|
|
|
174
198
|
return { certificate, chain: [certificate], keyId: stored.keyId, development: true };
|
|
175
199
|
}
|
|
176
200
|
catch (error) {
|
|
177
|
-
// A KMS backend fault is not stale state: recreating on it would rotate a
|
|
178
|
-
// healthy certificate and break fingerprints pinned by verifiers.
|
|
179
201
|
if (error instanceof core_1.Kms.KeyManagementError && !(error instanceof core_1.Kms.KeyManagementKeyNotFoundError)) {
|
|
180
202
|
throw error;
|
|
181
203
|
}
|
|
182
|
-
// Development certificates are disposable. An expired certificate, an
|
|
183
|
-
// identity that no longer matches the DID or host, or a key id no KMS
|
|
184
|
-
// backend holds (records written by older builds) must not wedge the
|
|
185
|
-
// agent: drop the record and mint a fresh certificate below.
|
|
186
204
|
await agent.genericRecords.deleteById(recordId);
|
|
187
205
|
}
|
|
188
206
|
}
|
|
@@ -190,9 +208,9 @@ async function loadDevelopmentSigningCertificate(agent, development, publicApiBa
|
|
|
190
208
|
const authorityKey = core_1.Kms.PublicJwk.fromPublicJwk(publicJwk);
|
|
191
209
|
const now = new Date();
|
|
192
210
|
const certificate = await agent.x509.createCertificate({
|
|
193
|
-
serialNumber: (0,
|
|
211
|
+
serialNumber: (0, crypto_1.createHash)('sha256').update(keyId).digest('hex').slice(0, 32),
|
|
194
212
|
authorityKey,
|
|
195
|
-
issuer: { commonName
|
|
213
|
+
issuer: { commonName },
|
|
196
214
|
validity: {
|
|
197
215
|
notBefore: new Date(now.getTime() - 60000),
|
|
198
216
|
notAfter: new Date(now.getTime() + DEVELOPMENT_CERTIFICATE_VALIDITY_MS),
|
|
@@ -227,6 +245,18 @@ function assertCertificateChainUsable(chain, now = new Date()) {
|
|
|
227
245
|
}
|
|
228
246
|
}
|
|
229
247
|
}
|
|
248
|
+
// Credo matches the `iss` of an issued credential against the leaf SANs on both sign and verify, exactly: a
|
|
249
|
+
// wildcard or parent-domain SAN passes startup and then fails every redemption.
|
|
250
|
+
function assertCertificateSignsIssuedCredentials(certificate, publicApiBaseUrl) {
|
|
251
|
+
if (!publicApiBaseUrl) {
|
|
252
|
+
throw new Error('configured issuer certificate mode requires publicApiBaseUrl');
|
|
253
|
+
}
|
|
254
|
+
const hostname = new URL(publicApiBaseUrl).hostname;
|
|
255
|
+
if (certificate.sanUriNames.includes(publicApiBaseUrl) || certificate.sanDnsNames.includes(hostname)) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
throw new Error(`configured issuer certificate must carry '${publicApiBaseUrl}' as a URI SAN or '${hostname}' as a DNS SAN`);
|
|
259
|
+
}
|
|
230
260
|
function assertDevelopmentCertificateIdentity(certificate, expectedDid, expectedHostname) {
|
|
231
261
|
if (certificate.subject !== certificate.issuer) {
|
|
232
262
|
throw new Error('stored development certificate is not self-signed');
|
|
@@ -239,7 +269,7 @@ function assertDevelopmentCertificateIdentity(certificate, expectedDid, expected
|
|
|
239
269
|
}
|
|
240
270
|
}
|
|
241
271
|
function canonicalP256PublicJwk(jwk) {
|
|
242
|
-
if (!isRecord(jwk))
|
|
272
|
+
if (!(0, isRecord_1.isRecord)(jwk))
|
|
243
273
|
throw new Error('certificate signing key must be a P-256 key');
|
|
244
274
|
if (jwk.kty !== 'EC' || jwk.crv !== 'P-256' || typeof jwk.x !== 'string' || typeof jwk.y !== 'string') {
|
|
245
275
|
throw new Error('certificate signing key must be a P-256 key');
|
|
@@ -249,6 +279,14 @@ function canonicalP256PublicJwk(jwk) {
|
|
|
249
279
|
function equalPublicJwk(left, right) {
|
|
250
280
|
return left.kty === right.kty && left.crv === right.crv && left.x === right.x && left.y === right.y;
|
|
251
281
|
}
|
|
282
|
+
function contextValues(context) {
|
|
283
|
+
if (!context)
|
|
284
|
+
return [];
|
|
285
|
+
return Array.isArray(context) ? context : [context];
|
|
286
|
+
}
|
|
287
|
+
function errorMessage(error) {
|
|
288
|
+
return error instanceof Error ? error.message : String(error);
|
|
289
|
+
}
|
|
252
290
|
function equalVerificationMethodJwk(method, expected) {
|
|
253
291
|
try {
|
|
254
292
|
return equalPublicJwk(canonicalP256PublicJwk(method.publicKeyJwk), expected);
|
|
@@ -257,19 +295,11 @@ function equalVerificationMethodJwk(method, expected) {
|
|
|
257
295
|
return false;
|
|
258
296
|
}
|
|
259
297
|
}
|
|
260
|
-
function
|
|
261
|
-
|
|
262
|
-
const hostname = new URL(publicApiBaseUrl).hostname;
|
|
263
|
-
if (!hostname)
|
|
264
|
-
throw new Error();
|
|
265
|
-
return hostname;
|
|
266
|
-
}
|
|
267
|
-
catch (_a) {
|
|
268
|
-
throw new Error('development certificate mode requires a valid publicApiBaseUrl');
|
|
269
|
-
}
|
|
298
|
+
function developmentCommonName(hostname, role) {
|
|
299
|
+
return `${hostname} ${role}`;
|
|
270
300
|
}
|
|
271
|
-
function developmentRecordId(did, hostname,
|
|
272
|
-
const suffix = (0,
|
|
301
|
+
function developmentRecordId(did, hostname, role) {
|
|
302
|
+
const suffix = (0, crypto_1.createHash)('sha256').update(`${did}\0${hostname}\0${role}`).digest('hex');
|
|
273
303
|
return `${DEVELOPMENT_RECORD_PREFIX}:${suffix}`;
|
|
274
304
|
}
|
|
275
305
|
function parseDevelopmentRecord(content) {
|
|
@@ -278,7 +308,10 @@ function parseDevelopmentRecord(content) {
|
|
|
278
308
|
}
|
|
279
309
|
return { certificate: content.certificate, keyId: content.keyId };
|
|
280
310
|
}
|
|
281
|
-
|
|
282
|
-
|
|
311
|
+
// HAIP forbids the trust anchor inside `x5c`, so a configured chain drops its self-signed root.
|
|
312
|
+
function x5cCertificateChain(signingCertificate) {
|
|
313
|
+
if (signingCertificate.development)
|
|
314
|
+
return signingCertificate.chain;
|
|
315
|
+
return signingCertificate.chain.filter((certificate, index, chain) => index !== chain.length - 1 || certificate.subject !== certificate.issuer);
|
|
283
316
|
}
|
|
284
317
|
//# sourceMappingURL=CertificateService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CertificateService.js","sourceRoot":"","sources":["../../src/services/CertificateService.ts"],"names":[],"mappings":";;AAqCA,wDAWC;AAcD,wDAWC;AAED,kEAOC;AAOD,oEAsEC;AAoJD,oEASC;AAzTD,yCAQuB;AACvB,6CAAwC;AAExC,MAAM,mCAAmC,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAK,CAAA;AACtE,MAAM,yBAAyB,GAAG,+BAA+B,CAAA;AAsBjE,SAAgB,sBAAsB,CACpC,IAAiB,EACjB,MAAgC;IAEhC,MA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|
|
1
|
-
import type { OpenId4VcPluginOptions } from '../types';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { OpenId4VcAgent, OpenId4VcIssuerSink, OpenId4VcPluginOptions } from '../types';
|
|
2
|
+
import type { OnModuleInit } from '@nestjs/common';
|
|
3
|
+
import type { OpenId4VcIssuanceSessionState, OpenId4VciCredentialRequestToCredentialMapper } from '@credo-ts/openid4vc';
|
|
4
4
|
import { type SigningCertificateInfo } from './CertificateService';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
5
|
+
export interface OpenId4VcCreateOfferOptions {
|
|
6
|
+
jsonSchemaCredentialId: string;
|
|
7
|
+
claims: unknown;
|
|
8
|
+
ttlSeconds: unknown;
|
|
9
|
+
statusListId?: string;
|
|
10
|
+
statusListIndex?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface OpenId4VcIssuanceSessionFilters {
|
|
13
|
+
jsonSchemaCredentialId?: string;
|
|
14
|
+
state?: OpenId4VcIssuanceSessionState;
|
|
15
|
+
}
|
|
17
16
|
export interface OpenId4VcOfferResult {
|
|
18
17
|
credentialOffer: string;
|
|
19
18
|
issuanceSessionId: string;
|
|
20
19
|
}
|
|
21
|
-
export interface
|
|
20
|
+
export interface OpenId4VcIssuanceSessionSummary {
|
|
22
21
|
id: string;
|
|
23
|
-
|
|
22
|
+
jsonSchemaCredentialId: string;
|
|
23
|
+
state: OpenId4VcIssuanceSessionState;
|
|
24
24
|
createdAt: Date;
|
|
25
|
+
updatedAt: Date;
|
|
25
26
|
expiresAt?: Date;
|
|
27
|
+
errorMessage?: string;
|
|
26
28
|
}
|
|
27
|
-
export declare class
|
|
28
|
-
}
|
|
29
|
-
export declare class OpenId4VcOfferNotFoundError extends Error {
|
|
30
|
-
}
|
|
31
|
-
export declare class IssuerService {
|
|
29
|
+
export declare class IssuerService implements OnModuleInit {
|
|
32
30
|
private readonly agent;
|
|
33
31
|
private readonly options;
|
|
32
|
+
private readonly publishIssuerService;
|
|
34
33
|
private initialization?;
|
|
35
34
|
private signingCertificate?;
|
|
36
|
-
private
|
|
37
|
-
private
|
|
38
|
-
|
|
35
|
+
private replacement;
|
|
36
|
+
private readonly typeMetadataIntegrity;
|
|
37
|
+
/**
|
|
38
|
+
* DEMO ONLY (AGENT_UNSAFE_SKIP_OWN_AUTHORIZATION): the credential types the agent offers
|
|
39
|
+
* without an ISSUER Participant, keyed by `jsonSchemaCredentialId`. Each refresh keeps them.
|
|
40
|
+
*/
|
|
41
|
+
private readonly unaccreditedConfigurations;
|
|
42
|
+
constructor(agent: OpenId4VcAgent, options: OpenId4VcPluginOptions, publishIssuerService: OpenId4VcIssuerSink);
|
|
43
|
+
onModuleInit(): Promise<void>;
|
|
44
|
+
refreshCredentialConfigurations(updatedCredentialSchemaId?: number): Promise<void>;
|
|
39
45
|
ensureInitialized(): Promise<void>;
|
|
40
|
-
createOffer(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
* own VPR access from its $ref + digestSRI. The spec's additional-property
|
|
49
|
-
* extensibility keeps plain SD-JWT VC consumers unaffected. */
|
|
50
|
-
getVctMetadata(configurationId: string): VtSdJwtVcTypeMetadata | undefined;
|
|
46
|
+
createOffer({ jsonSchemaCredentialId, claims, ttlSeconds, statusListId, statusListIndex, }: OpenId4VcCreateOfferOptions): Promise<OpenId4VcOfferResult>;
|
|
47
|
+
getIssuanceSession(id: string): Promise<OpenId4VcIssuanceSessionSummary>;
|
|
48
|
+
listIssuanceSessions(filters?: OpenId4VcIssuanceSessionFilters): Promise<OpenId4VcIssuanceSessionSummary[]>;
|
|
49
|
+
deleteIssuanceSession(id: string): Promise<void>;
|
|
50
|
+
private findOwnedSession;
|
|
51
|
+
private credentialExchangeStateUpdated;
|
|
52
|
+
getCertificateInfo(): Promise<SigningCertificateInfo>;
|
|
53
|
+
getJwtVcIssuerMetadata(): Record<string, unknown>;
|
|
51
54
|
mapCredentialRequest: OpenId4VciCredentialRequestToCredentialMapper;
|
|
52
55
|
private initialize;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
private assertTypeMetadataReadable;
|
|
57
|
+
private replaceCredentialConfigurations;
|
|
58
|
+
private deriveAndRender;
|
|
59
|
+
private deriveCredentialConfigurations;
|
|
60
|
+
/** DEMO ONLY: AGENT_UNSAFE_SKIP_OWN_AUTHORIZATION, read from the trust service of the agent. */
|
|
61
|
+
private get skipsOwnAuthorization();
|
|
62
|
+
/**
|
|
63
|
+
* DEMO ONLY (AGENT_UNSAFE_SKIP_OWN_AUTHORIZATION): derive the credential type of a VTJSC for
|
|
64
|
+
* which the agent holds no ISSUER Participant, add it to the issuer metadata, and return it.
|
|
65
|
+
* Returns undefined when the flag is off.
|
|
66
|
+
*/
|
|
67
|
+
private addUnaccreditedConfiguration;
|
|
68
|
+
/**
|
|
69
|
+
* DEMO ONLY (AGENT_UNSAFE_SKIP_OWN_AUTHORIZATION): after a restart, add again the credential
|
|
70
|
+
* types of the existing issuance sessions, so that a wallet can still redeem a pending offer.
|
|
71
|
+
*/
|
|
72
|
+
private restoreUnaccreditedConfigurations;
|
|
58
73
|
private createOrUpdateIssuer;
|
|
59
74
|
private credentialConfigurationsSupported;
|
|
75
|
+
private sessionRepository;
|
|
60
76
|
private issuerApi;
|
|
61
|
-
private issuerOptions;
|
|
62
77
|
private signingCertificateHandle;
|
|
63
|
-
private assertInitialized;
|
|
64
78
|
}
|
|
65
|
-
export {};
|