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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) 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 +27 -34
  30. package/build/agent/VsAgent.js +102 -205
  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 -1
  42. package/build/blockchain/IndexerWebSocketService.js +67 -35
  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 -3
  64. package/build/blockchain/handlers/stateMutations.js +336 -42
  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 +14 -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 -80
  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 +149 -87
  107. package/build/events/ConnectionEvents.js.map +1 -1
  108. package/build/events/InvitationEvents.d.ts +6 -0
  109. package/build/events/InvitationEvents.js +57 -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/didReadiness.d.ts +9 -0
  140. package/build/utils/didReadiness.js +42 -0
  141. package/build/utils/didReadiness.js.map +1 -0
  142. package/build/utils/ecsClaims.d.ts +46 -0
  143. package/build/utils/ecsClaims.js +115 -0
  144. package/build/utils/ecsClaims.js.map +1 -0
  145. package/build/utils/ecsService.d.ts +8 -0
  146. package/build/utils/ecsService.js +23 -0
  147. package/build/utils/ecsService.js.map +1 -0
  148. package/build/utils/index.d.ts +7 -0
  149. package/build/utils/index.js +7 -0
  150. package/build/utils/index.js.map +1 -1
  151. package/build/utils/publishedDidRecord.d.ts +15 -0
  152. package/build/utils/publishedDidRecord.js +83 -0
  153. package/build/utils/publishedDidRecord.js.map +1 -0
  154. package/build/utils/selfIssuedEcsCredential.d.ts +8 -0
  155. package/build/utils/selfIssuedEcsCredential.js +158 -0
  156. package/build/utils/selfIssuedEcsCredential.js.map +1 -0
  157. package/build/utils/setupSelfTr.d.ts +35 -70
  158. package/build/utils/setupSelfTr.js +92 -283
  159. package/build/utils/setupSelfTr.js.map +1 -1
  160. package/build/utils/trustCredentialStore.d.ts +87 -9
  161. package/build/utils/trustCredentialStore.js +352 -125
  162. package/build/utils/trustCredentialStore.js.map +1 -1
  163. package/build/utils/typeMetadata.d.ts +44 -0
  164. package/build/utils/typeMetadata.js +89 -0
  165. package/build/utils/typeMetadata.js.map +1 -0
  166. package/build/utils/util.d.ts +20 -0
  167. package/build/utils/util.js +29 -0
  168. package/build/utils/util.js.map +1 -1
  169. package/build/utils/vcdm2.d.ts +34 -0
  170. package/build/utils/vcdm2.js +60 -0
  171. package/build/utils/vcdm2.js.map +1 -0
  172. package/build/utils/vtjscResolver.d.ts +23 -0
  173. package/build/utils/vtjscResolver.js +53 -0
  174. package/build/utils/vtjscResolver.js.map +1 -0
  175. package/build/vtFlow/VtFlowOrchestrator.d.ts +108 -15
  176. package/build/vtFlow/VtFlowOrchestrator.js +695 -117
  177. package/build/vtFlow/VtFlowOrchestrator.js.map +1 -1
  178. package/build/vtFlow/assertVerifiableService.d.ts +31 -2
  179. package/build/vtFlow/assertVerifiableService.js +68 -10
  180. package/build/vtFlow/assertVerifiableService.js.map +1 -1
  181. package/build/vtFlow/ecsIssuanceExemption.d.ts +12 -0
  182. package/build/vtFlow/ecsIssuanceExemption.js +84 -0
  183. package/build/vtFlow/ecsIssuanceExemption.js.map +1 -0
  184. package/build/vtFlow/index.d.ts +1 -0
  185. package/build/vtFlow/index.js +1 -0
  186. package/build/vtFlow/index.js.map +1 -1
  187. package/package.json +26 -20
  188. package/build/did/migrateWebVhLog.d.ts +0 -34
  189. package/build/did/migrateWebVhLog.js +0 -230
  190. package/build/did/migrateWebVhLog.js.map +0 -1
  191. package/build/did/migrateWebVhVersionTime.d.ts +0 -9
  192. package/build/did/migrateWebVhVersionTime.js +0 -191
  193. package/build/did/migrateWebVhVersionTime.js.map +0 -1
@@ -1,10 +1,10 @@
1
- import { type DidCommJsonLdCredentialDetailFormat, type JsonCredential } from '@credo-ts/didcomm';
2
- import { VtFlowRecord } from '@verana-labs/credo-ts-didcomm-vt-flow';
1
+ import type { JsonObject } from '@credo-ts/core';
2
+ import type { DidCommDataIntegrityOfferCredentialFormat } from '@credo-ts/didcomm';
3
+ import { VtFlowRecord, type VtFlowCheckParticipantIdContext, type VtFlowEcsIssuanceExemptionContext, type VtFlowIssuance } from '@verana-labs/credo-ts-didcomm-vt-flow';
3
4
  import { BaseAgentModules, VsAgent } from '../agent';
4
- import { VeranaIndexerService } from '../blockchain/VeranaIndexerService';
5
+ import { Participant, ParticipantDto } from '../blockchain/types';
5
6
  export interface VtFlowOrchestratorOptions {
6
7
  publicApiBaseUrl?: string;
7
- indexer?: VeranaIndexerService;
8
8
  agentParticipantId?: number;
9
9
  walletAgentParticipantId?: number;
10
10
  }
@@ -13,13 +13,33 @@ export interface StartOnboardingProcessInput {
13
13
  participantSessionId?: string;
14
14
  claims?: Record<string, unknown>;
15
15
  }
16
- export interface ValidateAndOfferCredentialInput {
16
+ export interface ValidateOnboardingProcessInput {
17
17
  vtFlowRecordId: string;
18
+ /** Only for a HOLDER. It defaults to the schema of the applicant participant. */
19
+ credentialSchemaId?: string;
20
+ credentialType?: string[];
21
+ credentialContext?: string[];
22
+ }
23
+ export interface ValidateFlowInput {
24
+ vtFlowRecordId: string;
25
+ validationFees?: number;
26
+ issuanceFees?: number;
27
+ verificationFees?: number;
28
+ issuanceFeeDiscount?: number;
29
+ verificationFeeDiscount?: number;
30
+ effectiveUntil?: string;
31
+ opSummaryDigest?: string;
32
+ }
33
+ export interface OfferOnboardingCredentialInput {
34
+ vtFlowRecordId: string;
35
+ /** The credential validateOnboardingProcess built. Without it the method builds one. */
36
+ credential?: JsonObject;
37
+ /** It defaults to the schema of the applicant participant. */
38
+ credentialSchemaId?: string;
39
+ /** The participant validateOnboardingProcess returned; saves a second chain read. */
40
+ participant?: Participant;
18
41
  credentialType?: string[];
19
42
  credentialContext?: string[];
20
- credentialSchemaId: string;
21
- agentParticipantId?: number;
22
- walletAgentParticipantId?: number;
23
43
  }
24
44
  export interface AcceptCredentialInput {
25
45
  vtFlowRecordId: string;
@@ -29,25 +49,98 @@ export declare class VtFlowOrchestrator {
29
49
  private readonly options;
30
50
  constructor(agent: VsAgent<BaseAgentModules>, options?: VtFlowOrchestratorOptions);
31
51
  startOnboardingProcess(input: StartOnboardingProcessInput): Promise<VtFlowRecord>;
32
- validateAndOfferCredential(input: ValidateAndOfferCredentialInput): Promise<VtFlowRecord>;
52
+ /**
53
+ * Validate an onboarding process: record the outcome on-chain, accept the onboarding request and
54
+ * move the record to VALIDATED. It sends no credential. Only a HOLDER takes part in a credential
55
+ * exchange; an ISSUER, a VERIFIER or a grantor joins the Ecosystem, and SetParticipantOPToValidated
56
+ * is the whole of it. The caller decides what follows, from the role of the returned participant.
57
+ *
58
+ * For a HOLDER it builds the credential before the chain write, and returns it for
59
+ * offerOnboardingCredential. Claims that do not satisfy the schema, or a schema fetch that fails,
60
+ * must stop the process while the chain holds no outcome yet and the caller can repeat the call.
61
+ *
62
+ * A record that is already VALIDATED and has no credential exchange keeps the chain outcome and
63
+ * only builds the credential again. A repeat call thus re-drives an offer that did not complete.
64
+ */
65
+ validateOnboardingProcess(input: ValidateOnboardingProcessInput): Promise<{
66
+ record: VtFlowRecord;
67
+ participant: Participant;
68
+ credential?: JsonObject;
69
+ }>;
70
+ /**
71
+ * Offer the credential of an onboarding process to its applicant. Call it only for a HOLDER, and
72
+ * only after validateOnboardingProcess has moved the record to VALIDATED. Give it the credential
73
+ * that validateOnboardingProcess built, so that the process does not build the credential twice.
74
+ */
75
+ offerOnboardingCredential(input: OfferOnboardingCredentialInput): Promise<VtFlowRecord>;
76
+ /**
77
+ * Close an onboarding process that carries no credential exchange, on the validator side. The
78
+ * applicant reaches the same state from the SetParticipantOPToValidated chain event.
79
+ */
80
+ completeOnboardingProcess(vtFlowRecordId: string): Promise<VtFlowRecord>;
81
+ /** [VSA-ADM-VT-FL-VALIDATE] */
82
+ validateFlow(input: ValidateFlowInput): Promise<VtFlowRecord>;
83
+ private validateDirectIssuance;
84
+ private sendValidating;
85
+ private assertClaims;
86
+ private assertValidateState;
87
+ private validationTerms;
88
+ private assertClaimsAndTerm;
89
+ private submissionPath;
90
+ private submitValidation;
91
+ private preflight;
92
+ private anchor;
93
+ resolveValidationTx(recordId: string): Promise<void>;
94
+ private failUnlessValidated;
95
+ /**
96
+ * [VSA-VTI-FLOW-OP-ISSUE]: moves the flow to VALIDATED and fills `validation` from the validated
97
+ * entry. Without the landed transaction, a recorded broadcast keeps its tx, and its submission
98
+ * unless that tx failed.
99
+ */
100
+ markValidated(recordId: string, entry: ParticipantDto, landed?: {
101
+ hash: string;
102
+ height: number;
103
+ timestamp?: string;
104
+ }): Promise<VtFlowRecord>;
105
+ /** rejectFlow ended the flow with its transaction in flight, and no newer flow of the applicant replaced it ([VSA-ADM-VT-FL-REJECT-2]). */
106
+ isRejectedInFlight(record: VtFlowRecord): Promise<boolean>;
107
+ continueAfterValidated(recordId: string): Promise<VtFlowRecord>;
108
+ private issuanceAfterValidated;
109
+ /** [VSA-ADM-VT-FL-VALIDATE-8]: at startup, resume every flow left in VALIDATION_TX_SUBMITTED. */
110
+ resumeValidationSubmissions(): Promise<void>;
111
+ /** [VSA-VTI-FLOW-ISSUE-1]: at startup, resume every anchoring left SUBMITTED through the stored issued credential. */
112
+ resumeIssuanceSubmissions(): Promise<void>;
33
113
  acceptCredential(input: AcceptCredentialInput): Promise<VtFlowRecord>;
34
114
  buildDirectIssuanceOffer(vtFlowRecordId: string): Promise<{
35
115
  credentialFormats: {
36
- jsonld: DidCommJsonLdCredentialDetailFormat;
116
+ dataIntegrity: DidCommDataIntegrityOfferCredentialFormat;
37
117
  };
38
118
  issuerParticipantId: number;
39
119
  } | null>;
120
+ /**
121
+ * Builds the unsigned VC Data Model 2.0 credential that goes into the offer. RFC 0809 derives the
122
+ * advertised data model version from its context, and the issuer secures it with a
123
+ * DataIntegrityProof once the applicant requests it.
124
+ */
40
125
  private buildCredential;
126
+ private resolveJsonSchemaCredentialId;
41
127
  /** Per the spec the algorithm comes from the schema, never from the digest value. */
42
128
  private digestAlgorithmForSchema;
43
- /** Fired after signing and before delivery, so a failure here must abort the issuance. */
44
- onCredentialIssued(vtFlowRecordId: string, signedCredential: JsonCredential): Promise<string>;
129
+ private credentialSchema;
130
+ /** Fired after signing and before delivery. A failed anchoring comes back in `issuance`, and the credential stays undelivered. */
131
+ onCredentialIssued(vtFlowRecordId: string, signedCredential: Record<string, unknown>): Promise<{
132
+ credentialDigest: string;
133
+ issuance: VtFlowIssuance;
134
+ }>;
45
135
  verifyOfferedCredential(vtFlowRecordId: string): Promise<void>;
136
+ /** [VSA-VTI-FLOW-FMT-1]. Credo already verified the proof and its assertionMethod key, for data model 2.0 only. */
137
+ private assertFlowCredentialFormat;
46
138
  onCredentialRevoked(vtFlowRecordId: string): Promise<void>;
47
139
  onCredentialCompleted(vtFlowRecordId: string): Promise<void>;
48
- private triggerResolver;
49
- private getOfferedCredentialJson;
50
- private requireIndexer;
140
+ /** The signed credential as the issuer attached it, which is the exact JSON its digest covers. */
141
+ private getReceivedCredentialJson;
142
+ checkEcsIssuanceExemption(context: VtFlowEcsIssuanceExemptionContext): Promise<boolean>;
143
+ checkParticipantId({ record }: VtFlowCheckParticipantIdContext): Promise<boolean | 'validated'>;
51
144
  publishCredentialAsLinkedVp(vtFlowRecordId: string): Promise<void>;
52
145
  private extractSchemaBaseId;
53
146
  rotateRequesterDidToPeer(connectionId: string): Promise<void>;