@@ -26,6 +26,7 @@ import {
26
26
import { user } from '@prisma/client' ;
27
27
import { InvitationMessage } from '@credebl/common/interfaces/agent-service.interface' ;
28
28
import { AgentSpinUpStatus } from '@credebl/enum/enum' ;
29
+ import { SignDataDto } from '../../api-gateway/src/agent-service/dto/agent-service.dto' ;
29
30
30
31
@Controller ( )
31
32
export class AgentServiceController {
@@ -37,7 +38,7 @@ export class AgentServiceController {
37
38
* @returns Get agent status
38
39
*/
39
40
@MessagePattern ( { cmd : 'agent-spinup' } )
40
- async walletProvision ( payload : { agentSpinupDto : IAgentSpinupDto , user : IUserRequestInterface } ) : Promise < {
41
+ async walletProvision ( payload : { agentSpinupDto : IAgentSpinupDto ; user : IUserRequestInterface } ) : Promise < {
41
42
agentSpinupStatus : AgentSpinUpStatus ;
42
43
} > {
43
44
return this . agentServiceService . walletProvision ( payload . agentSpinupDto , payload . user ) ;
@@ -46,8 +47,8 @@ export class AgentServiceController {
46
47
//DONE
47
48
@MessagePattern ( { cmd : 'create-tenant' } )
48
49
async createTenant ( payload : {
49
- createTenantDto : ITenantDto ,
50
- user : IUserRequestInterface ,
50
+ createTenantDto : ITenantDto ;
51
+ user : IUserRequestInterface ;
51
52
} ) : Promise < IAgentSpinUpSatus > {
52
53
return this . agentServiceService . createTenant ( payload . createTenantDto , payload . user ) ;
53
54
}
@@ -56,12 +57,12 @@ export class AgentServiceController {
56
57
* @returns did
57
58
*/
58
59
@MessagePattern ( { cmd : 'create-did' } )
59
- async createDid ( payload : { createDidDto : IDidCreate , orgId : string , user : IUserRequestInterface } ) : Promise < object > {
60
+ async createDid ( payload : { createDidDto : IDidCreate ; orgId : string ; user : IUserRequestInterface } ) : Promise < object > {
60
61
return this . agentServiceService . createDid ( payload . createDidDto , payload . orgId , payload . user ) ;
61
62
}
62
63
63
64
@MessagePattern ( { cmd : 'create-wallet' } )
64
- async createWallet ( payload : { createWalletDto : IWallet , user : IUserRequestInterface } ) : Promise < ITenantRecord > {
65
+ async createWallet ( payload : { createWalletDto : IWallet ; user : IUserRequestInterface } ) : Promise < ITenantRecord > {
65
66
return this . agentServiceService . createWallet ( payload . createWalletDto ) ;
66
67
}
67
68
@@ -73,7 +74,7 @@ export class AgentServiceController {
73
74
74
75
//DONE
75
76
@MessagePattern ( { cmd : 'agent-create-w3c-schema' } )
76
- async createW3CSchema ( payload : { url , orgId , schemaRequestPayload } ) : Promise < object > {
77
+ async createW3CSchema ( payload : { url ; orgId ; schemaRequestPayload } ) : Promise < object > {
77
78
return this . agentServiceService . createW3CSchema ( payload . url , payload . orgId , payload . schemaRequestPayload ) ;
78
79
}
79
80
@@ -99,8 +100,8 @@ export class AgentServiceController {
99
100
@MessagePattern ( { cmd : 'agent-create-connection-legacy-invitation' } )
100
101
async createLegacyConnectionInvitation ( payload : {
101
102
connectionPayload : IConnectionDetails ;
102
- url : string ,
103
- orgId : string ,
103
+ url : string ;
104
+ orgId : string ;
104
105
} ) : Promise < InvitationMessage > {
105
106
return this . agentServiceService . createLegacyConnectionInvitation (
106
107
payload . connectionPayload ,
@@ -112,58 +113,58 @@ export class AgentServiceController {
112
113
@MessagePattern ( { cmd : 'agent-send-credential-create-offer' } )
113
114
async sendCredentialCreateOffer ( payload : {
114
115
issueData : IIssuanceCreateOffer ;
115
- url : string ,
116
- orgId : string ,
116
+ url : string ;
117
+ orgId : string ;
117
118
} ) : Promise < object > {
118
119
return this . agentServiceService . sendCredentialCreateOffer ( payload . issueData , payload . url , payload . orgId ) ;
119
120
}
120
121
121
122
//DONE
122
123
@MessagePattern ( { cmd : 'agent-get-all-issued-credentials' } )
123
- async getIssueCredentials ( payload : { url : string , apiKey : string } ) : Promise < object > {
124
+ async getIssueCredentials ( payload : { url : string ; apiKey : string } ) : Promise < object > {
124
125
return this . agentServiceService . getIssueCredentials ( payload . url , payload . apiKey ) ;
125
126
}
126
127
127
128
//DONE
128
129
@MessagePattern ( { cmd : 'agent-get-issued-credentials-by-credentialDefinitionId' } )
129
- async getIssueCredentialsbyCredentialRecordId ( payload : { url : string , orgId : string } ) : Promise < object > {
130
+ async getIssueCredentialsbyCredentialRecordId ( payload : { url : string ; orgId : string } ) : Promise < object > {
130
131
return this . agentServiceService . getIssueCredentialsbyCredentialRecordId ( payload . url , payload . orgId ) ;
131
132
}
132
133
//DONE
133
134
@MessagePattern ( { cmd : 'agent-get-proof-presentations' } )
134
- async getProofPresentations ( payload : { url : string , apiKey : string } ) : Promise < object > {
135
+ async getProofPresentations ( payload : { url : string ; apiKey : string } ) : Promise < object > {
135
136
return this . agentServiceService . getProofPresentations ( payload . url , payload . apiKey ) ;
136
137
}
137
138
138
139
//DONE
139
140
@MessagePattern ( { cmd : 'agent-get-proof-presentation-by-id' } )
140
- async getProofPresentationById ( payload : { url : string , orgId : string } ) : Promise < object > {
141
+ async getProofPresentationById ( payload : { url : string ; orgId : string } ) : Promise < object > {
141
142
return this . agentServiceService . getProofPresentationById ( payload . url , payload . orgId ) ;
142
143
}
143
144
144
145
//DONE
145
146
@MessagePattern ( { cmd : 'agent-send-proof-request' } )
146
147
async sendProofRequest ( payload : {
147
- proofRequestPayload : ISendProofRequestPayload ,
148
- url : string ,
149
- orgId : string ,
148
+ proofRequestPayload : ISendProofRequestPayload ;
149
+ url : string ;
150
+ orgId : string ;
150
151
} ) : Promise < IAgentProofRequest > {
151
152
return this . agentServiceService . sendProofRequest ( payload . proofRequestPayload , payload . url , payload . orgId ) ;
152
153
}
153
154
//DONE
154
155
@MessagePattern ( { cmd : 'agent-verify-presentation' } )
155
- async verifyPresentation ( payload : { url : string , orgId : string } ) : Promise < object > {
156
+ async verifyPresentation ( payload : { url : string ; orgId : string } ) : Promise < object > {
156
157
return this . agentServiceService . verifyPresentation ( payload . url , payload . orgId ) ;
157
158
}
158
159
159
160
//DONE
160
161
@MessagePattern ( { cmd : 'agent-get-all-connections' } )
161
- async getConnections ( payload : { url : string , orgId : string } ) : Promise < object > {
162
+ async getConnections ( payload : { url : string ; orgId : string } ) : Promise < object > {
162
163
return this . agentServiceService . getConnections ( payload . url , payload . orgId ) ;
163
164
}
164
165
165
166
@MessagePattern ( { cmd : 'agent-get-connection-details-by-connectionId' } )
166
- async getConnectionsByconnectionId ( payload : { url : string , orgId : string } ) : Promise < object > {
167
+ async getConnectionsByconnectionId ( payload : { url : string ; orgId : string } ) : Promise < object > {
167
168
return this . agentServiceService . getConnectionsByconnectionId ( payload . url , payload . orgId ) ;
168
169
}
169
170
@@ -173,10 +174,30 @@ export class AgentServiceController {
173
174
* @returns Get agent health
174
175
*/
175
176
@MessagePattern ( { cmd : 'agent-health' } )
176
- async getAgentHealth ( payload : { user : user , orgId : string } ) : Promise < IAgentStatus > {
177
+ async getAgentHealth ( payload : { user : user ; orgId : string } ) : Promise < IAgentStatus > {
177
178
return this . agentServiceService . getAgentHealthDetails ( payload . orgId ) ;
178
179
}
179
180
181
+ /**
182
+ * Sign data from agent
183
+ * @param payload
184
+ * @returns Signed data by agent
185
+ */
186
+ @MessagePattern ( { cmd : 'sign-data-from-agent' } )
187
+ async signData ( payload : { data : SignDataDto ; orgId : string } ) : Promise < unknown > {
188
+ return this . agentServiceService . signDataFromAgent ( payload . data , payload . orgId ) ;
189
+ }
190
+
191
+ /**
192
+ * Get agent health
193
+ * @param payload
194
+ * @returns Get agent health
195
+ */
196
+ @MessagePattern ( { cmd : 'verify-signature-from-agent' } )
197
+ async verifysignature ( payload : { data : unknown ; orgId : string } ) : Promise < unknown > {
198
+ return this . agentServiceService . verifysignature ( payload . data , payload . orgId ) ;
199
+ }
200
+
180
201
@MessagePattern ( { cmd : 'get-ledger-config' } )
181
202
async getLedgerConfig ( payload : { user : IUserRequestInterface } ) : Promise < object > {
182
203
return this . agentServiceService . getLedgerConfigDetails ( payload . user ) ;
@@ -185,24 +206,24 @@ export class AgentServiceController {
185
206
//DONE
186
207
@MessagePattern ( { cmd : 'agent-send-out-of-band-proof-request' } )
187
208
async sendOutOfBandProofRequest ( payload : {
188
- proofRequestPayload : ISendProofRequestPayload ,
189
- url : string ,
190
- orgId : string ,
209
+ proofRequestPayload : ISendProofRequestPayload ;
210
+ url : string ;
211
+ orgId : string ;
191
212
} ) : Promise < object > {
192
213
return this . agentServiceService . sendOutOfBandProofRequest ( payload . proofRequestPayload , payload . url , payload . orgId ) ;
193
214
}
194
215
195
216
//DONE
196
217
@MessagePattern ( { cmd : 'get-agent-verified-proof-details' } )
197
- async getVerifiedProofDetails ( payload : { url : string , orgId : string } ) : Promise < object > {
218
+ async getVerifiedProofDetails ( payload : { url : string ; orgId : string } ) : Promise < object > {
198
219
return this . agentServiceService . getVerifiedProofDetails ( payload . url , payload . orgId ) ;
199
220
}
200
221
201
222
@MessagePattern ( { cmd : 'agent-schema-endorsement-request' } )
202
223
async schemaEndorsementRequest ( payload : {
203
- url : string ,
204
- orgId : string ,
205
- requestSchemaPayload : object ,
224
+ url : string ;
225
+ orgId : string ;
226
+ requestSchemaPayload : object ;
206
227
} ) : Promise < object > {
207
228
return this . agentServiceService . schemaEndorsementRequest ( payload . url , payload . orgId , payload . requestSchemaPayload ) ;
208
229
}
@@ -217,22 +238,22 @@ export class AgentServiceController {
217
238
218
239
//DONE
219
240
@MessagePattern ( { cmd : 'agent-sign-transaction' } )
220
- async signTransaction ( payload : { url : string , orgId : string , signEndorsementPayload : object } ) : Promise < object > {
241
+ async signTransaction ( payload : { url : string ; orgId : string ; signEndorsementPayload : object } ) : Promise < object > {
221
242
return this . agentServiceService . signTransaction ( payload . url , payload . orgId , payload . signEndorsementPayload ) ;
222
243
}
223
244
224
245
//DONE
225
246
@MessagePattern ( { cmd : 'agent-submit-transaction' } )
226
- async submitTransaction ( payload : { url : string ; orgId : string , submitEndorsementPayload : object } ) : Promise < object > {
247
+ async submitTransaction ( payload : { url : string ; orgId : string ; submitEndorsementPayload : object } ) : Promise < object > {
227
248
return this . agentServiceService . sumbitTransaction ( payload . url , payload . orgId , payload . submitEndorsementPayload ) ;
228
249
}
229
250
230
251
//DONE
231
252
@MessagePattern ( { cmd : 'agent-out-of-band-credential-offer' } )
232
253
async outOfBandCredentialOffer ( payload : {
233
- outOfBandIssuancePayload : IOutOfBandCredentialOffer ,
234
- url : string ,
235
- orgId : string ,
254
+ outOfBandIssuancePayload : IOutOfBandCredentialOffer ;
255
+ url : string ;
256
+ orgId : string ;
236
257
} ) : Promise < object > {
237
258
return this . agentServiceService . outOfBandCredentialOffer (
238
259
payload . outOfBandIssuancePayload ,
@@ -242,32 +263,32 @@ export class AgentServiceController {
242
263
}
243
264
244
265
@MessagePattern ( { cmd : 'delete-wallet' } )
245
- async deleteWallet ( payload : { orgId , user } ) : Promise < object > {
266
+ async deleteWallet ( payload : { orgId ; user } ) : Promise < object > {
246
267
return this . agentServiceService . deleteWallet ( payload . orgId , payload . user ) ;
247
268
}
248
269
249
270
@MessagePattern ( { cmd : 'agent-receive-invitation-url' } )
250
- async receiveInvitationUrl ( payload : { url , orgId , receiveInvitationUrl } ) : Promise < string > {
271
+ async receiveInvitationUrl ( payload : { url ; orgId ; receiveInvitationUrl } ) : Promise < string > {
251
272
return this . agentServiceService . receiveInvitationUrl ( payload . receiveInvitationUrl , payload . url , payload . orgId ) ;
252
273
}
253
274
254
275
@MessagePattern ( { cmd : 'agent-receive-invitation' } )
255
- async receiveInvitation ( payload : { url , orgId , receiveInvitation } ) : Promise < string > {
276
+ async receiveInvitation ( payload : { url ; orgId ; receiveInvitation } ) : Promise < string > {
256
277
return this . agentServiceService . receiveInvitation ( payload . receiveInvitation , payload . url , payload . orgId ) ;
257
278
}
258
279
259
280
@MessagePattern ( { cmd : 'agent-send-question' } )
260
- async sendQuestion ( payload : { url , orgId , questionPayload } ) : Promise < object > {
281
+ async sendQuestion ( payload : { url ; orgId ; questionPayload } ) : Promise < object > {
261
282
return this . agentServiceService . sendQuestion ( payload . questionPayload , payload . url , payload . orgId ) ;
262
283
}
263
284
264
285
@MessagePattern ( { cmd : 'agent-send-basic-message' } )
265
- async sendBasicMessage ( payload : { url , orgId , content } ) : Promise < object > {
286
+ async sendBasicMessage ( payload : { url ; orgId ; content } ) : Promise < object > {
266
287
return this . agentServiceService . sendBasicMessage ( payload . content , payload . url , payload . orgId ) ;
267
288
}
268
289
269
290
@MessagePattern ( { cmd : 'agent-get-question-answer-record' } )
270
- async getQuestionAnswersRecord ( payload : { url : string , orgId : string } ) : Promise < object > {
291
+ async getQuestionAnswersRecord ( payload : { url : string ; orgId : string } ) : Promise < object > {
271
292
return this . agentServiceService . getQuestionAnswersRecord ( payload . url , payload . orgId ) ;
272
293
}
273
294
@@ -278,9 +299,9 @@ export class AgentServiceController {
278
299
279
300
@MessagePattern ( { cmd : 'agent-create-connection-invitation' } )
280
301
async createConnectionInvitation ( payload : {
281
- url : string ,
282
- orgId : string ,
283
- connectionPayload : ICreateConnectionInvitation ,
302
+ url : string ;
303
+ orgId : string ;
304
+ connectionPayload : ICreateConnectionInvitation ;
284
305
} ) : Promise < object > {
285
306
return this . agentServiceService . createConnectionInvitation ( payload . url , payload . orgId , payload . connectionPayload ) ;
286
307
}
@@ -292,16 +313,14 @@ export class AgentServiceController {
292
313
*/
293
314
@MessagePattern ( { cmd : 'agent-configure' } )
294
315
async agentConfigure ( payload : {
295
- agentConfigureDto : IAgentConfigure ,
296
- user : IUserRequestInterface ,
316
+ agentConfigureDto : IAgentConfigure ;
317
+ user : IUserRequestInterface ;
297
318
} ) : Promise < IStoreAgent > {
298
319
return this . agentServiceService . agentConfigure ( payload . agentConfigureDto , payload . user ) ;
299
320
}
300
321
301
322
@MessagePattern ( { cmd : 'get-agent-details-by-org-id' } )
302
- async agentdetailsByOrgId ( payload : {
303
- orgId : string ,
304
- } ) : Promise < IStoreAgent > {
323
+ async agentdetailsByOrgId ( payload : { orgId : string } ) : Promise < IStoreAgent > {
305
324
return this . agentServiceService . getAgentDetails ( payload . orgId ) ;
306
325
}
307
- }
326
+ }
0 commit comments