@verana-labs/vs-agent-sdk 1.11.0-dev.8 → 1.11.0

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.
Files changed (64) hide show
  1. package/README.md +172 -0
  2. package/build/agent/VsAgent.d.ts +8 -2
  3. package/build/agent/VsAgent.js +121 -41
  4. package/build/agent/VsAgent.js.map +1 -1
  5. package/build/agent/createVsAgent.d.ts +2 -0
  6. package/build/agent/createVsAgent.js +1 -0
  7. package/build/agent/createVsAgent.js.map +1 -1
  8. package/build/agent/index.d.ts +2 -0
  9. package/build/agent/index.js +19 -0
  10. package/build/agent/index.js.map +1 -0
  11. package/build/blockchain/IndexerWebSocketService.d.ts +39 -0
  12. package/build/blockchain/IndexerWebSocketService.js +217 -0
  13. package/build/blockchain/IndexerWebSocketService.js.map +1 -0
  14. package/build/blockchain/VeranaChainService.d.ts +32 -0
  15. package/build/blockchain/VeranaChainService.js +124 -0
  16. package/build/blockchain/VeranaChainService.js.map +1 -0
  17. package/build/blockchain/VeranaHelpers.d.ts +4 -0
  18. package/build/blockchain/VeranaHelpers.js +29 -0
  19. package/build/blockchain/VeranaHelpers.js.map +1 -0
  20. package/build/blockchain/VeranaIndexerService.d.ts +11 -0
  21. package/build/blockchain/VeranaIndexerService.js +43 -0
  22. package/build/blockchain/VeranaIndexerService.js.map +1 -0
  23. package/build/blockchain/handlers/IndexerHandlerRegistry.d.ts +25 -0
  24. package/build/blockchain/handlers/IndexerHandlerRegistry.js +34 -0
  25. package/build/blockchain/handlers/IndexerHandlerRegistry.js.map +1 -0
  26. package/build/blockchain/handlers/defaultHandlers.d.ts +6 -0
  27. package/build/blockchain/handlers/defaultHandlers.js +126 -0
  28. package/build/blockchain/handlers/defaultHandlers.js.map +1 -0
  29. package/build/blockchain/handlers/index.d.ts +3 -0
  30. package/build/blockchain/handlers/index.js +20 -0
  31. package/build/blockchain/handlers/index.js.map +1 -0
  32. package/build/blockchain/handlers/stateMutations.d.ts +12 -0
  33. package/build/blockchain/handlers/stateMutations.js +113 -0
  34. package/build/blockchain/handlers/stateMutations.js.map +1 -0
  35. package/build/blockchain/index.d.ts +6 -0
  36. package/build/blockchain/index.js +23 -0
  37. package/build/blockchain/index.js.map +1 -0
  38. package/build/blockchain/types.d.ts +158 -0
  39. package/build/blockchain/types.js +6 -0
  40. package/build/blockchain/types.js.map +1 -0
  41. package/build/did/WebDidRegistrar.d.ts +3 -1
  42. package/build/did/WebDidRegistrar.js +10 -1
  43. package/build/did/WebDidRegistrar.js.map +1 -1
  44. package/build/did/migrateWebVhLog.d.ts +34 -0
  45. package/build/did/migrateWebVhLog.js +230 -0
  46. package/build/did/migrateWebVhLog.js.map +1 -0
  47. package/build/index.d.ts +4 -5
  48. package/build/index.js +5 -5
  49. package/build/index.js.map +1 -1
  50. package/build/plugins/setupBaseDidComm.d.ts +2 -0
  51. package/build/plugins/setupBaseDidComm.js +9 -1
  52. package/build/plugins/setupBaseDidComm.js.map +1 -1
  53. package/build/transports/VsAgentWsInboundTransport.js +1 -1
  54. package/build/transports/VsAgentWsInboundTransport.js.map +1 -1
  55. package/build/utils/agent.d.ts +2 -1
  56. package/build/utils/agent.js +16 -10
  57. package/build/utils/agent.js.map +1 -1
  58. package/build/utils/setupSelfTr.d.ts +115 -0
  59. package/build/utils/setupSelfTr.js +452 -0
  60. package/build/utils/setupSelfTr.js.map +1 -0
  61. package/build/utils/trustCredentialStore.d.ts +18 -0
  62. package/build/utils/trustCredentialStore.js +196 -0
  63. package/build/utils/trustCredentialStore.js.map +1 -0
  64. package/package.json +18 -11
@@ -0,0 +1,230 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rebuildWebVhLog = rebuildWebVhLog;
4
+ exports.migrateWebVhLogIfBroken = migrateWebVhLogIfBroken;
5
+ const askar_1 = require("@credo-ts/askar");
6
+ const core_1 = require("@credo-ts/core");
7
+ const askar_shared_1 = require("@openwallet-foundation/askar-shared");
8
+ const didwebvh_ts_1 = require("didwebvh-ts");
9
+ /**
10
+ * Verifier that delegates Ed25519 verification to the agent's KMS.
11
+ */
12
+ class KmsVerifier {
13
+ constructor(agentContext) {
14
+ this.agentContext = agentContext;
15
+ }
16
+ async verify(signature, message, publicKey) {
17
+ try {
18
+ const kms = this.agentContext.dependencyManager.resolve(core_1.Kms.KeyManagementApi);
19
+ const publicJwk = core_1.Kms.PublicJwk.fromPublicKey({ kty: 'OKP', crv: 'Ed25519', publicKey });
20
+ const { verified } = await kms.verify({
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ key: { publicJwk: publicJwk.toJson() },
23
+ algorithm: 'EdDSA',
24
+ signature,
25
+ data: message,
26
+ });
27
+ return verified;
28
+ }
29
+ catch (_a) {
30
+ return false;
31
+ }
32
+ }
33
+ }
34
+ /**
35
+ * Signer that signs with an Ed25519 key managed by the agent's KMS,
36
+ * exposing the public key as a `did:key:` verification method id.
37
+ */
38
+ class KmsSigner {
39
+ constructor(agentContext, kmsKeyId, publicKeyMultibase) {
40
+ this.agentContext = agentContext;
41
+ this.kmsKeyId = kmsKeyId;
42
+ this.publicKeyMultibase = publicKeyMultibase;
43
+ }
44
+ getVerificationMethodId() {
45
+ return `did:key:${this.publicKeyMultibase}`;
46
+ }
47
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
+ async sign(input) {
49
+ const kms = this.agentContext.dependencyManager.resolve(core_1.Kms.KeyManagementApi);
50
+ const data = await (0, didwebvh_ts_1.prepareDataForSigning)(input.document, input.proof);
51
+ const { signature } = await kms.sign({
52
+ keyId: this.kmsKeyId,
53
+ algorithm: 'EdDSA',
54
+ data,
55
+ });
56
+ return { proofValue: (0, didwebvh_ts_1.multibaseEncode)(signature, didwebvh_ts_1.MultibaseEncoding.BASE58_BTC) };
57
+ }
58
+ }
59
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
+ const normalizeMethodArray = (arr) =>
61
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
+ arr === null || arr === void 0 ? void 0 : arr.map((item) => (typeof item === 'string' ? item : item.id));
63
+ /**
64
+ * `resolveDIDFromLog` throws on validation failures (hash chain, signature,
65
+ * etc.). Normalize that into a discriminated result so callers can branch on
66
+ * the failure mode without try/catch boilerplate.
67
+ */
68
+ async function tryResolveLog(log, verifier) {
69
+ try {
70
+ await (0, didwebvh_ts_1.resolveDIDFromLog)(log, { verifier });
71
+ return { ok: true };
72
+ }
73
+ catch (error) {
74
+ return { ok: false, reason: error instanceof Error ? error.message : String(error) };
75
+ }
76
+ }
77
+ /**
78
+ * Pure rebuild logic, decoupled from credo / askar so it can be unit-tested.
79
+ *
80
+ * If `log` resolves cleanly under the current didwebvh-ts version, returns `null`
81
+ * (nothing to do). Otherwise, if the failure is the known `<2.7.4` "hash chain
82
+ * broken" bug, rebuilds entries 2..N (preserving entry #1, SCID, every entry's
83
+ * `state` and `parameters`) and returns the new log. For any other resolution
84
+ * error, returns `null` and lets the caller decide what to do.
85
+ */
86
+ async function rebuildWebVhLog(log, { signer, verifier, domain }) {
87
+ var _a, _b, _c;
88
+ if (!log || log.length === 0)
89
+ return null;
90
+ const initial = await tryResolveLog(log, verifier);
91
+ if (initial.ok)
92
+ return null;
93
+ if (!/hash chain broken/i.test(initial.reason))
94
+ return null;
95
+ if (log.length < 2)
96
+ return null;
97
+ const originalScid = log[0].parameters.scid;
98
+ let newLog = [log[0]];
99
+ for (let i = 1; i < log.length; i++) {
100
+ const oldEntry = log[i];
101
+ const oldState = oldEntry.state;
102
+ const oldParams = oldEntry.parameters;
103
+ const lastParams = newLog[newLog.length - 1].parameters;
104
+ const activeUpdateKeys = (_a = lastParams.updateKeys) !== null && _a !== void 0 ? _a : [];
105
+ if (activeUpdateKeys.length === 0) {
106
+ throw new Error(`Cannot rebuild webvh log: no active updateKeys at entry ${i + 1}`);
107
+ }
108
+ const controllerValue = Array.isArray(oldState.controller) ? oldState.controller[0] : oldState.controller;
109
+ const { log: rebuilt } = await (0, didwebvh_ts_1.updateDID)({
110
+ log: newLog,
111
+ signer,
112
+ verifier,
113
+ domain,
114
+ updateKeys: (_b = oldParams.updateKeys) !== null && _b !== void 0 ? _b : activeUpdateKeys,
115
+ verificationMethods: oldState.verificationMethod,
116
+ services: oldState.service,
117
+ controller: controllerValue,
118
+ authentication: normalizeMethodArray(oldState.authentication),
119
+ assertionMethod: normalizeMethodArray(oldState.assertionMethod),
120
+ keyAgreement: normalizeMethodArray(oldState.keyAgreement),
121
+ alsoKnownAs: oldState.alsoKnownAs,
122
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
123
+ context: oldState['@context'],
124
+ portable: oldParams.portable,
125
+ nextKeyHashes: oldParams.nextKeyHashes,
126
+ // Forward witness only when it carries meaningful values. Passing an empty
127
+ // `{}` would make `updateDID` expand it into `{ threshold: 0, witnesses: [] }`,
128
+ // which then no longer matches the original entry's parameters.
129
+ witness: oldParams.witness && (((_c = oldParams.witness.witnesses) === null || _c === void 0 ? void 0 : _c.length) || oldParams.witness.threshold)
130
+ ? oldParams.witness
131
+ : undefined,
132
+ watchers: oldParams.watchers,
133
+ updated: oldEntry.versionTime,
134
+ });
135
+ newLog = rebuilt;
136
+ }
137
+ const verify = await tryResolveLog(newLog, verifier);
138
+ if (!verify.ok) {
139
+ throw new Error(`Rebuilt webvh log is still invalid: ${verify.reason}`);
140
+ }
141
+ if (newLog[0].parameters.scid !== originalScid) {
142
+ // Should be impossible since entry #1 is unchanged, but guard anyway.
143
+ throw new Error(`Rebuilt webvh log produced a different SCID; aborting migration`);
144
+ }
145
+ return newLog;
146
+ }
147
+ /**
148
+ * Scans all Ed25519 keys in the Askar store and returns the key name
149
+ * whose public key matches the given multibase fingerprint.
150
+ * Used to recover a lost kmsKeyId when didRecord.keys is empty after a schema upgrade.
151
+ */
152
+ async function findKmsKeyIdForFingerprint(agentContext, fingerprint) {
153
+ try {
154
+ const storeManager = agentContext.dependencyManager.resolve(askar_1.AskarStoreManager);
155
+ return await storeManager.withSession(agentContext, async (session) => {
156
+ const entries = await session.fetchAllKeys({ algorithm: askar_shared_1.KeyAlgorithm.Ed25519 });
157
+ for (const entry of entries) {
158
+ const pubBytes = entry.key.publicBytes;
159
+ const computed = (0, didwebvh_ts_1.multibaseEncode)(new Uint8Array([237, 1, ...pubBytes]), didwebvh_ts_1.MultibaseEncoding.BASE58_BTC);
160
+ entry.key.handle.free();
161
+ if (computed === fingerprint)
162
+ return entry.name;
163
+ }
164
+ return undefined;
165
+ });
166
+ }
167
+ catch (_a) {
168
+ agentContext.config.logger.warn(`Failed to scan Askar keys, cannot recover controller key for webvh log migration`);
169
+ return undefined;
170
+ }
171
+ }
172
+ /**
173
+ * Detect a `did:webvh` log that became unresolvable because of the
174
+ * `didwebvh-ts` <2.7.4 entry-hash bug (placeholder versionId used for entries
175
+ * after the first). If so, rebuild the log preserving:
176
+ * - entry #1 byte-for-byte (preserving the SCID and therefore the public DID)
177
+ * - the `state` and `parameters` of entries 2..N (services, keys, controller, etc.)
178
+ *
179
+ * Only the entryHash and proof of entries 2..N are recomputed/re-signed using
180
+ * the controller key the agent already holds in askar.
181
+ *
182
+ * Returns true if migration ran successfully, false if it was not needed.
183
+ * Throws if the rebuild fails or the result is somehow invalid.
184
+ */
185
+ async function migrateWebVhLogIfBroken(agentContext, didRecord, logger) {
186
+ var _a, _b, _c, _d, _e, _f, _g;
187
+ const log = didRecord.metadata.get('log');
188
+ if (!log || log.length === 0)
189
+ return false;
190
+ const verifier = new KmsVerifier(agentContext);
191
+ // Cheap pre-check so we can produce a clear log message before doing real work.
192
+ const preCheck = await tryResolveLog(log, verifier);
193
+ if (preCheck.ok)
194
+ return false;
195
+ if (!/hash chain broken/i.test(preCheck.reason)) {
196
+ logger.warn(`webvh DID log for ${didRecord.did} is invalid and not eligible for hash-chain migration: ${preCheck.reason}`);
197
+ return false;
198
+ }
199
+ const domain = didRecord.getTag('domain');
200
+ const activeUpdateKey = (_b = (_a = log[log.length - 1].parameters.updateKeys) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : (_c = log[0].parameters.updateKeys) === null || _c === void 0 ? void 0 : _c[0];
201
+ if (!activeUpdateKey) {
202
+ throw new Error(`Cannot migrate webvh log for ${didRecord.did}: no updateKeys present`);
203
+ }
204
+ let kmsKeyId = (_e = (_d = didRecord.keys) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.kmsKeyId;
205
+ if (!kmsKeyId) {
206
+ // The key mapping may have been lost after a schema update.
207
+ // Try to recover the key from Askar using the update key fingerprint.
208
+ kmsKeyId = await findKmsKeyIdForFingerprint(agentContext, activeUpdateKey);
209
+ if (!kmsKeyId) {
210
+ throw new Error(`Cannot migrate webvh log for ${didRecord.did}: no controller key on DID record`);
211
+ }
212
+ logger.warn(`webvh DID ${didRecord.did}: controller key recovered from Askar scan`);
213
+ // Update the DID record with the recovered key.
214
+ const vm = (_g = (_f = didRecord.didDocument) === null || _f === void 0 ? void 0 : _f.verificationMethod) === null || _g === void 0 ? void 0 : _g.find(v => v.publicKeyMultibase === activeUpdateKey);
215
+ const relativeKeyId = (vm === null || vm === void 0 ? void 0 : vm.id) ? `#${vm.id.split('#')[1]}` : '#key-1';
216
+ didRecord.keys = [{ kmsKeyId, didDocumentRelativeKeyId: relativeKeyId }];
217
+ }
218
+ logger.warn(`webvh DID log for ${didRecord.did} is invalid (likely legacy didwebvh-ts <2.7.4 hash bug). ` +
219
+ `Rebuilding entries 2..${log.length} while preserving SCID.`);
220
+ const signer = new KmsSigner(agentContext, kmsKeyId, activeUpdateKey);
221
+ const newLog = await rebuildWebVhLog(log, { signer, verifier, domain });
222
+ if (!newLog)
223
+ return false;
224
+ didRecord.metadata.set('log', newLog);
225
+ const didRepository = agentContext.dependencyManager.resolve(core_1.DidRepository);
226
+ await didRepository.update(agentContext, didRecord);
227
+ logger.info(`webvh DID log for ${didRecord.did} successfully migrated; ${newLog.length} entries; SCID preserved (${log[0].parameters.scid}).`);
228
+ return true;
229
+ }
230
+ //# sourceMapp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K,CAAA;IAEzB,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACrC,MAAM,aAAa,GAAG,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,oBAAa,CAAC,CAAA;IAC3E,MAAM,aAAa,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAA;IAEnD,MAAM,CAAC,IAAI,CACT,qBAAqB,SAAS,CAAC,GAAG,2BAA2B,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,CAClI,CAAA;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
package/build/index.d.ts CHANGED
@@ -1,8 +1,4 @@
1
- export { VsAgent } from './agent/VsAgent';
2
- export { type VsAgentOptions, BaseAgentModules } from './agent/VsAgent';
3
- export type { BaseAgentModules as DidCommAgentModules } from './agent/VsAgent';
4
- export { createVsAgent } from './agent/createVsAgent';
5
- export type { CreateVsAgentOptions } from './agent/createVsAgent';
1
+ export * from './agent';
6
2
  export type { Plugin } from './types';
7
3
  export { setupBaseDidComm } from './plugins/setupBaseDidComm';
8
4
  export type { BaseDidCommPlugin, BaseDidCommPluginOptions } from './plugins/setupBaseDidComm';
@@ -21,3 +17,6 @@ export { webhookListener } from './utils/webhook';
21
17
  export type { WebhookData } from './utils/webhook';
22
18
  export { sendWebhookEvent, sendMessageReceivedEvent } from './utils/webhookEvent';
23
19
  export * from './utils/util';
20
+ export * from './utils/setupSelfTr';
21
+ export * from './utils/trustCredentialStore';
22
+ export * from './blockchain';
package/build/index.js CHANGED
@@ -14,12 +14,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.sendMessageReceivedEvent = exports.sendWebhookEvent = exports.webhookListener = exports.getEcsSchemas = exports.getRecordId = exports.getWebDid = exports.createInvitation = exports.deleteTailsEntry = exports.baseFilePath = exports.tailsIndex = exports.FullTailsFileService = exports.VsAgentWsOutboundTransport = exports.WebSocketTransportSession = exports.VsAgentWsInboundTransport = exports.HttpTransportSession = exports.HttpInboundTransport = exports.getLegacyDidDocument = exports.WebDidRegistrar = exports.CachedWebDidResolver = exports.MESSAGE_HANDLERS = exports.setupBaseDidComm = exports.createVsAgent = exports.VsAgent = void 0;
17
+ exports.sendMessageReceivedEvent = exports.sendWebhookEvent = exports.webhookListener = exports.getEcsSchemas = exports.getRecordId = exports.getWebDid = exports.createInvitation = exports.deleteTailsEntry = exports.baseFilePath = exports.tailsIndex = exports.FullTailsFileService = exports.VsAgentWsOutboundTransport = exports.WebSocketTransportSession = exports.VsAgentWsInboundTransport = exports.HttpTransportSession = exports.HttpInboundTransport = exports.getLegacyDidDocument = exports.WebDidRegistrar = exports.CachedWebDidResolver = exports.MESSAGE_HANDLERS = exports.setupBaseDidComm = void 0;
18
18
  // Agent
19
- var VsAgent_1 = require("./agent/VsAgent");
20
- Object.defineProperty(exports, "VsAgent", { enumerable: true, get: function () { return VsAgent_1.VsAgent; } });
21
- var createVsAgent_1 = require("./agent/createVsAgent");
22
- Object.defineProperty(exports, "createVsAgent", { enumerable: true, get: function () { return createVsAgent_1.createVsAgent; } });
19
+ __exportStar(require("./agent"), exports);
23
20
  // Plugins
24
21
  var setupBaseDidComm_1 = require("./plugins/setupBaseDidComm");
25
22
  Object.defineProperty(exports, "setupBaseDidComm", { enumerable: true, get: function () { return setupBaseDidComm_1.setupBaseDidComm; } });
@@ -60,4 +57,7 @@ var webhookEvent_1 = require("./utils/webhookEvent");
60
57
  Object.defineProperty(exports, "sendWebhookEvent", { enumerable: true, get: function () { return webhookEvent_1.sendWebhookEvent; } });
61
58
  Object.defineProperty(exports, "sendMessageReceivedEvent", { enumerable: true, get: function () { return webhookEvent_1.sendMessageReceivedEvent; } });
62
59
  __exportStar(require("./utils/util"), exports);
60
+ __exportStar(require("./utils/setupSelfTr"), exports);
61
+ __exportStar(require("./utils/trustCredentialStore"), exports);
62
+ __exportStar(require("./blockchain"), exports);
63
63
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,QAAQ;AACR,2CAAyC;AAAhC,kGAAA,OAAO,OAAA;AAGhB,uDAAqD;AAA5C,8GAAA,aAAa,OAAA;AAItB,UAAU;AACV,+DAA6D;AAApD,oHAAA,gBAAgB,OAAA;AAKzB,iCAA0C;AAAjC,yGAAA,gBAAgB,OAAA;AAEzB,gBAAgB;AAChB,mEAAiE;AAAxD,4HAAA,oBAAoB,OAAA;AAC7B,yDAAuD;AAA9C,kHAAA,eAAe,OAAA;AACxB,mDAAyD;AAAhD,oHAAA,oBAAoB,OAAA;AAE7B,aAAa;AACb,0EAA8F;AAArF,4HAAA,oBAAoB,OAAA;AAAE,4HAAA,oBAAoB,OAAA;AACnD,oFAA6G;AAApG,sIAAA,yBAAyB,OAAA;AAAE,sIAAA,yBAAyB,OAAA;AAC7D,sFAAoF;AAA3E,wIAAA,0BAA0B,OAAA;AAEnC,cAAc;AACd,2EAK2C;AAJzC,4HAAA,oBAAoB,OAAA;AACpB,kHAAA,UAAU,OAAA;AACV,oHAAA,YAAY,OAAA;AACZ,wHAAA,gBAAgB,OAAA;AAGlB,QAAQ;AACR,uCAAwE;AAA/D,yGAAA,gBAAgB,OAAA;AAAE,kGAAA,SAAS,OAAA;AAAE,oGAAA,WAAW,OAAA;AACjD,qCAA4C;AAAnC,qGAAA,aAAa,OAAA;AACtB,2CAAiD;AAAxC,0GAAA,eAAe,OAAA;AAExB,qDAAiF;AAAxE,gHAAA,gBAAgB,OAAA;AAAE,wHAAA,wBAAwB,OAAA;AACnD,+CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,QAAQ;AACR,0CAAuB;AAGvB,UAAU;AACV,+DAA6D;AAApD,oHAAA,gBAAgB,OAAA;AAKzB,iCAA0C;AAAjC,yGAAA,gBAAgB,OAAA;AAEzB,gBAAgB;AAChB,mEAAiE;AAAxD,4HAAA,oBAAoB,OAAA;AAC7B,yDAAuD;AAA9C,kHAAA,eAAe,OAAA;AACxB,mDAAyD;AAAhD,oHAAA,oBAAoB,OAAA;AAE7B,aAAa;AACb,0EAA8F;AAArF,4HAAA,oBAAoB,OAAA;AAAE,4HAAA,oBAAoB,OAAA;AACnD,oFAA6G;AAApG,sIAAA,yBAAyB,OAAA;AAAE,sIAAA,yBAAyB,OAAA;AAC7D,sFAAoF;AAA3E,wIAAA,0BAA0B,OAAA;AAEnC,cAAc;AACd,2EAK2C;AAJzC,4HAAA,oBAAoB,OAAA;AACpB,kHAAA,UAAU,OAAA;AACV,oHAAA,YAAY,OAAA;AACZ,wHAAA,gBAAgB,OAAA;AAGlB,QAAQ;AACR,uCAAwE;AAA/D,yGAAA,gBAAgB,OAAA;AAAE,kGAAA,SAAS,OAAA;AAAE,oGAAA,WAAW,OAAA;AACjD,qCAA4C;AAAnC,qGAAA,aAAa,OAAA;AACtB,2CAAiD;AAAxC,0GAAA,eAAe,OAAA;AAExB,qDAAiF;AAAxE,gHAAA,gBAAgB,OAAA;AAAE,wHAAA,wBAAwB,OAAA;AACnD,+CAA4B;AAC5B,sDAAmC;AACnC,+DAA4C;AAE5C,+CAA4B"}
@@ -1,9 +1,11 @@
1
+ import type { DidCommVersion } from '@credo-ts/didcomm';
1
2
  import { AskarModuleConfigStoreOptions } from '@credo-ts/askar';
2
3
  import { BaseAgentModules } from '../agent/VsAgent';
3
4
  export interface BaseDidCommPluginOptions {
4
5
  walletConfig: AskarModuleConfigStoreOptions;
5
6
  publicApiBaseUrl: string;
6
7
  endpoints: string[];
8
+ didcommVersions?: DidCommVersion[];
7
9
  }
8
10
  export interface BaseDidCommPlugin {
9
11
  modules: BaseAgentModules;
@@ -19,14 +19,21 @@ const VsAgentWsOutboundTransport_1 = require("../transports/VsAgentWsOutboundTra
19
19
  * For chat protocols, add setupChatProtocols(). For eMRTD, add setupMrtdProtocol().
20
20
  */
21
21
  function setupBaseDidComm(options) {
22
+ var _a;
22
23
  return {
23
24
  modules: {
24
25
  didcomm: new didcomm_1.DidCommModule({
25
26
  endpoints: options.endpoints,
27
+ didcommVersions: options.didcommVersions,
28
+ // BasicMessage protocols must be set separately, otherwise Credo rejects basicmessage/2.0.
29
+ basicMessages: { protocols: (_a = options.didcommVersions) !== null && _a !== void 0 ? _a : ['v1'] },
26
30
  transports: {
27
31
  outbound: [new didcomm_1.DidCommHttpOutboundTransport(), new VsAgentWsOutboundTransport_1.VsAgentWsOutboundTransport()],
28
32
  },
29
- connections: { autoAcceptConnections: true },
33
+ connections: {
34
+ autoAcceptConnections: true,
35
+ autoCreateConnectionOnFirstMessage: true,
36
+ },
30
37
  credentials: {
31
38
  autoAcceptCredentials: didcomm_1.DidCommAutoAcceptCredential.ContentApproved,
32
39
  credentialProtocols: [
@@ -34,6 +41,7 @@ function setupBaseDidComm(options) {
34
41
  credentialFormats: [
35
42
  new anoncreds_1.LegacyIndyDidCommCredentialFormatService(),
36
43
  new anoncreds_1.AnonCredsDidCommCredentialFormatService(),
44
+ new didcomm_1.DidCommJsonLdCredentialFormatService(),
37
45
  ],
38
46
  }),
39
47
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"setupBaseDidComm.js","sourceRoot":"","sources":["../../src/plugins/setupBaseDidComm.ts"],"names":[],"mappings":";;AA2CA,4CA4DC;AAvGD,mDAM4B;AAC5B,2CAA4E;AAC5E,yCAAiE;AACjE,+CAO0B;AAC1B,2CAA6F;AAC7F,oEAAyD;AACzD,sEAA2D;AAC3D,yEAAmE;AAGnE,8EAA0E;AAC1E,sEAAmE;AACnE,sEAAkE;AAClE,4DAAwD;AACxD,yFAAqF;AAYrF;;;GAGG;AACH,SAAgB,gB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 -110,7 +110,7 @@ class VsAgentWsInboundTransport {
110
110
  socket.lastActivity = new Date();
111
111
  try {
112
112
  const messageReceiver = agentContext.dependencyManager.resolve(didcomm_1.DidCommMessageReceiver);
113
- await messageReceiver.receiveMessage(JSON.parse(event.data), session);
113
+ await messageReceiver.receiveMessage(JSON.parse(event.data), { session });
114
114
  }
115
115
  catch (error) {
116
116
  this.logger.error('Error processing message');
@@ -1 +1 @@
1
- {"version":3,"file":"VsAgentWsInboundTransport.js","sourceRoot":"","sources":["../../src/transports/VsAgentWsInboundTransport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAwE;AACxE,+CAQ0B;AAC1B,yCAAsC;AAQtC,MAAa,yBAAyB;IAOpC,YAAmB,EACjB,MAAM,EACN,IAAI,GACwE;QAN9E,4FAA4F;QACpF,cAAS,GAA4B,EAAE,CAAA;QAM7C,IAAI,CAAC,YAAY,GAAG,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,WAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IACpD,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,YAA0B;QAC3C,MAAM,gBAAgB,GAAG,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,iCAAuB,CAAC,CAAA;QACxF,MAAM,OAAO,GAAG,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,oBAAU,CAAC,CAAA;QAElE,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,MAAM,CAAA;QACxC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAA;QAExD,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAA;QACzE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE;YACjD,QA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@@ -1,4 +1,4 @@
1
- import { DidCommMessage } from '@credo-ts/didcomm';
1
+ import { DidCommMessage, type DidCommVersion } from '@credo-ts/didcomm';
2
2
  import { VsAgent } from '../agent/VsAgent';
3
3
  /**
4
4
  * Creates an out of band invitation that will equal to the public DID in case the agent has one defined,
@@ -13,6 +13,7 @@ export declare function createInvitation(options: {
13
13
  useLegacyDid?: boolean;
14
14
  invitationBaseUrl: string;
15
15
  imageUrl?: string;
16
+ didCommVersion?: DidCommVersion;
16
17
  }): Promise<{
17
18
  url: string;
18
19
  }>;
@@ -13,19 +13,25 @@ const didcomm_1 = require("@credo-ts/didcomm");
13
13
  * @returns
14
14
  */
15
15
  async function createInvitation(options) {
16
- const { agent, messages, useLegacyDid, invitationBaseUrl, imageUrl } = options;
16
+ const { agent, messages, useLegacyDid, invitationBaseUrl, imageUrl, didCommVersion } = options;
17
17
  // Use legacy did:web in case agent's did is webvh and using legacy did
18
- const invitationDid = agent.did && (0, core_1.parseDid)(agent.did).method === 'webvh' && useLegacyDid
18
+ const ourDid = agent.did && (0, core_1.parseDid)(agent.did).method === 'webvh' && useLegacyDid
19
19
  ? `did:web:${(0, core_1.parseDid)(agent.did).id.split(':')[1]}`
20
20
  : agent.did;
21
- const outOfBandInvitation = (await agent.didcomm.oob.createInvitation({
22
- label: agent.label,
23
- handshakeProtocols: [didcomm_1.DidCommHandshakeProtocol.DidExchange, didcomm_1.DidCommHandshakeProtocol.Connections],
24
- invitationDid,
25
- multiUseInvitation: !messages,
26
- imageUrl,
27
- messages,
28
- })).outOfBandInvitation;
21
+ const effectiveVersion = didCommVersion !== null && didCommVersion !== void 0 ? didCommVersion : (agent.didcomm.config.sendsV2 ? 'v2' : 'v1');
22
+ const isV2 = effectiveVersion === 'v2';
23
+ if (!agent.didcomm.config.didcommVersions.includes(effectiveVersion)) {
24
+ throw new Error(`Cannot create ${effectiveVersion} invitation: agent is configured with ` +
25
+ `didcommVersions: [${agent.didcomm.config.didcommVersions.join(', ')}]. ` +
26
+ `Add "${effectiveVersion}" to AGENT_DIDCOMM_VERSIONS or omit didCommVersion from the request.`);
27
+ }
28
+ const outOfBandInvitation = (await agent.didcomm.oob.createInvitation(Object.assign({ label: agent.label, multiUseInvitation: !messages, imageUrl,
29
+ messages, didCommVersion: effectiveVersion }, (isV2
30
+ ? { ourDid }
31
+ : {
32
+ handshakeProtocols: [didcomm_1.DidCommHandshakeProtocol.DidExchange, didcomm_1.DidCommHandshakeProtocol.Connections],
33
+ invitationDid: ourDid,
34
+ })))).outOfBandInvitation;
29
35
  return {
30
36
  url: outOfBandInvitation.toUrl({
31
37
  domain: invitationBaseUrl,
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/utils/agent.ts"],"names":[],"mappings":";;AAYA,4CA8BC;AAED,kCAGC;AAED,8BAOC;AAxDD,yCAAyC;AACzC,+CAA4E;AAI5E;;;;;;GAMG;AACI,KAAK,UAAU,gBAAgB,CAAC,OAMtC;IACC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;IAE9E,uEAAuE;IACvE,MAAM,aAAa,GACjB,KAAK,CAAC,GAAG,IAAI,IAAA,eAAQ,EAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,OAAO,IAAI,YAAY;QACjE,CAAC,CAAC,WAAW,IAAA,eAAQ,EAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;QACnD,CAAC,CAAC,KAAK,CAAC,GAAG,CAAA;IAEf,MAAM,mBAAmB,GAAG,CAC1B,MAAM,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;QACvC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,kBAAkB,EAAE,CAAC,kCAAwB,CAAC,WAAW,EAAE,kCAAwB,CAAC,WAAW,CAAC;QAChG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,mBAAmB,CAAC,KAAK,CAAC;YAC7B,MAAM,EAAE,iBAAiB;SAC1B,CAAC;KACH,CAAA;AACH,CAAC;AAEM,KAAK,UAAU,WAAW,CAAC,KAAc,EAAE,EAAU;;IAC1D,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;IACtD,OAAO,MAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,CAAC,WAAW,CAAY,mCAAI,EAAE,CAAA;AACtD,CAAC;AAEM,KAAK,UAAU,SAAS,CAAC,KAAc;IAC5C,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC;QACd,MAAM,SAAS,GAAG,IAAA,eAAQ,EAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAErC,IAAI,SAAS,CAAC,MAAM,KAAK,KAAK;YAAE,OAAO,KAAK,CAAC,GAAG,CAAA;QAChD,IAAI,SAAS,CAAC,MAAM,KAAK,OAAO;YAAE,OAAO,WAAW,SAAS,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAClF,CAAC;AACH,CAAC"}
@@ -0,0 +1,115 @@
1
+ import { W3cCredential, W3cPresentation, W3cCredentialSchema, W3cCredentialSubject, W3cJsonLdVerifiableCredential, W3cJsonLdVerifiablePresentation, W3cCredentialOptions, DidRecord, W3cPresentationOptions, Logger } from '@credo-ts/core';
2
+ import { AnySchemaObject } from 'ajv/dist/2020';
3
+ import { VsAgent } from '../agent/VsAgent';
4
+ interface SelfTrDefaults {
5
+ agentLabel: string;
6
+ agentInvitationImageUrl?: string;
7
+ fallbackBase64?: string;
8
+ serviceType: string;
9
+ serviceDescription: string;
10
+ serviceMinimumAgeRequired: number;
11
+ serviceTermsAndConditions: string;
12
+ servicePrivacyPolicy: string;
13
+ orgRegistryId: string;
14
+ orgRegistryUrl: string;
15
+ orgAddress: string;
16
+ orgType: string;
17
+ orgCountryCode: string;
18
+ }
19
+ export declare const presentations: {
20
+ name: string;
21
+ schemaUrl: string;
22
+ }[];
23
+ export declare const credentials: {
24
+ name: string;
25
+ credUrl: string;
26
+ schemaUrl: string;
27
+ }[];
28
+ export declare const createJsonSchema: W3cCredentialSchema;
29
+ export declare const createJsonSubjectRef: (id: string) => W3cCredentialSubject;
30
+ export declare const mapToSelfTr: (url: string, publicApiBaseUrl: string) => string;
31
+ export declare const setupSelfTr: ({ agent, publicApiBaseUrl, defaults, }: {
32
+ agent: VsAgent;
33
+ publicApiBaseUrl: string;
34
+ defaults: SelfTrDefaults;
35
+ }) => Promise<void>;
36
+ export declare function createCredential(options: Partial<W3cCredentialOptions>): W3cCredential;
37
+ /**
38
+ * Signs a W3C Verifiable Credential or Presentation using the provided agent and verification method.
39
+ *
40
+ * The function determines whether the input object is a `W3cCredential` or a `W3cPresentation`,
41
+ * and applies the appropriate signing operation using Linked Data Proofs (`Ed25519Signature2020`).
42
+ *
43
+ * @param agent - The agent instance.
44
+ * @param obj - The credential or presentation object to be signed.
45
+ * @param verificationMethod - The DID verification method used to generate the proof.
46
+ * @returns A signed W3C Verifiable Credential or Presentation in JSON-LD format.
47
+ */
48
+ export declare function signerW3c(agent: VsAgent, obj: W3cCredential, verificationMethod: string): Promise<W3cJsonLdVerifiableCredential>;
49
+ export declare function signerW3c(agent: VsAgent, obj: W3cPresentation, verificationMethod: string): Promise<W3cJsonLdVerifiablePresentation>;
50
+ /**
51
+ * Generates and signs a verifiable presentation containing a verifiable credential.
52
+ * Stores the signed presentation and its integrity metadata in the DID record.
53
+ *
54
+ * - Retrieves and validates claims for the agent's DID.
55
+ * - Computes an integrity digest for the claims.
56
+ * - If a presentation with the same integrity already exists in the DID metadata, it is returned.
57
+ * - Otherwise, a new presentation is created, signed, and stored in the DID metadata.
58
+ *
59
+ * @param agent - The VsAgent instance used for signing and DID management.
60
+ * @param logger - Logger instance for logging operations.
61
+ * @param ecsSchemas - Map of ECS schemas for validation.
62
+ * @param schemaKey - Unique identifier for the presentation type and metadata key.
63
+ * @param type - Array of credential types to include.
64
+ * @param credentialSchema - Schema definition for the credential.
65
+ * @returns The signed verifiable presentation, with integrity metadata.
66
+ */
67
+ export declare function generateVerifiablePresentation(agent: VsAgent, id: string, ecsSchemas: Record<string, string>, schemaKey: string, type: string[], credentialSchema: W3cCredentialSchema, defaults: SelfTrDefaults): Promise<any>;
68
+ export declare function createPresentation(options: Partial<W3cPresentationOptions>): W3cPresentation;
69
+ /**
70
+ * Retrieves and validates claims for a credential subject.
71
+ * If claims are not found, builds default claims based on the schemaKey.
72
+ * Validates claims against the ECS schema for the given schemaKey.
73
+ *
74
+ * @param ecsSchemas - Map of ECS schemas for validation.
75
+ * @param subject - Credential subject, including ID.
76
+ * @param schemaKey - Unique identifier for the credential type.
77
+ * @returns The validated claims object.
78
+ * @throws If claims are invalid or schema is missing.
79
+ */
80
+ export declare function getClaims(logger: Logger, ecsSchemas: Record<string, string>, { id, claims }: W3cCredentialSubject, schemaKey: string, defaults: SelfTrDefaults): Promise<Record<string, unknown>>;
81
+ /**
82
+ * Validate a validateSchema object against the corresponding AJV schema.
83
+ * Throws an Error if the schema is missing or validation fails.
84
+ */
85
+ export declare function validateSchema(ecsSchema: AnySchemaObject, credentialSubject: Record<string, any>): void;
86
+ /**
87
+ * Adds a Subresource Integrity (SRI) digest to the provided data using the schema content
88
+ * fetched from the provided URL or from a local schema map as fallback.
89
+ *
90
+ * @template T - The type of the data object.
91
+ * @param id - The URL of the schema to fetch.
92
+ * @param data - The object to which the digest will be added.
93
+ * @param ecsSchemas - Optional map of local schemas to use as fallback if the fetch fails.
94
+ * @returns A new object combining the original data and a `digestSRI` property.
95
+ * @throws Error if both the fetch and local fallback fail.
96
+ */
97
+ export declare function addDigestSRI<T extends object>(id?: string, data?: T, ecsSchemas?: Record<string, string>): Promise<T & {
98
+ digestSRI: string;
99
+ }>;
100
+ /**
101
+ * Generates a SRI digest string for the given content using the specified algorithm.
102
+ * @param content - The content to hash.
103
+ * @param algorithm - The hash algorithm to use (default: sha256).
104
+ * @returns The SRI digest string.
105
+ */
106
+ export declare function generateDigestSRI(content: string, algorithm?: string): string;
107
+ /**
108
+ * Converts an image URL to a Base64-encoded data URI string.
109
+ *
110
+ * @param url - The image URL to convert.
111
+ * @returns A Base64 data URI string, or a fallback placeholder if the image cannot be fetched or is invalid.
112
+ */
113
+ export declare function urlToBase64(logger: Logger, url: string | undefined, fallback: string): Promise<string>;
114
+ export declare function getVerificationMethodId(logger: Logger, didRecord: DidRecord): string;
115
+ export {};