@verana-labs/vs-agent-sdk 1.13.2-dev.1 → 2.0.0-ayni.1

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 (198) hide show
  1. package/README.md +0 -2
  2. package/build/adminApi/AdminApiError.d.ts +28 -0
  3. package/build/adminApi/AdminApiError.js +67 -0
  4. package/build/adminApi/AdminApiError.js.map +1 -0
  5. package/build/adminApi/didcommModules.d.ts +2 -0
  6. package/build/adminApi/didcommModules.js +8 -0
  7. package/build/adminApi/didcommModules.js.map +1 -0
  8. package/build/adminApi/index.d.ts +4 -0
  9. package/build/adminApi/index.js +21 -0
  10. package/build/adminApi/index.js.map +1 -0
  11. package/build/adminApi/moduleEndpoint.d.ts +7 -0
  12. package/build/adminApi/moduleEndpoint.js +21 -0
  13. package/build/adminApi/moduleEndpoint.js.map +1 -0
  14. package/build/adminApi/pagination/PageDto.d.ts +7 -0
  15. package/build/adminApi/pagination/PageDto.js +50 -0
  16. package/build/adminApi/pagination/PageDto.js.map +1 -0
  17. package/build/adminApi/pagination/PaginationQueryDto.d.ts +11 -0
  18. package/build/adminApi/pagination/PaginationQueryDto.js +46 -0
  19. package/build/adminApi/pagination/PaginationQueryDto.js.map +1 -0
  20. package/build/adminApi/pagination/cursor.d.ts +28 -0
  21. package/build/adminApi/pagination/cursor.js +64 -0
  22. package/build/adminApi/pagination/cursor.js.map +1 -0
  23. package/build/adminApi/pagination/index.d.ts +4 -0
  24. package/build/adminApi/pagination/index.js +21 -0
  25. package/build/adminApi/pagination/index.js.map +1 -0
  26. package/build/adminApi/pagination/paginate.d.ts +27 -0
  27. package/build/adminApi/pagination/paginate.js +77 -0
  28. package/build/adminApi/pagination/paginate.js.map +1 -0
  29. package/build/agent/VsAgent.d.ts +30 -34
  30. package/build/agent/VsAgent.js +148 -221
  31. package/build/agent/VsAgent.js.map +1 -1
  32. package/build/agent/createVsAgent.d.ts +9 -6
  33. package/build/agent/createVsAgent.js +5 -5
  34. package/build/agent/createVsAgent.js.map +1 -1
  35. package/build/blockchain/AnonCredsTrustService.d.ts +84 -0
  36. package/build/blockchain/AnonCredsTrustService.js +276 -0
  37. package/build/blockchain/AnonCredsTrustService.js.map +1 -0
  38. package/build/blockchain/AuthorizationService.d.ts +8 -6
  39. package/build/blockchain/AuthorizationService.js +30 -38
  40. package/build/blockchain/AuthorizationService.js.map +1 -1
  41. package/build/blockchain/IndexerWebSocketService.d.ts +7 -0
  42. package/build/blockchain/IndexerWebSocketService.js +72 -20
  43. package/build/blockchain/IndexerWebSocketService.js.map +1 -1
  44. package/build/blockchain/VeranaChainService.d.ts +38 -21
  45. package/build/blockchain/VeranaChainService.js +172 -140
  46. package/build/blockchain/VeranaChainService.js.map +1 -1
  47. package/build/blockchain/VeranaIndexerService.d.ts +14 -1
  48. package/build/blockchain/VeranaIndexerService.js +122 -8
  49. package/build/blockchain/VeranaIndexerService.js.map +1 -1
  50. package/build/blockchain/feePreflight.d.ts +32 -0
  51. package/build/blockchain/feePreflight.js +89 -0
  52. package/build/blockchain/feePreflight.js.map +1 -0
  53. package/build/blockchain/handlers/authorizationHandlers.js +2 -2
  54. package/build/blockchain/handlers/authorizationHandlers.js.map +1 -1
  55. package/build/blockchain/handlers/defaultHandlers.js +6 -1
  56. package/build/blockchain/handlers/defaultHandlers.js.map +1 -1
  57. package/build/blockchain/handlers/index.d.ts +1 -0
  58. package/build/blockchain/handlers/index.js +1 -0
  59. package/build/blockchain/handlers/index.js.map +1 -1
  60. package/build/blockchain/handlers/selfIssuanceHandlers.d.ts +13 -0
  61. package/build/blockchain/handlers/selfIssuanceHandlers.js +76 -0
  62. package/build/blockchain/handlers/selfIssuanceHandlers.js.map +1 -0
  63. package/build/blockchain/handlers/stateMutations.d.ts +26 -2
  64. package/build/blockchain/handlers/stateMutations.js +343 -48
  65. package/build/blockchain/handlers/stateMutations.js.map +1 -1
  66. package/build/blockchain/index.d.ts +4 -0
  67. package/build/blockchain/index.js +4 -0
  68. package/build/blockchain/index.js.map +1 -1
  69. package/build/blockchain/indexerMappers.d.ts +3 -0
  70. package/build/blockchain/indexerMappers.js +53 -0
  71. package/build/blockchain/indexerMappers.js.map +1 -0
  72. package/build/blockchain/triggerResolver.d.ts +26 -0
  73. package/build/blockchain/triggerResolver.js +110 -0
  74. package/build/blockchain/triggerResolver.js.map +1 -0
  75. package/build/blockchain/types.d.ts +15 -59
  76. package/build/blockchain/types.js.map +1 -1
  77. package/build/bootstrap/EcsBootstrapService.d.ts +16 -3
  78. package/build/bootstrap/EcsBootstrapService.js +214 -79
  79. package/build/bootstrap/EcsBootstrapService.js.map +1 -1
  80. package/build/connections/InvitationRecord.d.ts +50 -0
  81. package/build/connections/InvitationRecord.js +60 -0
  82. package/build/connections/InvitationRecord.js.map +1 -0
  83. package/build/connections/ParentConnectionModule.d.ts +22 -0
  84. package/build/connections/ParentConnectionModule.js +91 -0
  85. package/build/connections/ParentConnectionModule.js.map +1 -0
  86. package/build/credentials/FullTailsFileService.d.ts +0 -1
  87. package/build/credentials/FullTailsFileService.js +0 -49
  88. package/build/credentials/FullTailsFileService.js.map +1 -1
  89. package/build/did/CachedDocumentLoader.d.ts +3 -0
  90. package/build/did/CachedDocumentLoader.js +7 -1
  91. package/build/did/CachedDocumentLoader.js.map +1 -1
  92. package/build/did/CachedWebDidResolver.d.ts +0 -4
  93. package/build/did/CachedWebDidResolver.js +1 -5
  94. package/build/did/CachedWebDidResolver.js.map +1 -1
  95. package/build/did/artifactServices.d.ts +12 -0
  96. package/build/did/artifactServices.js +48 -0
  97. package/build/did/artifactServices.js.map +1 -0
  98. package/build/did/legacyDidWeb.d.ts +6 -4
  99. package/build/did/legacyDidWeb.js +17 -14
  100. package/build/did/legacyDidWeb.js.map +1 -1
  101. package/build/did/publicDid.d.ts +4 -0
  102. package/build/did/publicDid.js +19 -0
  103. package/build/did/publicDid.js.map +1 -0
  104. package/build/events/BaseMessageEvents.js +138 -14
  105. package/build/events/BaseMessageEvents.js.map +1 -1
  106. package/build/events/ConnectionEvents.js +121 -83
  107. package/build/events/ConnectionEvents.js.map +1 -1
  108. package/build/events/InvitationEvents.d.ts +6 -0
  109. package/build/events/InvitationEvents.js +68 -0
  110. package/build/events/InvitationEvents.js.map +1 -0
  111. package/build/events/VsAgentEvents.d.ts +18 -9
  112. package/build/events/VsAgentEvents.js +9 -1
  113. package/build/events/VsAgentEvents.js.map +1 -1
  114. package/build/events/VtFlowEvents.d.ts +1 -1
  115. package/build/events/VtFlowEvents.js +29 -17
  116. package/build/events/VtFlowEvents.js.map +1 -1
  117. package/build/events/index.d.ts +1 -0
  118. package/build/events/index.js +1 -0
  119. package/build/events/index.js.map +1 -1
  120. package/build/index.d.ts +9 -1
  121. package/build/index.js +20 -2
  122. package/build/index.js.map +1 -1
  123. package/build/plugins/setupBaseDidComm.js +20 -21
  124. package/build/plugins/setupBaseDidComm.js.map +1 -1
  125. package/build/transports/HttpInboundTransport.js +6 -1
  126. package/build/transports/HttpInboundTransport.js.map +1 -1
  127. package/build/transports/VsAgentWsInboundTransport.d.ts +1 -1
  128. package/build/transports/VsAgentWsInboundTransport.js +20 -14
  129. package/build/transports/VsAgentWsInboundTransport.js.map +1 -1
  130. package/build/types.d.ts +14 -13
  131. package/build/types.js +1 -2
  132. package/build/types.js.map +1 -1
  133. package/build/utils/agent.d.ts +42 -4
  134. package/build/utils/agent.js +126 -22
  135. package/build/utils/agent.js.map +1 -1
  136. package/build/utils/boundedFetch.d.ts +13 -0
  137. package/build/utils/boundedFetch.js +47 -0
  138. package/build/utils/boundedFetch.js.map +1 -0
  139. package/build/utils/data.js +212 -134
  140. package/build/utils/data.js.map +1 -1
  141. package/build/utils/didReadiness.d.ts +9 -0
  142. package/build/utils/didReadiness.js +42 -0
  143. package/build/utils/didReadiness.js.map +1 -0
  144. package/build/utils/ecsClaims.d.ts +46 -0
  145. package/build/utils/ecsClaims.js +115 -0
  146. package/build/utils/ecsClaims.js.map +1 -0
  147. package/build/utils/ecsService.d.ts +8 -0
  148. package/build/utils/ecsService.js +23 -0
  149. package/build/utils/ecsService.js.map +1 -0
  150. package/build/utils/index.d.ts +7 -0
  151. package/build/utils/index.js +7 -0
  152. package/build/utils/index.js.map +1 -1
  153. package/build/utils/publishedDidRecord.d.ts +15 -0
  154. package/build/utils/publishedDidRecord.js +83 -0
  155. package/build/utils/publishedDidRecord.js.map +1 -0
  156. package/build/utils/selfIssuedEcsCredential.d.ts +8 -0
  157. package/build/utils/selfIssuedEcsCredential.js +158 -0
  158. package/build/utils/selfIssuedEcsCredential.js.map +1 -0
  159. package/build/utils/setupSelfTr.d.ts +36 -74
  160. package/build/utils/setupSelfTr.js +95 -323
  161. package/build/utils/setupSelfTr.js.map +1 -1
  162. package/build/utils/trustCredentialStore.d.ts +87 -7
  163. package/build/utils/trustCredentialStore.js +388 -118
  164. package/build/utils/trustCredentialStore.js.map +1 -1
  165. package/build/utils/typeMetadata.d.ts +44 -0
  166. package/build/utils/typeMetadata.js +89 -0
  167. package/build/utils/typeMetadata.js.map +1 -0
  168. package/build/utils/util.d.ts +20 -0
  169. package/build/utils/util.js +29 -0
  170. package/build/utils/util.js.map +1 -1
  171. package/build/utils/vcdm2.d.ts +34 -0
  172. package/build/utils/vcdm2.js +60 -0
  173. package/build/utils/vcdm2.js.map +1 -0
  174. package/build/utils/vtjscResolver.d.ts +23 -0
  175. package/build/utils/vtjscResolver.js +53 -0
  176. package/build/utils/vtjscResolver.js.map +1 -0
  177. package/build/vtFlow/VtFlowOrchestrator.d.ts +111 -14
  178. package/build/vtFlow/VtFlowOrchestrator.js +724 -133
  179. package/build/vtFlow/VtFlowOrchestrator.js.map +1 -1
  180. package/build/vtFlow/assertVerifiableService.d.ts +31 -2
  181. package/build/vtFlow/assertVerifiableService.js +68 -10
  182. package/build/vtFlow/assertVerifiableService.js.map +1 -1
  183. package/build/vtFlow/ecsIssuanceExemption.d.ts +12 -0
  184. package/build/vtFlow/ecsIssuanceExemption.js +84 -0
  185. package/build/vtFlow/ecsIssuanceExemption.js.map +1 -0
  186. package/build/vtFlow/index.d.ts +1 -0
  187. package/build/vtFlow/index.js +1 -0
  188. package/build/vtFlow/index.js.map +1 -1
  189. package/package.json +26 -20
  190. package/build/did/migrateWebVhLog.d.ts +0 -34
  191. package/build/did/migrateWebVhLog.js +0 -230
  192. package/build/did/migrateWebVhLog.js.map +0 -1
  193. package/build/did/migrateWebVhVersionTime.d.ts +0 -9
  194. package/build/did/migrateWebVhVersionTime.js +0 -191
  195. package/build/did/migrateWebVhVersionTime.js.map +0 -1
  196. package/build/vtFlow/credentialDigest.d.ts +0 -3
  197. package/build/vtFlow/credentialDigest.js +0 -23
  198. package/build/vtFlow/credentialDigest.js.map +0 -1
@@ -1,5 +1,6 @@
1
1
  import type { VsAgent } from '../agent/VsAgent';
2
- import { DidCommMessage, type DidCommVersion } from '@credo-ts/didcomm';
2
+ import { GenericRecord, TagsBase } from '@credo-ts/core';
3
+ import { type DidCommConnectionRecord, DidCommMessage, type DidCommOutOfBandInvitation, type DidCommOutOfBandRecord, type DidCommVersion } from '@credo-ts/didcomm';
3
4
  /**
4
5
  * Creates an out of band invitation that will equal to the public DID in case the agent has one defined,
5
6
  * and a new one every time in case the agent does not have any public DID.
@@ -11,11 +12,48 @@ export declare function createInvitation(options: {
11
12
  agent: VsAgent;
12
13
  messages?: DidCommMessage[];
13
14
  useLegacyDid?: boolean;
14
- invitationBaseUrl: string;
15
- imageUrl?: string;
16
15
  didCommVersion?: DidCommVersion;
16
+ unbranded?: boolean;
17
+ multiUseInvitation?: boolean;
18
+ goal?: string;
19
+ goalCode?: string;
17
20
  }): Promise<{
21
+ invitation: Record<string, unknown>;
22
+ outOfBandInvitation: DidCommOutOfBandInvitation;
23
+ outOfBandRecord: DidCommOutOfBandRecord;
18
24
  url: string;
19
25
  }>;
26
+ export declare function isUsableConnectionTo(connection: DidCommConnectionRecord, peerPublicDid: string): boolean;
27
+ /**
28
+ * Connects to a peer that publishes a public DID, and reuses the connection that the
29
+ * agent already has to that peer.
30
+ *
31
+ * The agent must keep one connection record only for each peer. A second record for the
32
+ * same pair of DIDs makes the `findByDids` lookup of the message receiver throw
33
+ * `RecordDuplicateError`, and the agent then fails to process every inbound message from
34
+ * that peer. To find the existing record, the agent reads the `publicDid` tag that it
35
+ * sets on each connection it opens to a peer that publishes a public DID, and the DIDs of
36
+ * the connections that the peer opened to the agent.
37
+ *
38
+ * Concurrent calls for the same peer share one attempt, within this process only.
39
+ *
40
+ * @param agent the local agent
41
+ * @param peerPublicDid the public DID of the peer
42
+ * @returns the id of a ready connection record
43
+ */
44
+ export declare function connectToPublicDid(agent: VsAgent, peerPublicDid: string): Promise<string>;
45
+ /**
46
+ * The DIDs that name this agent: its public DID and the alternative DIDs of the DID record, such
47
+ * as the parallel did:web of a did:webvh.
48
+ */
49
+ export declare function publicDidsOf(agent: VsAgent): Promise<string[]>;
20
50
  export declare function getRecordId(agent: VsAgent, id: string): Promise<string>;
21
- export declare function getWebDid(agent: VsAgent): Promise<string | undefined>;
51
+ /** The record type of every attested resource of the AnonCreds registry, per [VSA-PUB-AC]. */
52
+ export declare const ATTESTED_RESOURCE_TYPE = "AttestedResource";
53
+ export type AttestedResourceTags = TagsBase & {
54
+ type?: never;
55
+ attestedResourceId?: never;
56
+ };
57
+ export declare function saveAttestedResource(agent: VsAgent, resource: Record<string, unknown>, tags?: AttestedResourceTags): Promise<GenericRecord | undefined>;
58
+ export declare function findAttestedResources(agent: VsAgent, query: TagsBase): Promise<GenericRecord[]>;
59
+ export declare function findAttestedResource(agent: VsAgent, query: TagsBase): Promise<GenericRecord | undefined>;
@@ -1,10 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ATTESTED_RESOURCE_TYPE = void 0;
3
4
  exports.createInvitation = createInvitation;
5
+ exports.isUsableConnectionTo = isUsableConnectionTo;
6
+ exports.connectToPublicDid = connectToPublicDid;
7
+ exports.publicDidsOf = publicDidsOf;
4
8
  exports.getRecordId = getRecordId;
5
- exports.getWebDid = getWebDid;
9
+ exports.saveAttestedResource = saveAttestedResource;
10
+ exports.findAttestedResources = findAttestedResources;
11
+ exports.findAttestedResource = findAttestedResource;
6
12
  const core_1 = require("@credo-ts/core");
7
13
  const didcomm_1 = require("@credo-ts/didcomm");
14
+ const credo_ts_didcomm_vt_flow_1 = require("@verana-labs/credo-ts-didcomm-vt-flow");
15
+ const legacyDidWeb_1 = require("../did/legacyDidWeb");
16
+ const ecsService_1 = require("./ecsService");
8
17
  /**
9
18
  * Creates an out of band invitation that will equal to the public DID in case the agent has one defined,
10
19
  * and a new one every time in case the agent does not have any public DID.
@@ -13,43 +22,138 @@ const didcomm_1 = require("@credo-ts/didcomm");
13
22
  * @returns
14
23
  */
15
24
  async function createInvitation(options) {
16
- const { agent, messages, useLegacyDid, invitationBaseUrl, imageUrl, didCommVersion } = options;
17
- // Use legacy did:web in case agent's did is webvh and using legacy did
18
- const ourDid = agent.did && (0, core_1.parseDid)(agent.did).method === 'webvh' && useLegacyDid
19
- ? `did:web:${(0, core_1.parseDid)(agent.did).id.split(':')[1]}`
20
- : agent.did;
21
- const effectiveVersion = didCommVersion !== null && didCommVersion !== void 0 ? didCommVersion : (agent.didcomm.config.sendsV2 ? 'v2' : 'v1');
25
+ var _a, _b, _c, _d;
26
+ const { agent, messages, useLegacyDid, didCommVersion, unbranded, goal, goalCode } = options;
27
+ const ourDid = (_a = (useLegacyDid && agent.did ? (0, legacyDidWeb_1.getLegacyDidWeb)(agent.did) : undefined)) !== null && _a !== void 0 ? _a : agent.did;
28
+ const effectiveVersion = didCommVersion !== null && didCommVersion !== void 0 ? didCommVersion : 'v2';
22
29
  const isV2 = effectiveVersion === 'v2';
23
30
  if (!agent.didcomm.config.didcommVersions.includes(effectiveVersion)) {
24
31
  throw new Error(`Cannot create ${effectiveVersion} invitation: agent is configured with ` +
25
32
  `didcommVersions: [${agent.didcomm.config.didcommVersions.join(', ')}]. ` +
26
- `Add "${effectiveVersion}" to AGENT_DIDCOMM_VERSIONS or omit didCommVersion from the request.`);
33
+ `Add "${effectiveVersion}" to the agent's didcommVersions configuration.`);
27
34
  }
28
- const outOfBandInvitation = (await agent.didcomm.oob.createInvitation(Object.assign({ label: agent.label, multiUseInvitation: !messages, imageUrl,
35
+ const claims = unbranded ? undefined : await (0, ecsService_1.ecsServiceClaims)(agent);
36
+ const outOfBandRecord = await agent.didcomm.oob.createInvitation(Object.assign({ label: claims === null || claims === void 0 ? void 0 : claims.name, multiUseInvitation: (_b = options.multiUseInvitation) !== null && _b !== void 0 ? _b : !messages, imageUrl: claims === null || claims === void 0 ? void 0 : claims.logoUri, goal,
37
+ goalCode,
29
38
  messages, didCommVersion: effectiveVersion }, (isV2
30
39
  ? { ourDid }
31
40
  : {
32
- handshakeProtocols: [didcomm_1.DidCommHandshakeProtocol.DidExchange, didcomm_1.DidCommHandshakeProtocol.Connections],
41
+ handshakeProtocols: [didcomm_1.DidCommHandshakeProtocol.DidExchange],
33
42
  invitationDid: ourDid,
34
- })))).outOfBandInvitation;
43
+ })));
44
+ const { outOfBandInvitation } = outOfBandRecord;
35
45
  return {
36
- url: outOfBandInvitation.toUrl({
37
- domain: invitationBaseUrl,
38
- }),
46
+ invitation: (_d = (_c = outOfBandInvitation.v2Invitation) === null || _c === void 0 ? void 0 : _c.toJSON()) !== null && _d !== void 0 ? _d : outOfBandInvitation.toJSON(),
47
+ outOfBandInvitation,
48
+ outOfBandRecord,
49
+ url: outOfBandInvitation.toUrl({ domain: agent.publicApiBaseUrl }),
39
50
  };
40
51
  }
52
+ function isUsableConnectionTo(connection, peerPublicDid) {
53
+ return connection.isReady && !!connection.theirDid && (0, credo_ts_didcomm_vt_flow_1.peerAnchorDid)(connection) === peerPublicDid;
54
+ }
55
+ const pendingConnections = new Map();
56
+ /**
57
+ * Connects to a peer that publishes a public DID, and reuses the connection that the
58
+ * agent already has to that peer.
59
+ *
60
+ * The agent must keep one connection record only for each peer. A second record for the
61
+ * same pair of DIDs makes the `findByDids` lookup of the message receiver throw
62
+ * `RecordDuplicateError`, and the agent then fails to process every inbound message from
63
+ * that peer. To find the existing record, the agent reads the `publicDid` tag that it
64
+ * sets on each connection it opens to a peer that publishes a public DID, and the DIDs of
65
+ * the connections that the peer opened to the agent.
66
+ *
67
+ * Concurrent calls for the same peer share one attempt, within this process only.
68
+ *
69
+ * @param agent the local agent
70
+ * @param peerPublicDid the public DID of the peer
71
+ * @returns the id of a ready connection record
72
+ */
73
+ async function connectToPublicDid(agent, peerPublicDid) {
74
+ if (!agent.did)
75
+ throw new Error('Agent has no public DID');
76
+ const key = `${agent.did} ${peerPublicDid}`;
77
+ const pending = pendingConnections.get(key);
78
+ if (pending)
79
+ return pending;
80
+ const connecting = findOrOpenConnection(agent, agent.did, peerPublicDid).finally(() => pendingConnections.delete(key));
81
+ pendingConnections.set(key, connecting);
82
+ return connecting;
83
+ }
84
+ async function findOrOpenConnection(agent, ourDid, peerPublicDid) {
85
+ const connections = await agent.didcomm.connections.findAllByQuery({
86
+ $or: [
87
+ { publicDid: peerPublicDid },
88
+ { theirDid: peerPublicDid },
89
+ { previousTheirDids: [peerPublicDid] },
90
+ { invitationDid: peerPublicDid },
91
+ ],
92
+ });
93
+ const usable = connections.find(connection => isUsableConnectionTo(connection, peerPublicDid));
94
+ if (usable)
95
+ return usable.id;
96
+ const existing = connections.find(connection => connection.getTag('publicDid') === peerPublicDid);
97
+ if (existing)
98
+ await agent.didcomm.connections.deleteById(existing.id);
99
+ const { connectionRecord } = await agent.didcomm.oob.receiveImplicitInvitation({
100
+ did: peerPublicDid,
101
+ ourDid,
102
+ label: await (0, ecsService_1.agentDisplayName)(agent),
103
+ didCommVersion: 'v2',
104
+ });
105
+ if (!connectionRecord)
106
+ throw new Error(`Failed to establish a DIDComm connection to ${peerPublicDid}`);
107
+ try {
108
+ // Tag the record with the public DID of the peer, to find it on the next call.
109
+ connectionRecord.setTag('publicDid', peerPublicDid);
110
+ await agent.context.resolve(didcomm_1.DidCommConnectionRepository).update(agent.context, connectionRecord);
111
+ const ready = await agent.didcomm.connections.returnWhenIsConnected(connectionRecord.id);
112
+ return ready.id;
113
+ }
114
+ catch (error) {
115
+ // Without the tag, the next call cannot find this record. It dials again and leaves two
116
+ // records for the pair. The message receiver's findByDids then throws RecordDuplicateError.
117
+ await agent.didcomm.connections.deleteById(connectionRecord.id).catch(deleteError => {
118
+ agent.config.logger.warn(`Failed to delete the incomplete connection ${connectionRecord.id}`, {
119
+ error: deleteError,
120
+ });
121
+ });
122
+ throw error;
123
+ }
124
+ }
125
+ /**
126
+ * The DIDs that name this agent: its public DID and the alternative DIDs of the DID record, such
127
+ * as the parallel did:web of a did:webvh.
128
+ */
129
+ async function publicDidsOf(agent) {
130
+ if (!agent.did)
131
+ return [];
132
+ const [agentPublicDidRecord] = await agent.dids.getCreatedDids({ did: agent.did });
133
+ const alternativeDids = agentPublicDidRecord === null || agentPublicDidRecord === void 0 ? void 0 : agentPublicDidRecord.getTag('alternativeDids');
134
+ return [agent.did, ...(Array.isArray(alternativeDids) ? alternativeDids : [])];
135
+ }
41
136
  async function getRecordId(agent, id) {
42
137
  var _a;
43
138
  const record = await agent.genericRecords.findById(id);
44
139
  return (_a = record === null || record === void 0 ? void 0 : record.getTag('messageId')) !== null && _a !== void 0 ? _a : id;
45
140
  }
46
- async function getWebDid(agent) {
47
- if (agent.did) {
48
- const parsedDid = (0, core_1.parseDid)(agent.did);
49
- if (parsedDid.method === 'web')
50
- return agent.did;
51
- if (parsedDid.method === 'webvh')
52
- return `did:web:${parsedDid.id.split(':')[1]}`;
53
- }
141
+ /** The record type of every attested resource of the AnonCreds registry, per [VSA-PUB-AC]. */
142
+ exports.ATTESTED_RESOURCE_TYPE = 'AttestedResource';
143
+ async function saveAttestedResource(agent, resource, tags) {
144
+ if (!resource)
145
+ return undefined;
146
+ return await agent.genericRecords.save({
147
+ id: core_1.utils.uuid(),
148
+ content: resource,
149
+ tags: Object.assign({ attestedResourceId: resource.id, type: exports.ATTESTED_RESOURCE_TYPE }, tags),
150
+ });
151
+ }
152
+ async function findAttestedResources(agent, query) {
153
+ return await agent.genericRecords.findAllByQuery(Object.assign(Object.assign({}, query), { type: exports.ATTESTED_RESOURCE_TYPE }));
154
+ }
155
+ async function findAttestedResource(agent, query) {
156
+ const [record] = await findAttestedResources(agent, query);
157
+ return record;
54
158
  }
55
159
  //# sourceMappingURL=agent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/utils/agent.ts"],"names":[],"mappings":";;AAYA,4CA+CC;AAED,kCAGC;AAED,8BAOC;AAvED,yCAAyC;AACzC,+CAAiG;AAEjG;;;;;;GAMG;AACI,KAAK,UAAU,gBAAgB,CAAC,OAOtC;IACC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAA;IAE9F,uEAAuE;IACvE,MAAM,MAAM,GACV,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,gBAAgB,GAAmB,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACvG,MAAM,IAAI,GAAG,gBAAgB,KAAK,IAAI,CAAA;IAEtC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACrE,MAAM,IAAI,KAAK,CACb,iBAAiB,g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EM,KAAK,UAAU,oBAAoB,CACxC,KAAc,EACd,KAAe;IAEf,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,qBAAqB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAC1D,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -0,0 +1,13 @@
1
+ /** The `sha384-` subresource integrity metadata of the given bytes. */
2
+ export declare function digestOfBytes(content: string | Uint8Array): string;
3
+ /**
4
+ * Reads the bytes a URL serves under the network boundary the spec puts on step 3 of the trust
5
+ * decision: `https` only, no redirect, and an answer within five seconds. The address ban of that
6
+ * boundary is not enforced yet (#754).
7
+ */
8
+ export declare function fetchBoundedBytes(url: string, timeoutMs?: number): Promise<Uint8Array>;
9
+ /**
10
+ * The `sha384-` integrity metadata of the bytes a URL serves, read with {@link fetchBoundedBytes}.
11
+ * The digest covers the bytes on the wire, never a re-encoding of the decoded document.
12
+ */
13
+ export declare function digestOfBoundedUri(url: string, timeoutMs?: number): Promise<string>;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.digestOfBytes = digestOfBytes;
4
+ exports.fetchBoundedBytes = fetchBoundedBytes;
5
+ exports.digestOfBoundedUri = digestOfBoundedUri;
6
+ const crypto_1 = require("crypto");
7
+ const BOUNDED_TIMEOUT_MS = 5000;
8
+ /** The `sha384-` subresource integrity metadata of the given bytes. */
9
+ function digestOfBytes(content) {
10
+ return `sha384-${(0, crypto_1.createHash)('sha384').update(content).digest('base64')}`;
11
+ }
12
+ /**
13
+ * Reads the bytes a URL serves under the network boundary the spec puts on step 3 of the trust
14
+ * decision: `https` only, no redirect, and an answer within five seconds. The address ban of that
15
+ * boundary is not enforced yet (#754).
16
+ */
17
+ async function fetchBoundedBytes(url, timeoutMs = BOUNDED_TIMEOUT_MS) {
18
+ let target;
19
+ try {
20
+ target = new URL(url);
21
+ }
22
+ catch (_a) {
23
+ throw new Error(`${url} is not an absolute URL`);
24
+ }
25
+ if (target.protocol !== 'https:') {
26
+ throw new Error(`${url} does not use https, which this boundary requires`);
27
+ }
28
+ const response = await fetch(target.href, {
29
+ redirect: 'manual',
30
+ signal: AbortSignal.timeout(timeoutMs),
31
+ });
32
+ if (response.type === 'opaqueredirect' || (response.status >= 300 && response.status < 400)) {
33
+ throw new Error(`${url} answered with a redirect, which this boundary does not follow`);
34
+ }
35
+ if (!response.ok) {
36
+ throw new Error(`${url} answered ${response.status} ${response.statusText}`);
37
+ }
38
+ return new Uint8Array(await response.arrayBuffer());
39
+ }
40
+ /**
41
+ * The `sha384-` integrity metadata of the bytes a URL serves, read with {@link fetchBoundedBytes}.
42
+ * The digest covers the bytes on the wire, never a re-encoding of the decoded document.
43
+ */
44
+ async function digestOfBoundedUri(url, timeoutMs) {
45
+ return digestOfBytes(await fetchBoundedBytes(url, timeoutMs));
46
+ }
47
+ //# sourceMappingURL=boundedFetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundedFetch.js","sourceRoot":"","sources":["../../src/utils/boundedFetch.ts"],"names":[],"mappings":";;AAKA,sCAEC;AAOD,8CA0BC;AAMD,gDAEC;AAhDD,mCAAmC;AAEnC,MAAM,kBAAkB,GAAG,IAAK,CAAA;AAEhC,uEAAuE;AACvE,SAAgB,aAAa,CAAC,OAA4B;IACxD,OAAO,UAAU,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;AAC1E,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,iBAAiB,CACrC,GAAW,EACX,YAAoB,kBAAkB;IAEtC,IAAI,MAAW,CAAA;IACf,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;IACvB,CAAC;IAAC,WAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,yBAAyB,CAAC,CAAA;IAClD,CAAC;IACD,IAAI,MAAM,CAAC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