@@ -4,13 +4,16 @@ import { AnchorService } from './anchor/service/anchor.service'
4
4
import { NetworkConfiguration } from './config/entity/configuration.entity'
5
5
import Network from './config/entity/networks.entity'
6
6
import { ConfigService } from './config/service/config.service'
7
+ import { EncryptData } from './encryption/entity/encrypt_data'
8
+ import { EncryptionService } from './encryption/service/encryption.service'
7
9
import { HttpClient } from './infrastructure/http.client'
8
10
import { Proof } from './proof/entity/proof.entity'
9
11
import { ProofService } from './proof/service/proof.service'
10
12
import { RecordReceipt } from './record/entity/record-receipt.entity'
11
13
import { Record } from './record/entity/record.entity'
12
14
import { RecordService } from './record/service/record.service'
13
15
import { DependencyInjection } from './shared/dependency-injection'
16
+ import { TypedArray } from './shared/utils'
14
17
15
18
/**
16
19
* Entrypoint to the Bloock SDK:
@@ -28,6 +31,8 @@ export class BloockClient {
28
31
29
32
private httpClient : HttpClient
30
33
34
+ private encryptionService : EncryptionService
35
+
31
36
/**
32
37
* Constructor with API Key that enables accessing to Bloock's functionalities.
33
38
* @param {string } apiKey Client API Key.
@@ -40,6 +45,7 @@ export class BloockClient {
40
45
this . configService = container . resolve < ConfigService > ( 'ConfigService' )
41
46
this . recordService = container . resolve < RecordService > ( 'RecordService' )
42
47
this . proofService = container . resolve < ProofService > ( 'ProofService' )
48
+ this . encryptionService = container . resolve < EncryptionService > ( 'EncryptionService' )
43
49
44
50
this . httpClient = container . resolve < HttpClient > ( 'HttpClient' )
45
51
@@ -159,4 +165,16 @@ export class BloockClient {
159
165
public async verifySignatures ( records : Record [ ] ) : Promise < boolean > {
160
166
return this . proofService . verifySignatures ( records )
161
167
}
168
+
169
+ public async generateSecretKey ( ) : Promise < string > {
170
+ return this . encryptionService . generateSecretKey ( )
171
+ }
172
+
173
+ public async encryptData ( data : TypedArray , secret : string ) : Promise < EncryptData > {
174
+ return this . encryptionService . encrypt ( data , secret )
175
+ }
176
+
177
+ public async decryptData ( encrypt_data : EncryptData , secret : string ) : Promise < TypedArray > {
178
+ return this . encryptionService . decrypt ( encrypt_data , secret )
179
+ }
162
180
}
0 commit comments