react-native-mfa-trustbuilder 0.1.0
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.
- package/LICENSE +20 -0
- package/README.md +202 -0
- package/Trustbuilder.podspec +29 -0
- package/android/build.gradle +74 -0
- package/android/libs/iwlib-mac-0.2.17.jar +0 -0
- package/android/proguard-rules.pro +2 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/trustbuilder/SimpleWebServiceCall.kt +40 -0
- package/android/src/main/java/com/trustbuilder/TrustbuilderModule.kt +590 -0
- package/android/src/main/java/com/trustbuilder/TrustbuilderPackage.kt +32 -0
- package/ios/RNTrustbuilder.h +5 -0
- package/ios/RNTrustbuilder.mm +433 -0
- package/ios/iw.h +785 -0
- package/ios/libs/libmaccess-0.2.19-ios-arm64_armv7.a +0 -0
- package/ios/libs/libmaccess-0.2.19-ios-arm64_i386_x86_64-simulator.a +0 -0
- package/lib/module/NativeRNTrustbuilder.js +5 -0
- package/lib/module/NativeRNTrustbuilder.js.map +1 -0
- package/lib/module/errors.js +64 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/index.js +309 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeRNTrustbuilder.d.ts +89 -0
- package/lib/typescript/src/NativeRNTrustbuilder.d.ts.map +1 -0
- package/lib/typescript/src/errors.d.ts +29 -0
- package/lib/typescript/src/errors.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +68 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +45 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/package.json +184 -0
- package/src/NativeRNTrustbuilder.ts +117 -0
- package/src/errors.ts +72 -0
- package/src/index.ts +461 -0
- package/src/types.ts +54 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
|
|
2
|
+
import type { Spec } from './NativeRNTrustbuilder';
|
|
3
|
+
import { TrustbuilderError, TrustbuilderErrorCode, assertOk } from './errors';
|
|
4
|
+
import type {
|
|
5
|
+
InitConfig,
|
|
6
|
+
InitResult,
|
|
7
|
+
ServiceInfo,
|
|
8
|
+
PushInfo,
|
|
9
|
+
OtpResult,
|
|
10
|
+
SealResult,
|
|
11
|
+
VersionInfo,
|
|
12
|
+
PinMode,
|
|
13
|
+
PinModeResult,
|
|
14
|
+
KeyType,
|
|
15
|
+
PushAction,
|
|
16
|
+
} from './types';
|
|
17
|
+
|
|
18
|
+
const LINKING_ERROR =
|
|
19
|
+
`The package 'react-native-mfa-trustbuilder' doesn't seem to be linked. Make sure: \n\n` +
|
|
20
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
21
|
+
'- You rebuilt the app after installing the package\n' +
|
|
22
|
+
'- You are not using Expo managed workflow\n';
|
|
23
|
+
|
|
24
|
+
const RNTrustbuilder = (
|
|
25
|
+
NativeModules.RNTrustbuilder
|
|
26
|
+
? NativeModules.RNTrustbuilder
|
|
27
|
+
: new Proxy(
|
|
28
|
+
{},
|
|
29
|
+
{
|
|
30
|
+
get() {
|
|
31
|
+
throw new Error(LINKING_ERROR);
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
) as Spec;
|
|
36
|
+
|
|
37
|
+
const EVENT_NAME = 'TrustbuilderPushEvent';
|
|
38
|
+
|
|
39
|
+
function pinModeFromCode(code: number): PinMode {
|
|
40
|
+
switch (code) {
|
|
41
|
+
case 0:
|
|
42
|
+
return 'none';
|
|
43
|
+
case 1:
|
|
44
|
+
return 'current';
|
|
45
|
+
case 2:
|
|
46
|
+
return 'new';
|
|
47
|
+
case 8:
|
|
48
|
+
return 'bio';
|
|
49
|
+
case 9:
|
|
50
|
+
return 'currentOrBio';
|
|
51
|
+
default:
|
|
52
|
+
return 'none';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function pinModeToResult(code: number): PinModeResult {
|
|
57
|
+
return {
|
|
58
|
+
pinMode: pinModeFromCode(code),
|
|
59
|
+
// eslint-disable-next-line no-bitwise
|
|
60
|
+
requiresPin: (code & 1) === 1,
|
|
61
|
+
// eslint-disable-next-line no-bitwise
|
|
62
|
+
requiresBio: (code & 8) === 8,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function keyTypeToNumber(keyType: KeyType): number {
|
|
67
|
+
return keyType === 'biokey' ? 1 : 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
class Trustbuilder {
|
|
71
|
+
private _initialized = false;
|
|
72
|
+
private _eventEmitter: NativeEventEmitter | null = null;
|
|
73
|
+
|
|
74
|
+
get isInitialized(): boolean {
|
|
75
|
+
return this._initialized;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
initialize(config: InitConfig): InitResult {
|
|
79
|
+
const configStr = JSON.stringify({
|
|
80
|
+
macId: config.macId,
|
|
81
|
+
server: config.server || 'https://www.myinwebo.com',
|
|
82
|
+
hostVersion: config.hostVersion || 'react-native-mfa-trustbuilder-0.1.0',
|
|
83
|
+
timeout: config.timeout || 60000,
|
|
84
|
+
lang: config.lang === 'fr' ? '2' : '1',
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const resultStr = RNTrustbuilder.initialize(configStr);
|
|
88
|
+
const result = JSON.parse(resultStr) as InitResult;
|
|
89
|
+
this._initialized = true;
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
setStorageData(data: string): void {
|
|
94
|
+
RNTrustbuilder.setStorageData(data);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
getStorageData(): string {
|
|
98
|
+
return RNTrustbuilder.getStorageData();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
storageDataChanged(): boolean {
|
|
102
|
+
return RNTrustbuilder.storageDataChanged();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
saveStorageIfNeeded(): void {
|
|
106
|
+
if (this.storageDataChanged()) {
|
|
107
|
+
const data = this.getStorageData();
|
|
108
|
+
this.setStorageData(data);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
isActivated(): boolean {
|
|
113
|
+
return RNTrustbuilder.isActivated();
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
isBlocked(): boolean {
|
|
117
|
+
return RNTrustbuilder.isBlocked();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
mustUpgrade(): boolean {
|
|
121
|
+
return RNTrustbuilder.mustUpgrade();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async activationStart(code: string): Promise<void> {
|
|
125
|
+
const result = parseInt(RNTrustbuilder.activationStart(code), 10);
|
|
126
|
+
assertOk(result);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async activationFinalize(
|
|
130
|
+
code: string,
|
|
131
|
+
pin: string,
|
|
132
|
+
name: string
|
|
133
|
+
): Promise<void> {
|
|
134
|
+
const result = parseInt(
|
|
135
|
+
RNTrustbuilder.activationFinalize(code, pin, name),
|
|
136
|
+
10
|
|
137
|
+
);
|
|
138
|
+
assertOk(result);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async activate(code: string, pin: string, name: string): Promise<void> {
|
|
142
|
+
await this.activationStart(code);
|
|
143
|
+
await this.activationFinalize(code, pin, name);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async resetStart(code: string): Promise<void> {
|
|
147
|
+
const result = parseInt(RNTrustbuilder.resetStart(code), 10);
|
|
148
|
+
assertOk(result);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async resetFinalize(code: string, pin: string): Promise<void> {
|
|
152
|
+
const result = parseInt(RNTrustbuilder.resetFinalize(code, pin), 10);
|
|
153
|
+
assertOk(result);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async reset(code: string, pin: string): Promise<void> {
|
|
157
|
+
await this.resetStart(code);
|
|
158
|
+
await this.resetFinalize(code, pin);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async synchronizeStart(): Promise<void> {
|
|
162
|
+
const result = parseInt(RNTrustbuilder.synchronizeStart(), 10);
|
|
163
|
+
assertOk(result);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async synchronizeFinalize(pin: string): Promise<void> {
|
|
167
|
+
const result = parseInt(RNTrustbuilder.synchronizeFinalize(pin), 10);
|
|
168
|
+
assertOk(result);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async synchronize(pin: string): Promise<void> {
|
|
172
|
+
await this.synchronizeStart();
|
|
173
|
+
await this.synchronizeFinalize(pin);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
async pwdUpdateStart(): Promise<void> {
|
|
177
|
+
const result = parseInt(RNTrustbuilder.pwdUpdateStart(), 10);
|
|
178
|
+
assertOk(result);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async pwdUpdateFinalize(newPin: string, currentPin: string): Promise<void> {
|
|
182
|
+
const result = parseInt(
|
|
183
|
+
RNTrustbuilder.pwdUpdateFinalize(newPin, currentPin),
|
|
184
|
+
10
|
|
185
|
+
);
|
|
186
|
+
assertOk(result);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async updatePin(newPin: string, currentPin: string): Promise<void> {
|
|
190
|
+
await this.pwdUpdateStart();
|
|
191
|
+
await this.pwdUpdateFinalize(newPin, currentPin);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async setBiokeyStart(): Promise<void> {
|
|
195
|
+
const result = parseInt(RNTrustbuilder.setBiokeyStart(), 10);
|
|
196
|
+
assertOk(result);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async setBiokeyFinalize(biokey: string, pin: string): Promise<void> {
|
|
200
|
+
const result = parseInt(RNTrustbuilder.setBiokeyFinalize(biokey, pin), 10);
|
|
201
|
+
assertOk(result);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async registerBiokey(biokey: string, pin: string): Promise<void> {
|
|
205
|
+
await this.setBiokeyStart();
|
|
206
|
+
await this.setBiokeyFinalize(biokey, pin);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async unsetBiokeysStart(): Promise<void> {
|
|
210
|
+
const result = parseInt(RNTrustbuilder.unsetBiokeysStart(), 10);
|
|
211
|
+
assertOk(result);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
async unsetBiokeysFinalize(pin: string): Promise<void> {
|
|
215
|
+
const result = parseInt(RNTrustbuilder.unsetBiokeysFinalize(pin), 10);
|
|
216
|
+
assertOk(result);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
async resetBiokeys(pin: string): Promise<void> {
|
|
220
|
+
await this.unsetBiokeysStart();
|
|
221
|
+
await this.unsetBiokeysFinalize(pin);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
async onlineOtpStart(serviceIndex = 0): Promise<void> {
|
|
225
|
+
const result = parseInt(RNTrustbuilder.onlineOtpStart(serviceIndex), 10);
|
|
226
|
+
assertOk(result);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
async onlineOtpFinalize(
|
|
230
|
+
serviceIndex: number,
|
|
231
|
+
pin: string,
|
|
232
|
+
keyType: KeyType = 'pin'
|
|
233
|
+
): Promise<void> {
|
|
234
|
+
const result = parseInt(
|
|
235
|
+
RNTrustbuilder.onlineOtpFinalize(
|
|
236
|
+
serviceIndex,
|
|
237
|
+
pin,
|
|
238
|
+
keyTypeToNumber(keyType)
|
|
239
|
+
),
|
|
240
|
+
10
|
|
241
|
+
);
|
|
242
|
+
assertOk(result);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
getOtp(): string {
|
|
246
|
+
return RNTrustbuilder.otpAnswerOtp();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
async generateOnlineOtp(
|
|
250
|
+
pin: string,
|
|
251
|
+
serviceIndex = 0,
|
|
252
|
+
keyType: KeyType = 'pin'
|
|
253
|
+
): Promise<OtpResult> {
|
|
254
|
+
await this.onlineOtpStart(serviceIndex);
|
|
255
|
+
await this.onlineOtpFinalize(serviceIndex, pin, keyType);
|
|
256
|
+
const otp = this.getOtp();
|
|
257
|
+
const remainingTime = this.displayTime();
|
|
258
|
+
return { otp, remainingTime };
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
otpShouldSynchronize(serviceId = 0): boolean {
|
|
262
|
+
return RNTrustbuilder.otpShouldSynchronize(serviceId);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
otpModeQuery(serviceId = 0): boolean {
|
|
266
|
+
return RNTrustbuilder.otpModeQuery(serviceId);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
otpGenerate(pin: string): string {
|
|
270
|
+
return RNTrustbuilder.otpGenerate(pin);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
displayTime(): number {
|
|
274
|
+
return RNTrustbuilder.displayTime();
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
async generateOfflineOtp(pin: string, serviceId = 0): Promise<OtpResult> {
|
|
278
|
+
if (this.otpShouldSynchronize(serviceId)) {
|
|
279
|
+
throw new TrustbuilderError(
|
|
280
|
+
TrustbuilderErrorCode.SYNCHROFAILED,
|
|
281
|
+
'Synchronization required before offline OTP generation'
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
const requiresPin = this.otpModeQuery(serviceId);
|
|
285
|
+
const otp = this.otpGenerate(requiresPin ? pin : '');
|
|
286
|
+
const remainingTime = this.displayTime();
|
|
287
|
+
return { otp, remainingTime };
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
setDeviceOS(deviceOS: string): void {
|
|
291
|
+
RNTrustbuilder.setDeviceOS(deviceOS);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async pushRegistrationStart(): Promise<void> {
|
|
295
|
+
const result = parseInt(RNTrustbuilder.pushRegistrationStart(), 10);
|
|
296
|
+
assertOk(result);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
async pushRegistrationFinalize(pushId: string): Promise<void> {
|
|
300
|
+
const result = parseInt(
|
|
301
|
+
RNTrustbuilder.pushRegistrationFinalize(pushId),
|
|
302
|
+
10
|
|
303
|
+
);
|
|
304
|
+
assertOk(result);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
async registerForPush(pushId: string): Promise<void> {
|
|
308
|
+
await this.pushRegistrationStart();
|
|
309
|
+
await this.pushRegistrationFinalize(pushId);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
checkPush(): number {
|
|
313
|
+
return parseInt(RNTrustbuilder.checkPush(), 10);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
getPushInfo(): PushInfo | null {
|
|
317
|
+
const code = this.checkPush();
|
|
318
|
+
if (code === 0) {
|
|
319
|
+
return {
|
|
320
|
+
alias: RNTrustbuilder.pushAlias(),
|
|
321
|
+
action: RNTrustbuilder.pushAction() as PushAction,
|
|
322
|
+
context: RNTrustbuilder.pushContext(),
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
async onlineSealStart(serviceIndex = 0): Promise<void> {
|
|
329
|
+
const result = parseInt(RNTrustbuilder.onlineSealStart(serviceIndex), 10);
|
|
330
|
+
assertOk(result);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
async onlineSealFinalize(
|
|
334
|
+
serviceIndex: number,
|
|
335
|
+
pin: string,
|
|
336
|
+
keyType: KeyType,
|
|
337
|
+
sealData: string
|
|
338
|
+
): Promise<void> {
|
|
339
|
+
const result = parseInt(
|
|
340
|
+
RNTrustbuilder.onlineSealFinalize(
|
|
341
|
+
serviceIndex,
|
|
342
|
+
pin,
|
|
343
|
+
keyTypeToNumber(keyType),
|
|
344
|
+
sealData
|
|
345
|
+
),
|
|
346
|
+
10
|
|
347
|
+
);
|
|
348
|
+
assertOk(result);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
getSeal(): string {
|
|
352
|
+
return RNTrustbuilder.sealAnswerOtp();
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
async generateOnlineSeal(
|
|
356
|
+
pin: string,
|
|
357
|
+
sealData: string,
|
|
358
|
+
serviceIndex = 0,
|
|
359
|
+
keyType: KeyType = 'pin'
|
|
360
|
+
): Promise<SealResult> {
|
|
361
|
+
await this.onlineSealStart(serviceIndex);
|
|
362
|
+
await this.onlineSealFinalize(serviceIndex, pin, keyType, sealData);
|
|
363
|
+
return { seal: this.getSeal() };
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
sealShouldSynchronize(serviceId = 0): boolean {
|
|
367
|
+
return RNTrustbuilder.sealShouldSynchronize(serviceId);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
sealModeQuery(serviceId = 0): boolean {
|
|
371
|
+
return RNTrustbuilder.sealModeQuery(serviceId);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
sealGenerate(pin: string, sealData: string): string {
|
|
375
|
+
return RNTrustbuilder.sealGenerate(pin, sealData);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
async generateOfflineSeal(
|
|
379
|
+
pin: string,
|
|
380
|
+
sealData: string,
|
|
381
|
+
serviceId = 0
|
|
382
|
+
): Promise<SealResult> {
|
|
383
|
+
if (this.sealShouldSynchronize(serviceId)) {
|
|
384
|
+
throw new TrustbuilderError(
|
|
385
|
+
TrustbuilderErrorCode.SYNCHROFAILED,
|
|
386
|
+
'Synchronization required before offline seal generation'
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
this.sealModeQuery(serviceId);
|
|
390
|
+
return { seal: this.sealGenerate(pin, sealData) };
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
serviceNb(): number {
|
|
394
|
+
return RNTrustbuilder.serviceNb();
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
getServiceName(index = 0): string {
|
|
398
|
+
return RNTrustbuilder.serviceName(index);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
getServiceLogo(index = 0): string {
|
|
402
|
+
return RNTrustbuilder.serviceLogo(index);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
isServiceDisabled(index = 0): boolean {
|
|
406
|
+
return RNTrustbuilder.serviceDisabled(index);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
getServiceInfo(index = 0): ServiceInfo {
|
|
410
|
+
return {
|
|
411
|
+
name: this.getServiceName(index),
|
|
412
|
+
logoUrl: this.getServiceLogo(index),
|
|
413
|
+
isDisabled: this.isServiceDisabled(index),
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
getVersionInfo(): VersionInfo {
|
|
418
|
+
const resultStr = RNTrustbuilder.getVersionInfo();
|
|
419
|
+
return JSON.parse(resultStr) as VersionInfo;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
getPinMode(): PinModeResult {
|
|
423
|
+
const code = parseInt(RNTrustbuilder.serviceName(0), 10);
|
|
424
|
+
return pinModeToResult(code);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
private _setupEventEmitter(): void {
|
|
428
|
+
if (this._eventEmitter) return;
|
|
429
|
+
this._eventEmitter = new NativeEventEmitter(
|
|
430
|
+
NativeModules.RNTrustbuilder as any
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
onPushReceived(listener: (pushInfo: PushInfo) => void): () => void {
|
|
435
|
+
this._setupEventEmitter();
|
|
436
|
+
const subscription = this._eventEmitter!.addListener(
|
|
437
|
+
EVENT_NAME,
|
|
438
|
+
(data: PushInfo) => {
|
|
439
|
+
listener(data);
|
|
440
|
+
}
|
|
441
|
+
);
|
|
442
|
+
return () => subscription.remove();
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
export const trustbuilder = new Trustbuilder();
|
|
447
|
+
|
|
448
|
+
export { TrustbuilderError, TrustbuilderErrorCode } from './errors';
|
|
449
|
+
export type {
|
|
450
|
+
InitConfig,
|
|
451
|
+
InitResult,
|
|
452
|
+
ServiceInfo,
|
|
453
|
+
PushInfo,
|
|
454
|
+
OtpResult,
|
|
455
|
+
SealResult,
|
|
456
|
+
VersionInfo,
|
|
457
|
+
PinMode,
|
|
458
|
+
PinModeResult,
|
|
459
|
+
KeyType,
|
|
460
|
+
PushAction,
|
|
461
|
+
} from './types';
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type PinMode = 'none' | 'current' | 'new' | 'bio' | 'currentOrBio';
|
|
2
|
+
|
|
3
|
+
export type PushAction = 'authenticate' | 'activate';
|
|
4
|
+
|
|
5
|
+
export type KeyType = 'pin' | 'biokey';
|
|
6
|
+
|
|
7
|
+
export interface InitConfig {
|
|
8
|
+
macId: string;
|
|
9
|
+
server?: string;
|
|
10
|
+
hostVersion?: string;
|
|
11
|
+
timeout?: number;
|
|
12
|
+
lang?: 'en' | 'fr';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface InitResult {
|
|
16
|
+
isActivated: boolean;
|
|
17
|
+
isBlocked: boolean;
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ServiceInfo {
|
|
22
|
+
name: string;
|
|
23
|
+
logoUrl: string;
|
|
24
|
+
isDisabled: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface PushInfo {
|
|
28
|
+
alias: string;
|
|
29
|
+
action: PushAction;
|
|
30
|
+
context: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface OtpResult {
|
|
34
|
+
otp: string;
|
|
35
|
+
remainingTime: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface SealResult {
|
|
39
|
+
seal: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface VersionInfo {
|
|
43
|
+
libraryVersion: string;
|
|
44
|
+
newVersionAvailable: string;
|
|
45
|
+
newVersionUrl: string;
|
|
46
|
+
majorVersionRequired: boolean;
|
|
47
|
+
shouldAskForMinorUpdate: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface PinModeResult {
|
|
51
|
+
pinMode: PinMode;
|
|
52
|
+
requiresPin: boolean;
|
|
53
|
+
requiresBio: boolean;
|
|
54
|
+
}
|