@verana-labs/vs-agent-sdk 2.0.0-dev.6 → 2.0.0-dev.60
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 +0 -2
- package/build/adminApi/AdminApiError.d.ts +25 -0
- package/build/adminApi/AdminApiError.js +57 -0
- package/build/adminApi/AdminApiError.js.map +1 -0
- package/build/adminApi/didcommModules.d.ts +2 -0
- package/build/adminApi/didcommModules.js +8 -0
- package/build/adminApi/didcommModules.js.map +1 -0
- package/build/adminApi/index.d.ts +3 -0
- package/build/adminApi/index.js +20 -0
- package/build/adminApi/index.js.map +1 -0
- package/build/adminApi/moduleEndpoint.d.ts +8 -0
- package/build/adminApi/moduleEndpoint.js +28 -0
- package/build/adminApi/moduleEndpoint.js.map +1 -0
- package/build/agent/VsAgent.d.ts +15 -33
- package/build/agent/VsAgent.js +75 -205
- package/build/agent/VsAgent.js.map +1 -1
- package/build/agent/createVsAgent.d.ts +5 -5
- package/build/agent/createVsAgent.js +3 -5
- package/build/agent/createVsAgent.js.map +1 -1
- package/build/blockchain/AnonCredsTrustService.d.ts +62 -0
- package/build/blockchain/AnonCredsTrustService.js +256 -0
- package/build/blockchain/AnonCredsTrustService.js.map +1 -0
- package/build/blockchain/AuthorizationService.d.ts +5 -3
- package/build/blockchain/AuthorizationService.js +17 -29
- package/build/blockchain/AuthorizationService.js.map +1 -1
- package/build/blockchain/IndexerWebSocketService.d.ts +7 -1
- package/build/blockchain/IndexerWebSocketService.js +68 -36
- package/build/blockchain/IndexerWebSocketService.js.map +1 -1
- package/build/blockchain/VeranaChainService.d.ts +2 -13
- package/build/blockchain/VeranaChainService.js +8 -113
- package/build/blockchain/VeranaChainService.js.map +1 -1
- package/build/blockchain/VeranaIndexerService.d.ts +14 -1
- package/build/blockchain/VeranaIndexerService.js +122 -8
- package/build/blockchain/VeranaIndexerService.js.map +1 -1
- package/build/blockchain/handlers/authorizationHandlers.js +2 -2
- package/build/blockchain/handlers/authorizationHandlers.js.map +1 -1
- package/build/blockchain/handlers/defaultHandlers.js +2 -0
- package/build/blockchain/handlers/defaultHandlers.js.map +1 -1
- package/build/blockchain/handlers/index.d.ts +1 -0
- package/build/blockchain/handlers/index.js +1 -0
- package/build/blockchain/handlers/index.js.map +1 -1
- package/build/blockchain/handlers/selfIssuanceHandlers.d.ts +13 -0
- package/build/blockchain/handlers/selfIssuanceHandlers.js +71 -0
- package/build/blockchain/handlers/selfIssuanceHandlers.js.map +1 -0
- package/build/blockchain/handlers/stateMutations.d.ts +21 -2
- package/build/blockchain/handlers/stateMutations.js +280 -34
- package/build/blockchain/handlers/stateMutations.js.map +1 -1
- package/build/blockchain/index.d.ts +2 -0
- package/build/blockchain/index.js +2 -0
- package/build/blockchain/index.js.map +1 -1
- package/build/blockchain/indexerMappers.d.ts +3 -0
- package/build/blockchain/indexerMappers.js +53 -0
- package/build/blockchain/indexerMappers.js.map +1 -0
- package/build/blockchain/types.d.ts +5 -57
- package/build/blockchain/types.js.map +1 -1
- package/build/bootstrap/EcsBootstrapService.d.ts +14 -3
- package/build/bootstrap/EcsBootstrapService.js +155 -76
- package/build/bootstrap/EcsBootstrapService.js.map +1 -1
- package/build/credentials/FullTailsFileService.d.ts +0 -1
- package/build/credentials/FullTailsFileService.js +0 -49
- package/build/credentials/FullTailsFileService.js.map +1 -1
- package/build/did/CachedDocumentLoader.d.ts +3 -0
- package/build/did/CachedDocumentLoader.js +7 -1
- package/build/did/CachedDocumentLoader.js.map +1 -1
- package/build/did/CachedWebDidResolver.d.ts +0 -4
- package/build/did/CachedWebDidResolver.js +1 -5
- package/build/did/CachedWebDidResolver.js.map +1 -1
- package/build/did/artifactServices.d.ts +12 -0
- package/build/did/artifactServices.js +48 -0
- package/build/did/artifactServices.js.map +1 -0
- package/build/did/legacyDidWeb.d.ts +6 -4
- package/build/did/legacyDidWeb.js +17 -14
- package/build/did/legacyDidWeb.js.map +1 -1
- package/build/did/publicDid.d.ts +4 -0
- package/build/did/publicDid.js +19 -0
- package/build/did/publicDid.js.map +1 -0
- package/build/events/BaseMessageEvents.js +139 -5
- package/build/events/BaseMessageEvents.js.map +1 -1
- package/build/events/ConnectionEvents.js +110 -82
- package/build/events/ConnectionEvents.js.map +1 -1
- package/build/events/VsAgentEvents.d.ts +11 -9
- package/build/events/VsAgentEvents.js +8 -1
- package/build/events/VsAgentEvents.js.map +1 -1
- package/build/events/VtFlowEvents.d.ts +1 -1
- package/build/events/VtFlowEvents.js +2 -19
- package/build/events/VtFlowEvents.js.map +1 -1
- package/build/index.d.ts +6 -1
- package/build/index.js +10 -2
- package/build/index.js.map +1 -1
- package/build/plugins/setupBaseDidComm.js +6 -12
- package/build/plugins/setupBaseDidComm.js.map +1 -1
- package/build/transports/VsAgentWsInboundTransport.d.ts +1 -1
- package/build/transports/VsAgentWsInboundTransport.js +20 -14
- package/build/transports/VsAgentWsInboundTransport.js.map +1 -1
- package/build/types.d.ts +5 -0
- package/build/types.js.map +1 -1
- package/build/utils/agent.d.ts +27 -3
- package/build/utils/agent.js +83 -22
- package/build/utils/agent.js.map +1 -1
- package/build/utils/didReadiness.d.ts +9 -0
- package/build/utils/didReadiness.js +42 -0
- package/build/utils/didReadiness.js.map +1 -0
- package/build/utils/ecsClaims.d.ts +47 -0
- package/build/utils/ecsClaims.js +120 -0
- package/build/utils/ecsClaims.js.map +1 -0
- package/build/utils/ecsService.d.ts +8 -0
- package/build/utils/ecsService.js +23 -0
- package/build/utils/ecsService.js.map +1 -0
- package/build/utils/index.d.ts +4 -0
- package/build/utils/index.js +4 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/selfIssuedEcsCredential.d.ts +8 -0
- package/build/utils/selfIssuedEcsCredential.js +151 -0
- package/build/utils/selfIssuedEcsCredential.js.map +1 -0
- package/build/utils/setupSelfTr.d.ts +29 -66
- package/build/utils/setupSelfTr.js +78 -282
- package/build/utils/setupSelfTr.js.map +1 -1
- package/build/utils/trustCredentialStore.d.ts +67 -9
- package/build/utils/trustCredentialStore.js +296 -109
- package/build/utils/trustCredentialStore.js.map +1 -1
- package/build/utils/util.d.ts +10 -0
- package/build/utils/util.js +16 -0
- package/build/utils/util.js.map +1 -1
- package/build/utils/vcdm2.d.ts +34 -0
- package/build/utils/vcdm2.js +62 -0
- package/build/utils/vcdm2.js.map +1 -0
- package/build/utils/vtjscResolver.d.ts +18 -0
- package/build/utils/vtjscResolver.js +54 -0
- package/build/utils/vtjscResolver.js.map +1 -0
- package/build/vtFlow/VtFlowOrchestrator.d.ts +59 -13
- package/build/vtFlow/VtFlowOrchestrator.js +139 -91
- package/build/vtFlow/VtFlowOrchestrator.js.map +1 -1
- package/build/vtFlow/assertVerifiableService.d.ts +1 -0
- package/build/vtFlow/assertVerifiableService.js +45 -5
- package/build/vtFlow/assertVerifiableService.js.map +1 -1
- package/build/vtFlow/ecsIssuanceExemption.d.ts +12 -0
- package/build/vtFlow/ecsIssuanceExemption.js +84 -0
- package/build/vtFlow/ecsIssuanceExemption.js.map +1 -0
- package/build/vtFlow/index.d.ts +1 -0
- package/build/vtFlow/index.js +1 -0
- package/build/vtFlow/index.js.map +1 -1
- package/package.json +12 -12
- package/build/did/migrateWebVhLog.d.ts +0 -34
- package/build/did/migrateWebVhLog.js +0 -230
- package/build/did/migrateWebVhLog.js.map +0 -1
- package/build/did/migrateWebVhVersionTime.d.ts +0 -9
- package/build/did/migrateWebVhVersionTime.js +0 -191
- package/build/did/migrateWebVhVersionTime.js.map +0 -1
|
@@ -3,55 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.sortKeysDeep = exports.linkedVpFragment = exports.linkedVpSchemaId = exports.createJsonSubjectRef = exports.createJsonSchema = void 0;
|
|
7
7
|
exports.createCredential = createCredential;
|
|
8
|
+
exports.getDataIntegrityCryptosuite = getDataIntegrityCryptosuite;
|
|
8
9
|
exports.signerW3c = signerW3c;
|
|
9
|
-
exports.generateVerifiablePresentation = generateVerifiablePresentation;
|
|
10
10
|
exports.createPresentation = createPresentation;
|
|
11
11
|
exports.getClaims = getClaims;
|
|
12
12
|
exports.validateSchema = validateSchema;
|
|
13
13
|
exports.addDigestSRI = addDigestSRI;
|
|
14
14
|
exports.generateDigestSRI = generateDigestSRI;
|
|
15
|
-
exports.urlDigestSri = urlDigestSri;
|
|
16
15
|
exports.getVerificationMethodId = getVerificationMethodId;
|
|
17
16
|
const core_1 = require("@credo-ts/core");
|
|
18
|
-
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
20
|
-
//@ts-expect-error
|
|
21
|
-
const jsonld_signatures_1 = require("@digitalcredentials/jsonld-signatures");
|
|
17
|
+
const credo_ts_didcomm_vt_flow_1 = require("@verana-labs/credo-ts-didcomm-vt-flow");
|
|
22
18
|
const vs_agent_model_1 = require("@verana-labs/vs-agent-model");
|
|
23
19
|
const _2020_1 = __importDefault(require("ajv/dist/2020"));
|
|
24
20
|
const ajv_formats_1 = __importDefault(require("ajv-formats"));
|
|
25
|
-
const axios_1 = __importDefault(require("axios"));
|
|
26
21
|
const crypto_1 = require("crypto");
|
|
27
|
-
const
|
|
28
|
-
const
|
|
22
|
+
const ecsClaims_1 = require("./ecsClaims");
|
|
23
|
+
const vcdm2_1 = require("./vcdm2");
|
|
24
|
+
const ajv = new _2020_1.default({ strict: false, allErrors: true });
|
|
29
25
|
(0, ajv_formats_1.default)(ajv);
|
|
30
|
-
const DIGEST_FETCH_TIMEOUT_MS = 5000;
|
|
31
|
-
// Helpers
|
|
32
|
-
exports.presentations = [
|
|
33
|
-
{
|
|
34
|
-
name: 'ecs-service',
|
|
35
|
-
schemaUrl: `ecosystem/schemas-example-service-jsc.json`,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: 'ecs-org',
|
|
39
|
-
schemaUrl: `ecosystem/schemas-example-org-jsc.json`,
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
exports.credentials = [
|
|
43
|
-
{
|
|
44
|
-
name: 'example-service',
|
|
45
|
-
credUrl: `ecosystem/cs/v1/js/ecs-service`,
|
|
46
|
-
schemaUrl: `ecosystem/schemas-example-service-jsc.json`,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: 'example-org',
|
|
50
|
-
credUrl: `ecosystem/cs/v1/js/ecs-org`,
|
|
51
|
-
schemaUrl: `ecosystem/schemas-example-org-jsc.json`,
|
|
52
|
-
},
|
|
53
|
-
];
|
|
54
|
-
// Default JSON Schema objects
|
|
55
26
|
exports.createJsonSchema = {
|
|
56
27
|
id: 'https://www.w3.org/ns/credentials/json-schema/v2.json',
|
|
57
28
|
type: 'JsonSchema',
|
|
@@ -67,223 +38,71 @@ const createJsonSubjectRef = (id) => ({
|
|
|
67
38
|
});
|
|
68
39
|
exports.createJsonSubjectRef = createJsonSubjectRef;
|
|
69
40
|
// fragment format per [VT-CRED-W3C-LINKED-VP]
|
|
70
|
-
const
|
|
41
|
+
const linkedVpSchemaId = (schemaKey) => schemaKey.replace(/^ecs-/, '');
|
|
42
|
+
exports.linkedVpSchemaId = linkedVpSchemaId;
|
|
43
|
+
const linkedVpFragment = (schemaKey) => `vpr-schemas-${(0, exports.linkedVpSchemaId)(schemaKey)}-vtc-vp`;
|
|
71
44
|
exports.linkedVpFragment = linkedVpFragment;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
for (const { name, credUrl, schemaUrl } of exports.credentials) {
|
|
92
|
-
const id = (0, exports.mapToSelfTr)(schemaUrl, publicApiBaseUrl);
|
|
93
|
-
const ref = (0, exports.mapToSelfTr)(credUrl, publicApiBaseUrl);
|
|
94
|
-
try {
|
|
95
|
-
await generateVerifiableCredential(agent, id, ecsSchemas, name, ['VerifiableCredential', 'JsonSchemaCredential'], (0, exports.createJsonSubjectRef)(ref), exports.createJsonSchema, defaults);
|
|
96
|
-
}
|
|
97
|
-
catch (error) {
|
|
98
|
-
logger.warn(`Skipping self-issued ${name}: ${error instanceof Error ? error.message : error}`);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
45
|
+
// A plain array replacer only allowlists property names, applied at every
|
|
46
|
+
// nesting level — nested objects like `claims` and `credentialSchema` would
|
|
47
|
+
// serialize to `{}` since none of their own keys appear in a top-level
|
|
48
|
+
// key list. Sort keys recursively instead, so the hash actually reflects
|
|
49
|
+
// nested content and changes to claims invalidate the cache correctly.
|
|
50
|
+
const sortKeysDeep = (value) => {
|
|
51
|
+
if (Array.isArray(value))
|
|
52
|
+
return value.map(exports.sortKeysDeep);
|
|
53
|
+
if (value !== null && typeof value === 'object') {
|
|
54
|
+
return Object.keys(value)
|
|
55
|
+
.sort()
|
|
56
|
+
.reduce((acc, key) => {
|
|
57
|
+
acc[key] = (0, exports.sortKeysDeep)(value[key]);
|
|
58
|
+
return acc;
|
|
59
|
+
}, {});
|
|
60
|
+
}
|
|
61
|
+
return value;
|
|
101
62
|
};
|
|
102
|
-
exports.
|
|
63
|
+
exports.sortKeysDeep = sortKeysDeep;
|
|
103
64
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* - If the claims for the subject are not provided, they are retrieved (default claims) and validated against the schema.
|
|
108
|
-
* - The integrity of the claims is tracked using a Subresource Integrity (SRI) digest.
|
|
109
|
-
* - If a credential with the same integrity already exists in the DID metadata, it is returned directly.
|
|
110
|
-
* - Otherwise, a new credential is created, signed, and stored in the DID metadata.
|
|
111
|
-
* - If a presentation is provided, the signed credential is embedded and a signed presentation is returned.
|
|
112
|
-
*
|
|
113
|
-
* @param agent - The VsAgent instance used for signing and DID management.
|
|
114
|
-
* @param logger - Logger instance for logging operations.
|
|
115
|
-
* @param ecsSchemas - Map of ECS schemas for validation.
|
|
116
|
-
* @param schemaKey - Unique identifier for the credential type and metadata key.
|
|
117
|
-
* @param type - Array of credential types (e.g., ['VerifiableCredential']).
|
|
118
|
-
* @param subject - Subject information, including ID and optional claims.
|
|
119
|
-
* @param credentialSchema - Schema definition for the credential.
|
|
120
|
-
* @param presentation - Optional presentation to include the credential.
|
|
121
|
-
* @returns The signed verifiable credential or presentation, with integrity metadata.
|
|
65
|
+
* Builds an unsigned credential: a VC Data Model 2.0 credential, as
|
|
66
|
+
* [VT-CRED-W3C] and [VT-JSON-SCHEMA-CRED-W3C] require the `https://www.w3.org/ns/credentials/v2`
|
|
67
|
+
* context, valid from now for ten years unless told otherwise.
|
|
122
68
|
*/
|
|
123
|
-
async function generateVerifiableCredential(agent, id, ecsSchemas, schemaKey, type, subject, credentialSchema, defaults, presentation) {
|
|
124
|
-
var _a;
|
|
125
|
-
const logger = agent.config.logger;
|
|
126
|
-
const [didRecord] = await agent.dids.getCreatedDids({ did: agent.did });
|
|
127
|
-
const { id: subjectId } = subject;
|
|
128
|
-
let claims = subject.claims;
|
|
129
|
-
if (!claims) {
|
|
130
|
-
claims = await getClaims(logger, ecsSchemas, { id: subjectId }, schemaKey, defaults);
|
|
131
|
-
}
|
|
132
|
-
const integrityData = buildIntegrityData({ id, type, credentialSchema, claims });
|
|
133
|
-
const record = (_a = didRecord.metadata.get('_vt/jsc')) !== null && _a !== void 0 ? _a : {};
|
|
134
|
-
const metadata = record[subjectId];
|
|
135
|
-
if ((metadata === null || metadata === void 0 ? void 0 : metadata.integrityData) === integrityData)
|
|
136
|
-
return metadata.credential;
|
|
137
|
-
const unsignedCredential = createCredential({
|
|
138
|
-
id,
|
|
139
|
-
type,
|
|
140
|
-
issuer: agent.did,
|
|
141
|
-
credentialSubject: {
|
|
142
|
-
id: subjectId,
|
|
143
|
-
claims: presentation ? claims : await addDigestSRI(subjectId, claims, ecsSchemas),
|
|
144
|
-
},
|
|
145
|
-
});
|
|
146
|
-
unsignedCredential.credentialSchema = presentation
|
|
147
|
-
? credentialSchema
|
|
148
|
-
: await addDigestSRI(credentialSchema.id, credentialSchema, ecsSchemas);
|
|
149
|
-
// Note: this is dependant on DIDComm invitation keys. Not sure if it is fine or we should use a dedicated
|
|
150
|
-
// key for this feature
|
|
151
|
-
const verificationMethodId = getVerificationMethodId(logger, didRecord);
|
|
152
|
-
const signedCredential = await signerW3c(agent, unsignedCredential, verificationMethodId);
|
|
153
|
-
if (presentation) {
|
|
154
|
-
presentation.verifiableCredential = [signedCredential];
|
|
155
|
-
return await signerW3c(agent, presentation, verificationMethodId);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
record[subjectId] = {
|
|
159
|
-
credential: signedCredential.jsonCredential,
|
|
160
|
-
verifiablePresentation: {},
|
|
161
|
-
didDocumentServiceId: '',
|
|
162
|
-
integrityData,
|
|
163
|
-
};
|
|
164
|
-
didRecord.metadata.set('_vt/jsc', record);
|
|
165
|
-
await agent.context.dependencyManager.resolve(core_1.DidRepository).update(agent.context, didRecord);
|
|
166
|
-
return signedCredential.jsonCredential;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
69
|
function createCredential(options) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
70
|
+
return (0, vcdm2_1.createW3cV2Credential)(options);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The Data Integrity cryptosuite this agent is configured with, read from the registered
|
|
74
|
+
* `VtFlowModuleConfig` so the self issued credentials are secured and linked VPs with the
|
|
75
|
+
* same suite `VtFlowApi.issueCredentialForSession` applies to the credentials it issues. Falls back
|
|
76
|
+
* to the module default when the vt-flow module is not registered on the agent.
|
|
77
|
+
*/
|
|
78
|
+
function getDataIntegrityCryptosuite(agent) {
|
|
79
|
+
const { dependencyManager } = agent.context;
|
|
80
|
+
return dependencyManager.isRegistered(credo_ts_didcomm_vt_flow_1.VtFlowModuleConfig)
|
|
81
|
+
? dependencyManager.resolve(credo_ts_didcomm_vt_flow_1.VtFlowModuleConfig).dataIntegrityCryptosuite
|
|
82
|
+
: credo_ts_didcomm_vt_flow_1.DEFAULT_DATA_INTEGRITY_CRYPTOSUITE;
|
|
178
83
|
}
|
|
179
84
|
async function signerW3c(agent, obj, verificationMethod) {
|
|
180
|
-
const
|
|
181
|
-
if (obj instanceof core_1.
|
|
182
|
-
return await agent.
|
|
183
|
-
format: core_1.ClaimFormat.
|
|
85
|
+
const cryptosuite = getDataIntegrityCryptosuite(agent);
|
|
86
|
+
if (obj instanceof core_1.W3cV2Credential) {
|
|
87
|
+
return await agent.w3cV2Credentials.signCredential({
|
|
88
|
+
format: core_1.ClaimFormat.DiVc,
|
|
184
89
|
credential: obj,
|
|
185
|
-
|
|
90
|
+
cryptosuite,
|
|
186
91
|
verificationMethod,
|
|
187
|
-
proofPurpose,
|
|
188
92
|
});
|
|
189
93
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Generates and signs a verifiable presentation containing a verifiable credential.
|
|
202
|
-
* Stores the signed presentation and its integrity metadata in the DID record.
|
|
203
|
-
*
|
|
204
|
-
* - Retrieves and validates claims for the agent's DID.
|
|
205
|
-
* - Computes an integrity digest for the claims.
|
|
206
|
-
* - If a presentation with the same integrity already exists in the DID metadata, it is returned.
|
|
207
|
-
* - Otherwise, a new presentation is created, signed, and stored in the DID metadata.
|
|
208
|
-
*
|
|
209
|
-
* @param agent - The VsAgent instance used for signing and DID management.
|
|
210
|
-
* @param logger - Logger instance for logging operations.
|
|
211
|
-
* @param ecsSchemas - Map of ECS schemas for validation.
|
|
212
|
-
* @param schemaKey - Unique identifier for the presentation type and metadata key.
|
|
213
|
-
* @param type - Array of credential types to include.
|
|
214
|
-
* @param credentialSchema - Schema definition for the credential.
|
|
215
|
-
* @returns The signed verifiable presentation, with integrity metadata.
|
|
216
|
-
*/
|
|
217
|
-
async function generateVerifiablePresentation(agent, id, ecsSchemas, schemaKey, type, credentialSchema, defaults) {
|
|
218
|
-
var _a, _b, _c, _d;
|
|
219
|
-
if (!agent.did)
|
|
220
|
-
throw Error('The DID must be set up');
|
|
221
|
-
const [didRecord] = await agent.dids.getCreatedDids({ did: agent.did });
|
|
222
|
-
const didDocument = didRecord.didDocument;
|
|
223
|
-
if (!didDocument)
|
|
224
|
-
throw Error('The DID Document be set up');
|
|
225
|
-
const claims = await getClaims(agent.config.logger, ecsSchemas, { id: agent.did }, schemaKey, defaults);
|
|
226
|
-
// Use full input for integrityData to ensure update detection
|
|
227
|
-
const didDocumentServiceId = `${agent.did}#${(0, exports.linkedVpFragment)(schemaKey)}`;
|
|
228
|
-
const integrityData = buildIntegrityData({ id, type, credentialSchema, claims });
|
|
229
|
-
const record = (_a = didRecord.metadata.get('_vt/vtc')) !== null && _a !== void 0 ? _a : {};
|
|
230
|
-
const metadata = record[credentialSchema.id];
|
|
231
|
-
if ((metadata === null || metadata === void 0 ? void 0 : metadata.integrityData) === integrityData && metadata.attached)
|
|
232
|
-
return metadata.verifiablePresentation;
|
|
233
|
-
const presentation = createPresentation({
|
|
234
|
-
id,
|
|
235
|
-
holder: agent.did,
|
|
236
|
-
verifiableCredential: [],
|
|
94
|
+
// The options type requires a challenge for every presentation format, while a Data Integrity
|
|
95
|
+
// proof only carries one when it is given
|
|
96
|
+
return await agent.w3cV2Credentials.signPresentation({
|
|
97
|
+
format: core_1.ClaimFormat.DiVp,
|
|
98
|
+
presentation: obj,
|
|
99
|
+
cryptosuite,
|
|
100
|
+
verificationMethod,
|
|
237
101
|
});
|
|
238
|
-
const verifiablePresentation = await generateVerifiableCredential(agent, agent.did, ecsSchemas, schemaKey, type, { id: agent.did }, credentialSchema, defaults, presentation);
|
|
239
|
-
// Update linked VP when the presentation has changed
|
|
240
|
-
didDocument.service = (_b = didDocument.service) === null || _b === void 0 ? void 0 : _b.map(s => {
|
|
241
|
-
if (typeof s.serviceEndpoint !== 'string')
|
|
242
|
-
return s;
|
|
243
|
-
if (s.serviceEndpoint.includes(schemaKey) && s.id !== `${agent.did}#whois`) {
|
|
244
|
-
s.id = didDocumentServiceId;
|
|
245
|
-
s.serviceEndpoint = id;
|
|
246
|
-
}
|
|
247
|
-
return s;
|
|
248
|
-
});
|
|
249
|
-
// Resolvers only discover the credential through the [VT-CRED-W3C-LINKED-VP] fragment, and
|
|
250
|
-
// #whois does not match it. The rename above only covers documents that already carry the
|
|
251
|
-
// service, so publish it here when nothing declared it yet.
|
|
252
|
-
let didDocumentChanged = false;
|
|
253
|
-
if (!((_c = didDocument.service) === null || _c === void 0 ? void 0 : _c.some(s => s.id === didDocumentServiceId))) {
|
|
254
|
-
didDocument.service = [
|
|
255
|
-
...((_d = didDocument.service) !== null && _d !== void 0 ? _d : []),
|
|
256
|
-
new core_1.DidDocumentService({
|
|
257
|
-
id: didDocumentServiceId,
|
|
258
|
-
serviceEndpoint: id,
|
|
259
|
-
type: 'LinkedVerifiablePresentation',
|
|
260
|
-
}),
|
|
261
|
-
];
|
|
262
|
-
didDocumentChanged = true;
|
|
263
|
-
}
|
|
264
|
-
const credential = verifiablePresentation.verifiableCredential[0];
|
|
265
|
-
record[credentialSchema.id] = {
|
|
266
|
-
credential,
|
|
267
|
-
verifiablePresentation,
|
|
268
|
-
didDocumentServiceId,
|
|
269
|
-
integrityData,
|
|
270
|
-
attached: true,
|
|
271
|
-
};
|
|
272
|
-
didRecord.metadata.set('_vt/vtc', record);
|
|
273
|
-
await agent.context.dependencyManager.resolve(core_1.DidRepository).update(agent.context, didRecord);
|
|
274
|
-
if (didDocumentChanged) {
|
|
275
|
-
await agent.dids.update({ did: didRecord.did, didDocument });
|
|
276
|
-
}
|
|
277
|
-
return verifiablePresentation;
|
|
278
102
|
}
|
|
103
|
+
/** Builds an unsigned VC Data Model 2.0 presentation; the class supplies the v2 context. */
|
|
279
104
|
function createPresentation(options) {
|
|
280
|
-
|
|
281
|
-
(_a = options.context) !== null && _a !== void 0 ? _a : (options.context = [
|
|
282
|
-
'https://www.w3.org/2018/credentials/v1',
|
|
283
|
-
'https://www.w3.org/ns/credentials/examples/v2',
|
|
284
|
-
]);
|
|
285
|
-
(_b = options.type) !== null && _b !== void 0 ? _b : (options.type = ['VerifiablePresentation']);
|
|
286
|
-
return new core_1.W3cPresentation(options);
|
|
105
|
+
return new core_1.W3cV2Presentation(Object.assign({ type: ['VerifiablePresentation'] }, options));
|
|
287
106
|
}
|
|
288
107
|
/**
|
|
289
108
|
* Retrieves and validates claims for a credential subject.
|
|
@@ -296,42 +115,15 @@ function createPresentation(options) {
|
|
|
296
115
|
* @returns The validated claims object.
|
|
297
116
|
* @throws If claims are invalid or schema is missing.
|
|
298
117
|
*/
|
|
299
|
-
async function getClaims(logger, ecsSchemas, { id
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
const termsAndConditionsUri = (_b = claims === null || claims === void 0 ? void 0 : claims.termsAndConditionsUri) !== null && _b !== void 0 ? _b : defaults.serviceTermsAndConditions;
|
|
304
|
-
const privacyPolicyUri = (_c = claims === null || claims === void 0 ? void 0 : claims.privacyPolicyUri) !== null && _c !== void 0 ? _c : defaults.servicePrivacyPolicy;
|
|
305
|
-
claims =
|
|
306
|
-
schemaKey === 'ecs-service'
|
|
307
|
-
? {
|
|
308
|
-
name: (_d = claims === null || claims === void 0 ? void 0 : claims.name) !== null && _d !== void 0 ? _d : defaults.agentLabel,
|
|
309
|
-
type: (_e = claims === null || claims === void 0 ? void 0 : claims.type) !== null && _e !== void 0 ? _e : defaults.serviceType,
|
|
310
|
-
description: (_f = claims === null || claims === void 0 ? void 0 : claims.description) !== null && _f !== void 0 ? _f : defaults.serviceDescription,
|
|
311
|
-
logoUri,
|
|
312
|
-
logoDigestSri: (_h = (_g = claims === null || claims === void 0 ? void 0 : claims.logoDigestSri) !== null && _g !== void 0 ? _g : defaults.serviceLogoDigestSri) !== null && _h !== void 0 ? _h : (await urlDigestSri(logoUri)),
|
|
313
|
-
minimumAgeRequired: (_j = claims === null || claims === void 0 ? void 0 : claims.minimumAgeRequired) !== null && _j !== void 0 ? _j : defaults.serviceMinimumAgeRequired,
|
|
314
|
-
termsAndConditionsUri,
|
|
315
|
-
termsAndConditionsDigestSri: (_l = (_k = claims === null || claims === void 0 ? void 0 : claims.termsAndConditionsDigestSri) !== null && _k !== void 0 ? _k : defaults.serviceTermsAndConditionsDigestSri) !== null && _l !== void 0 ? _l : (await urlDigestSri(termsAndConditionsUri)),
|
|
316
|
-
privacyPolicyUri,
|
|
317
|
-
privacyPolicyDigestSri: (_o = (_m = claims === null || claims === void 0 ? void 0 : claims.privacyPolicyDigestSri) !== null && _m !== void 0 ? _m : defaults.servicePrivacyPolicyDigestSri) !== null && _o !== void 0 ? _o : (await urlDigestSri(privacyPolicyUri)),
|
|
318
|
-
}
|
|
319
|
-
: {
|
|
320
|
-
name: (_p = claims === null || claims === void 0 ? void 0 : claims.name) !== null && _p !== void 0 ? _p : defaults.agentLabel,
|
|
321
|
-
logoUri,
|
|
322
|
-
logoDigestSri: (_r = (_q = claims === null || claims === void 0 ? void 0 : claims.logoDigestSri) !== null && _q !== void 0 ? _q : defaults.serviceLogoDigestSri) !== null && _r !== void 0 ? _r : (await urlDigestSri(logoUri)),
|
|
323
|
-
registryId: (_s = claims === null || claims === void 0 ? void 0 : claims.registryId) !== null && _s !== void 0 ? _s : defaults.orgRegistryId,
|
|
324
|
-
registryUri: (_t = claims === null || claims === void 0 ? void 0 : claims.registryUri) !== null && _t !== void 0 ? _t : defaults.orgRegistryUri,
|
|
325
|
-
address: (_u = claims === null || claims === void 0 ? void 0 : claims.address) !== null && _u !== void 0 ? _u : defaults.orgAddress,
|
|
326
|
-
organizationKind: (_v = claims === null || claims === void 0 ? void 0 : claims.organizationKind) !== null && _v !== void 0 ? _v : defaults.orgOrganizationKind,
|
|
327
|
-
countryCode: (_w = claims === null || claims === void 0 ? void 0 : claims.countryCode) !== null && _w !== void 0 ? _w : defaults.orgCountryCode,
|
|
328
|
-
};
|
|
118
|
+
async function getClaims(logger, ecsSchemas, { id }, schemaKey, ecsClaims) {
|
|
119
|
+
const claims = await (0, ecsClaims_1.composeEcsClaims)(ecsClaims, schemaKey, logger);
|
|
120
|
+
if (!claims)
|
|
121
|
+
throw new Error(`No ECS_CLAIMS_* variable is set for ${schemaKey}`);
|
|
329
122
|
const ecsSchema = ecsSchemas[schemaKey];
|
|
330
123
|
if (!ecsSchema) {
|
|
331
124
|
throw new Error(`Schema not defined in data schemas for schemaKey: ${schemaKey}`);
|
|
332
125
|
}
|
|
333
|
-
|
|
334
|
-
validateSchema(JSON.parse(ecsSchema), credentialSubject);
|
|
126
|
+
validateSchema(JSON.parse(ecsSchema), Object.assign({ id }, claims));
|
|
335
127
|
return claims;
|
|
336
128
|
}
|
|
337
129
|
/**
|
|
@@ -352,6 +144,17 @@ function validateSchema(ecsSchema, credentialSubject) {
|
|
|
352
144
|
throw new Error(`Invalid claims for ${ecsSchema.$id}: ${JSON.stringify(errorDetails, null, 2)}`);
|
|
353
145
|
}
|
|
354
146
|
}
|
|
147
|
+
async function fetchSchemaContent(id) {
|
|
148
|
+
try {
|
|
149
|
+
const response = await fetch((0, vs_agent_model_1.mapToEcosystem)(id));
|
|
150
|
+
if (!response.ok)
|
|
151
|
+
return { error: `${response.status} ${response.statusText}` };
|
|
152
|
+
return { content: await response.text() };
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
return { error: error instanceof Error ? error.message : String(error) };
|
|
156
|
+
}
|
|
157
|
+
}
|
|
355
158
|
/**
|
|
356
159
|
* Adds a Subresource Integrity (SRI) digest to the provided data using the schema content
|
|
357
160
|
* fetched from the provided URL or from a local schema map as fallback.
|
|
@@ -364,15 +167,16 @@ function validateSchema(ecsSchema, credentialSubject) {
|
|
|
364
167
|
* @throws Error if both the fetch and local fallback fail.
|
|
365
168
|
*/
|
|
366
169
|
async function addDigestSRI(id, data, ecsSchemas) {
|
|
170
|
+
var _a;
|
|
367
171
|
if (!id || !data) {
|
|
368
172
|
throw new Error(`id and data has requiered`);
|
|
369
173
|
}
|
|
370
|
-
const
|
|
174
|
+
const fetched = await fetchSchemaContent(id);
|
|
371
175
|
const key = id.split('/').pop();
|
|
372
176
|
const fallbackSchema = key && (ecsSchemas === null || ecsSchemas === void 0 ? void 0 : ecsSchemas[key]);
|
|
373
|
-
const schemaContent =
|
|
177
|
+
const schemaContent = (_a = fetched.content) !== null && _a !== void 0 ? _a : fallbackSchema;
|
|
374
178
|
if (!schemaContent) {
|
|
375
|
-
throw new Error(`Failed to fetch schema from ${id}: ${
|
|
179
|
+
throw new Error(`Failed to fetch schema from ${id}: ${fetched.error}, and no local fallback found.`);
|
|
376
180
|
}
|
|
377
181
|
assertValidSchema(schemaContent, id);
|
|
378
182
|
return Object.assign(Object.assign({}, data), { digestSRI: generateDigestSRI(schemaContent) });
|
|
@@ -404,14 +208,6 @@ function generateDigestSRI(content, algorithm = 'sha384') {
|
|
|
404
208
|
const hash = (0, crypto_1.createHash)(algorithm).update(content).digest('base64');
|
|
405
209
|
return `${algorithm}-${hash}`;
|
|
406
210
|
}
|
|
407
|
-
/**
|
|
408
|
-
* Digest of the resource a credential references. Throws rather than attest content it could
|
|
409
|
-
* not read: a wrong digestSRI is a false integrity claim in a signed credential.
|
|
410
|
-
*/
|
|
411
|
-
async function urlDigestSri(url) {
|
|
412
|
-
const response = await axios_1.default.get(url, { responseType: 'arraybuffer', timeout: DIGEST_FETCH_TIMEOUT_MS });
|
|
413
|
-
return `sha384-${(0, crypto_1.createHash)('sha384').update(Buffer.from(response.data)).digest('base64')}`;
|
|
414
|
-
}
|
|
415
211
|
function getVerificationMethodId(logger, didRecord) {
|
|
416
212
|
var _a, _b;
|
|
417
213
|
try {
|
|
@@ -421,7 +217,7 @@ function getVerificationMethodId(logger, didRecord) {
|
|
|
421
217
|
method.id === ((_b = (_a = didRecord.didDocument) === null || _a === void 0 ? void 0 : _a.assertionMethod) === null || _b === void 0 ? void 0 : _b[0]);
|
|
422
218
|
});
|
|
423
219
|
if (!verificationMethod) {
|
|
424
|
-
throw new Error('Cannot find a suitable
|
|
220
|
+
throw new Error('Cannot find a suitable Ed25519 verification method in DID Document');
|
|
425
221
|
}
|
|
426
222
|
return verificationMethod.id;
|
|
427
223
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupSelfTr.js","sourceRoot":"","sources":["../../src/utils/setupSelfTr.ts"],"names":[],"mappings":";;;;;;AA2OA,4CAUC;AAyBD,8BA0BC;AAmBD,wEA2EC;AAED,gDAOC;AAaD,8BA0DC;AAMD,wCAcC;AAaD,oCAyBC;AA2BD,8CAGC;AAMD,oCAGC;AAED,0DAeC;AAxkBD,yCAcuB;AACvB,iDAAiD;AACjD,6DAA6D;AAC7D,kBAAkB;AAClB,6EAAgE;AAChE,gEAA4D;AAC5D,0DAAoD;AACpD,8DAAoC;AACpC,kDAAyB;AACzB,mCAAmC;AAInC,iCAAsC;AAEtC,MAAM,GAAG,GAAG,IAAI,eAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;AACtC,IAAA,qBAAU,EAAC,GAAG,CAAC,CAAA;AAEf,MAAM,uBAAuB,GAAG,IAAI,CAAA;AAoBpC,UAAU;AACG,QAAA,aAAa,GAAG;IAC3B;QACE,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,4CAA4C;KACxD;IACD;QACE,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,wCAAwC;KACpD;CACF,CAAA;AAEY,QAAA,WAAW,GAAG;IACzB;QACE,IAAI,EAAE,iBAAiB;QACvB,OAAO,EAAE,gCAAgC;QACzC,SAAS,EAAE,4CAA4C;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A;SAAA,CAC5D,CAAA;QACD,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,oEAAoE,CAAC,CAAA;QACvF,CAAC;QACD,OAAO,kBAAkB,CAAC,EAAE,CAAA;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAA;QAC5D,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -1,22 +1,80 @@
|
|
|
1
|
-
import { DidRecord, W3cJsonLdVerifiableCredential, W3cJsonLdVerifiablePresentation } from '@credo-ts/core';
|
|
1
|
+
import { DidRecord, W3cJsonLdVerifiableCredential, W3cJsonLdVerifiablePresentation, type W3cV2DataIntegritySecuredCredential, W3cV2DataIntegrityVerifiableCredential, W3cV2DataIntegrityVerifiablePresentation } from '@credo-ts/core';
|
|
2
2
|
import { VsAgent } from '../agent/VsAgent';
|
|
3
|
-
import {
|
|
3
|
+
import { EcsClaims } from './ecsClaims';
|
|
4
|
+
/**
|
|
5
|
+
* A trust credential the agent publishes from its DID Document: a VC Data Model 2.0 credential
|
|
6
|
+
* secured with a DataIntegrityProof, which is what the agent issues itself and receives over the
|
|
7
|
+
* RFC 0809 credential format, or a data model 1.1 credential carrying a linked data proof that an
|
|
8
|
+
* older issuer handed over.
|
|
9
|
+
*/
|
|
10
|
+
export type TrustCredential = W3cJsonLdVerifiableCredential | W3cV2DataIntegrityVerifiableCredential;
|
|
11
|
+
export type TrustPresentation = W3cJsonLdVerifiablePresentation | W3cV2DataIntegrityVerifiablePresentation;
|
|
12
|
+
/**
|
|
13
|
+
* Wraps a VC Data Model 2.0 credential in a data model 2.0 presentation secured with a
|
|
14
|
+
* DataIntegrityProof under the cryptosuite the agent is configured with, the counterpart of the
|
|
15
|
+
* linked data proof a data model 1.1 linked VP carries. The presentation is published from the DID
|
|
16
|
+
* Document rather than presented to a verifier, so there is no challenge to bind; its proof purpose
|
|
17
|
+
* is `authentication`, as Data Integrity defines for presentations.
|
|
18
|
+
*/
|
|
19
|
+
export declare function signLinkedDataIntegrityPresentation(agent: Pick<VsAgent, 'w3cV2Credentials' | 'context'>, options: {
|
|
20
|
+
id: string;
|
|
21
|
+
holder: string;
|
|
22
|
+
credential: W3cV2DataIntegrityVerifiableCredential;
|
|
23
|
+
verificationMethodId: string;
|
|
24
|
+
}): Promise<W3cV2DataIntegrityVerifiablePresentation>;
|
|
4
25
|
export declare function findMetadataEntry(didRecord: DidRecord, key: '_vt/vtc' | '_vt/jsc', id?: string, jsonSchemaRef?: string): any;
|
|
5
|
-
export declare function saveMetadataEntry(agent: VsAgent, didRecord: DidRecord, credential:
|
|
6
|
-
export declare function deleteMetadataEntry(agent: VsAgent, id: string, didRecord: DidRecord, key: '_vt/vtc' | '_vt/jsc'
|
|
26
|
+
export declare function saveMetadataEntry(agent: VsAgent, didRecord: DidRecord, credential: TrustCredential, verifiablePresentation: TrustPresentation, didDocumentServiceId: string, key: '_vt/vtc' | '_vt/jsc'): Promise<void>;
|
|
27
|
+
export declare function deleteMetadataEntry(agent: VsAgent, id: string, didRecord: DidRecord, key: '_vt/vtc' | '_vt/jsc'): Promise<{
|
|
7
28
|
schemaId: any;
|
|
8
29
|
} | null>;
|
|
9
|
-
export declare function createVtc(agent: VsAgent, publicApiBaseUrl: string, id: string, credential:
|
|
30
|
+
export declare function createVtc(agent: VsAgent, publicApiBaseUrl: string, id: string, credential: TrustCredential): Promise<TrustPresentation>;
|
|
10
31
|
export interface CreateJscOptions {
|
|
11
32
|
schemaBaseId: string;
|
|
12
33
|
jsonSchemaRef: string;
|
|
13
34
|
precomputedDigestSRI?: string;
|
|
14
35
|
}
|
|
15
|
-
export declare function createJsc(agent: VsAgent, publicApiBaseUrl: string, ecsSchemas: Record<string, string>, options: CreateJscOptions): Promise<
|
|
16
|
-
|
|
36
|
+
export declare function createJsc(agent: VsAgent, publicApiBaseUrl: string, ecsSchemas: Record<string, string>, options: CreateJscOptions): Promise<W3cV2DataIntegritySecuredCredential & {
|
|
37
|
+
id: string;
|
|
38
|
+
}>;
|
|
39
|
+
export declare function removeTrustCredential(agent: VsAgent, schemaId: string, key: '_vt/jsc' | '_vt/vtc'): Promise<{
|
|
17
40
|
schemaId: any;
|
|
18
41
|
} | null>;
|
|
19
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Removes the linked VP and the stored credential an exchange delivered, as
|
|
44
|
+
* [VSA-VTI-FLOW-OP-REVOKE] requires of the applicant. The credential is read from the RFC 0809
|
|
45
|
+
* format data of the exchange; exchanges earlier versions completed over other formats are not
|
|
46
|
+
* migrated. Returns the credential id, or `undefined` when none is found, in which case nothing is
|
|
47
|
+
* removed.
|
|
48
|
+
*/
|
|
49
|
+
export declare function removeStoredTrustCredential(agent: VsAgent, credentialExchangeRecordId: string): Promise<string | undefined>;
|
|
20
50
|
export declare function migrateVtjscServiceIds(agent: VsAgent): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Takes the linked VPs of the given `_vt/jsc` entries out of the DID Document, publishing it once.
|
|
53
|
+
*
|
|
54
|
+
* The entries stay: `SelfTrController` serves them, and issued credentials name that URL in
|
|
55
|
+
* `credentialSchema.id`. Dropping one would 404 it and leave those credentials unverifiable.
|
|
56
|
+
*/
|
|
57
|
+
export declare function detachVtjscPublications(agent: VsAgent, schemaRefs: readonly string[]): Promise<string[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Puts a detached `_vt/jsc` entry back in the DID Document.
|
|
60
|
+
*
|
|
61
|
+
* The publication pass skips an entry whose digest still matches, so without this the agent would
|
|
62
|
+
* keep serving a VTJSC it never announces again.
|
|
63
|
+
*/
|
|
64
|
+
export declare function reattachVtjscPublication(agent: VsAgent, schemaRef: string): Promise<boolean>;
|
|
21
65
|
export declare function getTrustMetadata(didRecord: DidRecord, key: '_vt/vtc' | '_vt/jsc', schemaId?: string): any;
|
|
22
|
-
|
|
66
|
+
/**
|
|
67
|
+
* @param jsonSchemaCredentialId the VTJSC the Ecosystem published for this schema. Only the
|
|
68
|
+
* Ecosystem publishes it, so an agent that issues against another Corporation's Ecosystem must
|
|
69
|
+
* resolve it there — see resolveJsonSchemaCredentialId.
|
|
70
|
+
* @param issuerParticipantId this agent's ISSUER participant for the schema, which anchors the
|
|
71
|
+
* credential digest.
|
|
72
|
+
* @param schemaKey the ECS schema this agent issues against. Every ECS key is accepted; the caller
|
|
73
|
+
* reaches this function only for a schema the agent holds an active ISSUER entry on.
|
|
74
|
+
*/
|
|
75
|
+
export declare function rebindEcsCredentialSchema(agent: VsAgent, publicApiBaseUrl: string, schemaId: string, schemaKey: string, ecsClaims: EcsClaims, jsonSchemaCredentialId: string, issuerParticipantId: number, onChainJsonSchema?: string): Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Withdraws the ECS credentials anchored against `issuerParticipantId`, and the #whois entry
|
|
78
|
+
* when the Service credential is among them.
|
|
79
|
+
*/
|
|
80
|
+
export declare function withdrawSelfIssuedEcsCredentials(agent: VsAgent, issuerParticipantId: number): Promise<string[]>;
|