@verana-labs/vs-agent-sdk 2.0.0-dev.9 → 2.0.0-dev.90

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 (183) 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 +8 -0
  12. package/build/adminApi/moduleEndpoint.js +28 -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 +25 -34
  30. package/build/agent/VsAgent.js +86 -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 +5 -3
  39. package/build/blockchain/AuthorizationService.js +17 -29
  40. package/build/blockchain/AuthorizationService.js.map +1 -1
  41. package/build/blockchain/IndexerWebSocketService.d.ts +7 -2
  42. package/build/blockchain/IndexerWebSocketService.js +67 -36
  43. package/build/blockchain/IndexerWebSocketService.js.map +1 -1
  44. package/build/blockchain/VeranaChainService.d.ts +38 -27
  45. package/build/blockchain/VeranaChainService.js +169 -177
  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/IndexerHandlerRegistry.d.ts +0 -1
  54. package/build/blockchain/handlers/IndexerHandlerRegistry.js.map +1 -1
  55. package/build/blockchain/handlers/authorizationHandlers.js +2 -2
  56. package/build/blockchain/handlers/authorizationHandlers.js.map +1 -1
  57. package/build/blockchain/handlers/defaultHandlers.js +7 -2
  58. package/build/blockchain/handlers/defaultHandlers.js.map +1 -1
  59. package/build/blockchain/handlers/index.d.ts +1 -0
  60. package/build/blockchain/handlers/index.js +1 -0
  61. package/build/blockchain/handlers/index.js.map +1 -1
  62. package/build/blockchain/handlers/selfIssuanceHandlers.d.ts +13 -0
  63. package/build/blockchain/handlers/selfIssuanceHandlers.js +76 -0
  64. package/build/blockchain/handlers/selfIssuanceHandlers.js.map +1 -0
  65. package/build/blockchain/handlers/stateMutations.d.ts +27 -4
  66. package/build/blockchain/handlers/stateMutations.js +325 -44
  67. package/build/blockchain/handlers/stateMutations.js.map +1 -1
  68. package/build/blockchain/index.d.ts +4 -0
  69. package/build/blockchain/index.js +4 -0
  70. package/build/blockchain/index.js.map +1 -1
  71. package/build/blockchain/indexerMappers.d.ts +3 -0
  72. package/build/blockchain/indexerMappers.js +53 -0
  73. package/build/blockchain/indexerMappers.js.map +1 -0
  74. package/build/blockchain/triggerResolver.d.ts +26 -0
  75. package/build/blockchain/triggerResolver.js +120 -0
  76. package/build/blockchain/triggerResolver.js.map +1 -0
  77. package/build/blockchain/types.d.ts +13 -70
  78. package/build/blockchain/types.js.map +1 -1
  79. package/build/bootstrap/EcsBootstrapService.d.ts +13 -4
  80. package/build/bootstrap/EcsBootstrapService.js +170 -124
  81. package/build/bootstrap/EcsBootstrapService.js.map +1 -1
  82. package/build/connections/ParentConnectionModule.d.ts +20 -0
  83. package/build/connections/ParentConnectionModule.js +56 -0
  84. package/build/connections/ParentConnectionModule.js.map +1 -0
  85. package/build/credentials/FullTailsFileService.d.ts +0 -1
  86. package/build/credentials/FullTailsFileService.js +0 -49
  87. package/build/credentials/FullTailsFileService.js.map +1 -1
  88. package/build/did/CachedDocumentLoader.d.ts +3 -0
  89. package/build/did/CachedDocumentLoader.js +7 -1
  90. package/build/did/CachedDocumentLoader.js.map +1 -1
  91. package/build/did/CachedWebDidResolver.d.ts +0 -4
  92. package/build/did/CachedWebDidResolver.js +1 -5
  93. package/build/did/CachedWebDidResolver.js.map +1 -1
  94. package/build/did/artifactServices.d.ts +12 -0
  95. package/build/did/artifactServices.js +48 -0
  96. package/build/did/artifactServices.js.map +1 -0
  97. package/build/did/legacyDidWeb.d.ts +6 -4
  98. package/build/did/legacyDidWeb.js +17 -14
  99. package/build/did/legacyDidWeb.js.map +1 -1
  100. package/build/did/publicDid.d.ts +4 -0
  101. package/build/did/publicDid.js +19 -0
  102. package/build/did/publicDid.js.map +1 -0
  103. package/build/events/BaseMessageEvents.js +139 -5
  104. package/build/events/BaseMessageEvents.js.map +1 -1
  105. package/build/events/ConnectionEvents.js +151 -87
  106. package/build/events/ConnectionEvents.js.map +1 -1
  107. package/build/events/VsAgentEvents.d.ts +11 -9
  108. package/build/events/VsAgentEvents.js +8 -1
  109. package/build/events/VsAgentEvents.js.map +1 -1
  110. package/build/events/VtFlowEvents.d.ts +1 -1
  111. package/build/events/VtFlowEvents.js +29 -17
  112. package/build/events/VtFlowEvents.js.map +1 -1
  113. package/build/index.d.ts +7 -1
  114. package/build/index.js +15 -2
  115. package/build/index.js.map +1 -1
  116. package/build/plugins/setupBaseDidComm.js +9 -12
  117. package/build/plugins/setupBaseDidComm.js.map +1 -1
  118. package/build/transports/VsAgentWsInboundTransport.d.ts +1 -1
  119. package/build/transports/VsAgentWsInboundTransport.js +20 -14
  120. package/build/transports/VsAgentWsInboundTransport.js.map +1 -1
  121. package/build/types.d.ts +14 -13
  122. package/build/types.js +1 -2
  123. package/build/types.js.map +1 -1
  124. package/build/utils/agent.d.ts +34 -4
  125. package/build/utils/agent.js +103 -22
  126. package/build/utils/agent.js.map +1 -1
  127. package/build/utils/boundedFetch.d.ts +13 -0
  128. package/build/utils/boundedFetch.js +47 -0
  129. package/build/utils/boundedFetch.js.map +1 -0
  130. package/build/utils/didReadiness.js +5 -2
  131. package/build/utils/didReadiness.js.map +1 -1
  132. package/build/utils/ecsClaims.d.ts +46 -0
  133. package/build/utils/ecsClaims.js +115 -0
  134. package/build/utils/ecsClaims.js.map +1 -0
  135. package/build/utils/ecsService.d.ts +8 -0
  136. package/build/utils/ecsService.js +23 -0
  137. package/build/utils/ecsService.js.map +1 -0
  138. package/build/utils/index.d.ts +7 -0
  139. package/build/utils/index.js +7 -0
  140. package/build/utils/index.js.map +1 -1
  141. package/build/utils/publishedDidRecord.d.ts +15 -0
  142. package/build/utils/publishedDidRecord.js +83 -0
  143. package/build/utils/publishedDidRecord.js.map +1 -0
  144. package/build/utils/selfIssuedEcsCredential.d.ts +8 -0
  145. package/build/utils/selfIssuedEcsCredential.js +153 -0
  146. package/build/utils/selfIssuedEcsCredential.js.map +1 -0
  147. package/build/utils/setupSelfTr.d.ts +35 -74
  148. package/build/utils/setupSelfTr.js +93 -312
  149. package/build/utils/setupSelfTr.js.map +1 -1
  150. package/build/utils/trustCredentialStore.d.ts +78 -9
  151. package/build/utils/trustCredentialStore.js +324 -136
  152. package/build/utils/trustCredentialStore.js.map +1 -1
  153. package/build/utils/typeMetadata.d.ts +44 -0
  154. package/build/utils/typeMetadata.js +89 -0
  155. package/build/utils/typeMetadata.js.map +1 -0
  156. package/build/utils/util.d.ts +20 -0
  157. package/build/utils/util.js +29 -0
  158. package/build/utils/util.js.map +1 -1
  159. package/build/utils/vcdm2.d.ts +34 -0
  160. package/build/utils/vcdm2.js +60 -0
  161. package/build/utils/vcdm2.js.map +1 -0
  162. package/build/utils/vtjscResolver.d.ts +23 -0
  163. package/build/utils/vtjscResolver.js +53 -0
  164. package/build/utils/vtjscResolver.js.map +1 -0
  165. package/build/vtFlow/VtFlowOrchestrator.d.ts +107 -15
  166. package/build/vtFlow/VtFlowOrchestrator.js +678 -116
  167. package/build/vtFlow/VtFlowOrchestrator.js.map +1 -1
  168. package/build/vtFlow/assertVerifiableService.d.ts +31 -2
  169. package/build/vtFlow/assertVerifiableService.js +68 -10
  170. package/build/vtFlow/assertVerifiableService.js.map +1 -1
  171. package/build/vtFlow/ecsIssuanceExemption.d.ts +12 -0
  172. package/build/vtFlow/ecsIssuanceExemption.js +84 -0
  173. package/build/vtFlow/ecsIssuanceExemption.js.map +1 -0
  174. package/build/vtFlow/index.d.ts +1 -0
  175. package/build/vtFlow/index.js +1 -0
  176. package/build/vtFlow/index.js.map +1 -1
  177. package/package.json +18 -12
  178. package/build/did/migrateWebVhLog.d.ts +0 -34
  179. package/build/did/migrateWebVhLog.js +0 -230
  180. package/build/did/migrateWebVhLog.js.map +0 -1
  181. package/build/did/migrateWebVhVersionTime.d.ts +0 -9
  182. package/build/did/migrateWebVhVersionTime.js +0 -191
  183. 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,97 @@ 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
+ /** [VSA-ADM-VT-FL-VALIDATE-8]: at startup, resume every flow left in VALIDATION_TX_SUBMITTED. */
109
+ resumeValidationSubmissions(): Promise<void>;
110
+ /** [VSA-VTI-FLOW-ISSUE-1]: at startup, resume every anchoring left SUBMITTED through the stored issued credential. */
111
+ resumeIssuanceSubmissions(): Promise<void>;
33
112
  acceptCredential(input: AcceptCredentialInput): Promise<VtFlowRecord>;
34
113
  buildDirectIssuanceOffer(vtFlowRecordId: string): Promise<{
35
114
  credentialFormats: {
36
- jsonld: DidCommJsonLdCredentialDetailFormat;
115
+ dataIntegrity: DidCommDataIntegrityOfferCredentialFormat;
37
116
  };
38
117
  issuerParticipantId: number;
39
118
  } | null>;
119
+ /**
120
+ * Builds the unsigned VC Data Model 2.0 credential that goes into the offer. RFC 0809 derives the
121
+ * advertised data model version from its context, and the issuer secures it with a
122
+ * DataIntegrityProof once the applicant requests it.
123
+ */
40
124
  private buildCredential;
125
+ private resolveJsonSchemaCredentialId;
41
126
  /** Per the spec the algorithm comes from the schema, never from the digest value. */
42
127
  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>;
128
+ private credentialSchema;
129
+ /** Fired after signing and before delivery. A failed anchoring comes back in `issuance`, and the credential stays undelivered. */
130
+ onCredentialIssued(vtFlowRecordId: string, signedCredential: Record<string, unknown>): Promise<{
131
+ credentialDigest: string;
132
+ issuance: VtFlowIssuance;
133
+ }>;
45
134
  verifyOfferedCredential(vtFlowRecordId: string): Promise<void>;
135
+ /** [VSA-VTI-FLOW-FMT-1]. Credo already verified the proof and its assertionMethod key, for data model 2.0 only. */
136
+ private assertFlowCredentialFormat;
46
137
  onCredentialRevoked(vtFlowRecordId: string): Promise<void>;
47
138
  onCredentialCompleted(vtFlowRecordId: string): Promise<void>;
48
- private triggerResolver;
49
- private getOfferedCredentialJson;
50
- private requireIndexer;
139
+ /** The signed credential as the issuer attached it, which is the exact JSON its digest covers. */
140
+ private getReceivedCredentialJson;
141
+ checkEcsIssuanceExemption(context: VtFlowEcsIssuanceExemptionContext): Promise<boolean>;
142
+ checkParticipantId({ record }: VtFlowCheckParticipantIdContext): Promise<boolean | 'validated'>;
51
143
  publishCredentialAsLinkedVp(vtFlowRecordId: string): Promise<void>;
52
144
  private extractSchemaBaseId;
53
145
  rotateRequesterDidToPeer(connectionId: string): Promise<void>;