@zyphe-sdk/core 0.1.13 → 0.1.15
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/dist/index.d.ts +432 -811
- package/dist/index.js +1072 -12
- package/dist/index.js.map +1 -1
- package/dist/openapi.d.ts +139 -2
- package/dist/openapi.json +209 -4
- package/package.json +22 -11
- package/.turbo/turbo-build.log +0 -17
- package/dist/index.cjs +0 -181
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -1685
- package/docs/express.md +0 -45
- package/docs/fastify.md +0 -85
- package/docs/hono.md +0 -32
- package/public/openapi.d.ts +0 -959
- package/public/openapi.json +0 -3094
- package/scripts/generate-openapi.ts +0 -70
- package/src/client.ts +0 -10
- package/src/constants.ts +0 -29
- package/src/index.ts +0 -4
- package/src/types.ts +0 -82
- package/src/verification-session.ts +0 -94
- package/src/webhook.ts +0 -104
- package/tsconfig.json +0 -32
- package/tsup.config.ts +0 -11
package/dist/index.js
CHANGED
|
@@ -23,8 +23,9 @@ var API_KEY_HEADER = "x-api-key";
|
|
|
23
23
|
// src/client.ts
|
|
24
24
|
import createClient from "openapi-fetch";
|
|
25
25
|
var zypheApiClient = (opts) => {
|
|
26
|
+
const environment = opts.environment ?? Environments.PRODUCTION;
|
|
26
27
|
return createClient({
|
|
27
|
-
baseUrl: EnvironmentConfigs[
|
|
28
|
+
baseUrl: EnvironmentConfigs[environment].apiUrl
|
|
28
29
|
});
|
|
29
30
|
};
|
|
30
31
|
|
|
@@ -52,17 +53,8 @@ function createVerificationSession({
|
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
|
-
function getFlowUrlOrigin(environment) {
|
|
56
|
-
|
|
57
|
-
case Environments.LOCAL:
|
|
58
|
-
return EnvironmentConfigs[Environments.LOCAL].appUrl;
|
|
59
|
-
case Environments.STAGING:
|
|
60
|
-
return EnvironmentConfigs[Environments.STAGING].appUrl;
|
|
61
|
-
case Environments.PRODUCTION:
|
|
62
|
-
return EnvironmentConfigs[Environments.PRODUCTION].appUrl;
|
|
63
|
-
default:
|
|
64
|
-
throw new Error(`Invalid environment: ${environment}`);
|
|
65
|
-
}
|
|
56
|
+
function getFlowUrlOrigin(environment = Environments.PRODUCTION) {
|
|
57
|
+
return EnvironmentConfigs[environment].appUrl;
|
|
66
58
|
}
|
|
67
59
|
function constructVerificationSessionUrl({
|
|
68
60
|
flowParams,
|
|
@@ -91,6 +83,1072 @@ function constructVerificationSessionUrl({
|
|
|
91
83
|
return baseUrl;
|
|
92
84
|
}
|
|
93
85
|
|
|
86
|
+
// src/utils/guards.ts
|
|
87
|
+
var ApiKeyTypes = {
|
|
88
|
+
PUBLISHABLE: "zyphe_pk_",
|
|
89
|
+
SECRET: "zyphe_sk_"
|
|
90
|
+
};
|
|
91
|
+
function ensureApiKeyType(apiKey, types) {
|
|
92
|
+
if (!types.some((type) => apiKey.startsWith(ApiKeyTypes[type]))) {
|
|
93
|
+
throw new Error(
|
|
94
|
+
`Invalid API key. This function is only available for ${types.join(
|
|
95
|
+
", "
|
|
96
|
+
)} keys`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/gen/dv_result.ts
|
|
102
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
103
|
+
function imageProvenanceFromJSON(object) {
|
|
104
|
+
switch (object) {
|
|
105
|
+
case 0:
|
|
106
|
+
case "UNSPECIFIED_IMAGE_PROVENANCE":
|
|
107
|
+
return 0 /* UNSPECIFIED_IMAGE_PROVENANCE */;
|
|
108
|
+
case 1:
|
|
109
|
+
case "FRONT_DOCUMENT_IMAGE":
|
|
110
|
+
return 1 /* FRONT_DOCUMENT_IMAGE */;
|
|
111
|
+
case 2:
|
|
112
|
+
case "BACK_DOCUMENT_IMAGE":
|
|
113
|
+
return 2 /* BACK_DOCUMENT_IMAGE */;
|
|
114
|
+
case 3:
|
|
115
|
+
case "SIGNATURE_IMAGE":
|
|
116
|
+
return 3 /* SIGNATURE_IMAGE */;
|
|
117
|
+
case 5:
|
|
118
|
+
case "PORTRAIT_IMAGE":
|
|
119
|
+
return 5 /* PORTRAIT_IMAGE */;
|
|
120
|
+
case 6:
|
|
121
|
+
case "CITIZENSHIP_IMAGE":
|
|
122
|
+
return 6 /* CITIZENSHIP_IMAGE */;
|
|
123
|
+
case -1:
|
|
124
|
+
case "UNRECOGNIZED":
|
|
125
|
+
default:
|
|
126
|
+
return -1 /* UNRECOGNIZED */;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function imageProvenanceToJSON(object) {
|
|
130
|
+
switch (object) {
|
|
131
|
+
case 0 /* UNSPECIFIED_IMAGE_PROVENANCE */:
|
|
132
|
+
return "UNSPECIFIED_IMAGE_PROVENANCE";
|
|
133
|
+
case 1 /* FRONT_DOCUMENT_IMAGE */:
|
|
134
|
+
return "FRONT_DOCUMENT_IMAGE";
|
|
135
|
+
case 2 /* BACK_DOCUMENT_IMAGE */:
|
|
136
|
+
return "BACK_DOCUMENT_IMAGE";
|
|
137
|
+
case 3 /* SIGNATURE_IMAGE */:
|
|
138
|
+
return "SIGNATURE_IMAGE";
|
|
139
|
+
case 5 /* PORTRAIT_IMAGE */:
|
|
140
|
+
return "PORTRAIT_IMAGE";
|
|
141
|
+
case 6 /* CITIZENSHIP_IMAGE */:
|
|
142
|
+
return "CITIZENSHIP_IMAGE";
|
|
143
|
+
case -1 /* UNRECOGNIZED */:
|
|
144
|
+
default:
|
|
145
|
+
return "UNRECOGNIZED";
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function resultStatusFromJSON(object) {
|
|
149
|
+
switch (object) {
|
|
150
|
+
case 0:
|
|
151
|
+
case "FAILED":
|
|
152
|
+
return 0 /* FAILED */;
|
|
153
|
+
case 1:
|
|
154
|
+
case "PASSED":
|
|
155
|
+
return 1 /* PASSED */;
|
|
156
|
+
case -1:
|
|
157
|
+
case "UNRECOGNIZED":
|
|
158
|
+
default:
|
|
159
|
+
return -1 /* UNRECOGNIZED */;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function resultStatusToJSON(object) {
|
|
163
|
+
switch (object) {
|
|
164
|
+
case 0 /* FAILED */:
|
|
165
|
+
return "FAILED";
|
|
166
|
+
case 1 /* PASSED */:
|
|
167
|
+
return "PASSED";
|
|
168
|
+
case -1 /* UNRECOGNIZED */:
|
|
169
|
+
default:
|
|
170
|
+
return "UNRECOGNIZED";
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function createBasePersonalData() {
|
|
174
|
+
return {
|
|
175
|
+
givenName: "",
|
|
176
|
+
surname: "",
|
|
177
|
+
dateOfBirth: "",
|
|
178
|
+
nationality: "",
|
|
179
|
+
gender: "",
|
|
180
|
+
placeOfBirth: "",
|
|
181
|
+
personalNumber: ""
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
var PersonalData = {
|
|
185
|
+
encode(message, writer = new BinaryWriter()) {
|
|
186
|
+
if (message.givenName !== "") {
|
|
187
|
+
writer.uint32(10).string(message.givenName);
|
|
188
|
+
}
|
|
189
|
+
if (message.surname !== "") {
|
|
190
|
+
writer.uint32(18).string(message.surname);
|
|
191
|
+
}
|
|
192
|
+
if (message.dateOfBirth !== "") {
|
|
193
|
+
writer.uint32(26).string(message.dateOfBirth);
|
|
194
|
+
}
|
|
195
|
+
if (message.nationality !== "") {
|
|
196
|
+
writer.uint32(34).string(message.nationality);
|
|
197
|
+
}
|
|
198
|
+
if (message.gender !== "") {
|
|
199
|
+
writer.uint32(42).string(message.gender);
|
|
200
|
+
}
|
|
201
|
+
if (message.placeOfBirth !== "") {
|
|
202
|
+
writer.uint32(50).string(message.placeOfBirth);
|
|
203
|
+
}
|
|
204
|
+
if (message.personalNumber !== "") {
|
|
205
|
+
writer.uint32(58).string(message.personalNumber);
|
|
206
|
+
}
|
|
207
|
+
return writer;
|
|
208
|
+
},
|
|
209
|
+
decode(input, length) {
|
|
210
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
211
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
212
|
+
const message = createBasePersonalData();
|
|
213
|
+
while (reader.pos < end) {
|
|
214
|
+
const tag = reader.uint32();
|
|
215
|
+
switch (tag >>> 3) {
|
|
216
|
+
case 1: {
|
|
217
|
+
if (tag !== 10) {
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
message.givenName = reader.string();
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
case 2: {
|
|
224
|
+
if (tag !== 18) {
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
message.surname = reader.string();
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
case 3: {
|
|
231
|
+
if (tag !== 26) {
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
message.dateOfBirth = reader.string();
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
case 4: {
|
|
238
|
+
if (tag !== 34) {
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
message.nationality = reader.string();
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
case 5: {
|
|
245
|
+
if (tag !== 42) {
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
message.gender = reader.string();
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
case 6: {
|
|
252
|
+
if (tag !== 50) {
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
message.placeOfBirth = reader.string();
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
case 7: {
|
|
259
|
+
if (tag !== 58) {
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
message.personalNumber = reader.string();
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
reader.skip(tag & 7);
|
|
270
|
+
}
|
|
271
|
+
return message;
|
|
272
|
+
},
|
|
273
|
+
fromJSON(object) {
|
|
274
|
+
return {
|
|
275
|
+
givenName: isSet(object.givenName) ? globalThis.String(object.givenName) : "",
|
|
276
|
+
surname: isSet(object.surname) ? globalThis.String(object.surname) : "",
|
|
277
|
+
dateOfBirth: isSet(object.dateOfBirth) ? globalThis.String(object.dateOfBirth) : "",
|
|
278
|
+
nationality: isSet(object.nationality) ? globalThis.String(object.nationality) : "",
|
|
279
|
+
gender: isSet(object.gender) ? globalThis.String(object.gender) : "",
|
|
280
|
+
placeOfBirth: isSet(object.placeOfBirth) ? globalThis.String(object.placeOfBirth) : "",
|
|
281
|
+
personalNumber: isSet(object.personalNumber) ? globalThis.String(object.personalNumber) : ""
|
|
282
|
+
};
|
|
283
|
+
},
|
|
284
|
+
toJSON(message) {
|
|
285
|
+
const obj = {};
|
|
286
|
+
if (message.givenName !== "") {
|
|
287
|
+
obj.givenName = message.givenName;
|
|
288
|
+
}
|
|
289
|
+
if (message.surname !== "") {
|
|
290
|
+
obj.surname = message.surname;
|
|
291
|
+
}
|
|
292
|
+
if (message.dateOfBirth !== "") {
|
|
293
|
+
obj.dateOfBirth = message.dateOfBirth;
|
|
294
|
+
}
|
|
295
|
+
if (message.nationality !== "") {
|
|
296
|
+
obj.nationality = message.nationality;
|
|
297
|
+
}
|
|
298
|
+
if (message.gender !== "") {
|
|
299
|
+
obj.gender = message.gender;
|
|
300
|
+
}
|
|
301
|
+
if (message.placeOfBirth !== "") {
|
|
302
|
+
obj.placeOfBirth = message.placeOfBirth;
|
|
303
|
+
}
|
|
304
|
+
if (message.personalNumber !== "") {
|
|
305
|
+
obj.personalNumber = message.personalNumber;
|
|
306
|
+
}
|
|
307
|
+
return obj;
|
|
308
|
+
},
|
|
309
|
+
create(base) {
|
|
310
|
+
return PersonalData.fromPartial(base ?? {});
|
|
311
|
+
},
|
|
312
|
+
fromPartial(object) {
|
|
313
|
+
const message = createBasePersonalData();
|
|
314
|
+
message.givenName = object.givenName ?? "";
|
|
315
|
+
message.surname = object.surname ?? "";
|
|
316
|
+
message.dateOfBirth = object.dateOfBirth ?? "";
|
|
317
|
+
message.nationality = object.nationality ?? "";
|
|
318
|
+
message.gender = object.gender ?? "";
|
|
319
|
+
message.placeOfBirth = object.placeOfBirth ?? "";
|
|
320
|
+
message.personalNumber = object.personalNumber ?? "";
|
|
321
|
+
return message;
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
function createBaseDocumentData() {
|
|
325
|
+
return {
|
|
326
|
+
documentNumber: "",
|
|
327
|
+
issuingState: "",
|
|
328
|
+
issuingAuthority: "",
|
|
329
|
+
expiryDate: "",
|
|
330
|
+
documentClassCode: "",
|
|
331
|
+
mrzStrings: "",
|
|
332
|
+
documentCan: ""
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
var DocumentData = {
|
|
336
|
+
encode(message, writer = new BinaryWriter()) {
|
|
337
|
+
if (message.documentNumber !== "") {
|
|
338
|
+
writer.uint32(10).string(message.documentNumber);
|
|
339
|
+
}
|
|
340
|
+
if (message.issuingState !== "") {
|
|
341
|
+
writer.uint32(18).string(message.issuingState);
|
|
342
|
+
}
|
|
343
|
+
if (message.issuingAuthority !== "") {
|
|
344
|
+
writer.uint32(26).string(message.issuingAuthority);
|
|
345
|
+
}
|
|
346
|
+
if (message.expiryDate !== "") {
|
|
347
|
+
writer.uint32(34).string(message.expiryDate);
|
|
348
|
+
}
|
|
349
|
+
if (message.documentClassCode !== "") {
|
|
350
|
+
writer.uint32(42).string(message.documentClassCode);
|
|
351
|
+
}
|
|
352
|
+
if (message.mrzStrings !== "") {
|
|
353
|
+
writer.uint32(50).string(message.mrzStrings);
|
|
354
|
+
}
|
|
355
|
+
if (message.documentCan !== "") {
|
|
356
|
+
writer.uint32(58).string(message.documentCan);
|
|
357
|
+
}
|
|
358
|
+
return writer;
|
|
359
|
+
},
|
|
360
|
+
decode(input, length) {
|
|
361
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
362
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
363
|
+
const message = createBaseDocumentData();
|
|
364
|
+
while (reader.pos < end) {
|
|
365
|
+
const tag = reader.uint32();
|
|
366
|
+
switch (tag >>> 3) {
|
|
367
|
+
case 1: {
|
|
368
|
+
if (tag !== 10) {
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
message.documentNumber = reader.string();
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
case 2: {
|
|
375
|
+
if (tag !== 18) {
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
message.issuingState = reader.string();
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
case 3: {
|
|
382
|
+
if (tag !== 26) {
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
message.issuingAuthority = reader.string();
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
case 4: {
|
|
389
|
+
if (tag !== 34) {
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
message.expiryDate = reader.string();
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
case 5: {
|
|
396
|
+
if (tag !== 42) {
|
|
397
|
+
break;
|
|
398
|
+
}
|
|
399
|
+
message.documentClassCode = reader.string();
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
case 6: {
|
|
403
|
+
if (tag !== 50) {
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
message.mrzStrings = reader.string();
|
|
407
|
+
continue;
|
|
408
|
+
}
|
|
409
|
+
case 7: {
|
|
410
|
+
if (tag !== 58) {
|
|
411
|
+
break;
|
|
412
|
+
}
|
|
413
|
+
message.documentCan = reader.string();
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
reader.skip(tag & 7);
|
|
421
|
+
}
|
|
422
|
+
return message;
|
|
423
|
+
},
|
|
424
|
+
fromJSON(object) {
|
|
425
|
+
return {
|
|
426
|
+
documentNumber: isSet(object.documentNumber) ? globalThis.String(object.documentNumber) : "",
|
|
427
|
+
issuingState: isSet(object.issuingState) ? globalThis.String(object.issuingState) : "",
|
|
428
|
+
issuingAuthority: isSet(object.issuingAuthority) ? globalThis.String(object.issuingAuthority) : "",
|
|
429
|
+
expiryDate: isSet(object.expiryDate) ? globalThis.String(object.expiryDate) : "",
|
|
430
|
+
documentClassCode: isSet(object.documentClassCode) ? globalThis.String(object.documentClassCode) : "",
|
|
431
|
+
mrzStrings: isSet(object.mrzStrings) ? globalThis.String(object.mrzStrings) : "",
|
|
432
|
+
documentCan: isSet(object.documentCan) ? globalThis.String(object.documentCan) : ""
|
|
433
|
+
};
|
|
434
|
+
},
|
|
435
|
+
toJSON(message) {
|
|
436
|
+
const obj = {};
|
|
437
|
+
if (message.documentNumber !== "") {
|
|
438
|
+
obj.documentNumber = message.documentNumber;
|
|
439
|
+
}
|
|
440
|
+
if (message.issuingState !== "") {
|
|
441
|
+
obj.issuingState = message.issuingState;
|
|
442
|
+
}
|
|
443
|
+
if (message.issuingAuthority !== "") {
|
|
444
|
+
obj.issuingAuthority = message.issuingAuthority;
|
|
445
|
+
}
|
|
446
|
+
if (message.expiryDate !== "") {
|
|
447
|
+
obj.expiryDate = message.expiryDate;
|
|
448
|
+
}
|
|
449
|
+
if (message.documentClassCode !== "") {
|
|
450
|
+
obj.documentClassCode = message.documentClassCode;
|
|
451
|
+
}
|
|
452
|
+
if (message.mrzStrings !== "") {
|
|
453
|
+
obj.mrzStrings = message.mrzStrings;
|
|
454
|
+
}
|
|
455
|
+
if (message.documentCan !== "") {
|
|
456
|
+
obj.documentCan = message.documentCan;
|
|
457
|
+
}
|
|
458
|
+
return obj;
|
|
459
|
+
},
|
|
460
|
+
create(base) {
|
|
461
|
+
return DocumentData.fromPartial(base ?? {});
|
|
462
|
+
},
|
|
463
|
+
fromPartial(object) {
|
|
464
|
+
const message = createBaseDocumentData();
|
|
465
|
+
message.documentNumber = object.documentNumber ?? "";
|
|
466
|
+
message.issuingState = object.issuingState ?? "";
|
|
467
|
+
message.issuingAuthority = object.issuingAuthority ?? "";
|
|
468
|
+
message.expiryDate = object.expiryDate ?? "";
|
|
469
|
+
message.documentClassCode = object.documentClassCode ?? "";
|
|
470
|
+
message.mrzStrings = object.mrzStrings ?? "";
|
|
471
|
+
message.documentCan = object.documentCan ?? "";
|
|
472
|
+
return message;
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
function createBaseAddressData() {
|
|
476
|
+
return {
|
|
477
|
+
flat: "",
|
|
478
|
+
houseNumber: "",
|
|
479
|
+
building: "",
|
|
480
|
+
street: "",
|
|
481
|
+
city: "",
|
|
482
|
+
postalCode: "",
|
|
483
|
+
country: "",
|
|
484
|
+
addressLine: ""
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
var AddressData = {
|
|
488
|
+
encode(message, writer = new BinaryWriter()) {
|
|
489
|
+
if (message.flat !== "") {
|
|
490
|
+
writer.uint32(10).string(message.flat);
|
|
491
|
+
}
|
|
492
|
+
if (message.houseNumber !== "") {
|
|
493
|
+
writer.uint32(18).string(message.houseNumber);
|
|
494
|
+
}
|
|
495
|
+
if (message.building !== "") {
|
|
496
|
+
writer.uint32(26).string(message.building);
|
|
497
|
+
}
|
|
498
|
+
if (message.street !== "") {
|
|
499
|
+
writer.uint32(34).string(message.street);
|
|
500
|
+
}
|
|
501
|
+
if (message.city !== "") {
|
|
502
|
+
writer.uint32(42).string(message.city);
|
|
503
|
+
}
|
|
504
|
+
if (message.postalCode !== "") {
|
|
505
|
+
writer.uint32(50).string(message.postalCode);
|
|
506
|
+
}
|
|
507
|
+
if (message.country !== "") {
|
|
508
|
+
writer.uint32(58).string(message.country);
|
|
509
|
+
}
|
|
510
|
+
if (message.addressLine !== "") {
|
|
511
|
+
writer.uint32(66).string(message.addressLine);
|
|
512
|
+
}
|
|
513
|
+
return writer;
|
|
514
|
+
},
|
|
515
|
+
decode(input, length) {
|
|
516
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
517
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
518
|
+
const message = createBaseAddressData();
|
|
519
|
+
while (reader.pos < end) {
|
|
520
|
+
const tag = reader.uint32();
|
|
521
|
+
switch (tag >>> 3) {
|
|
522
|
+
case 1: {
|
|
523
|
+
if (tag !== 10) {
|
|
524
|
+
break;
|
|
525
|
+
}
|
|
526
|
+
message.flat = reader.string();
|
|
527
|
+
continue;
|
|
528
|
+
}
|
|
529
|
+
case 2: {
|
|
530
|
+
if (tag !== 18) {
|
|
531
|
+
break;
|
|
532
|
+
}
|
|
533
|
+
message.houseNumber = reader.string();
|
|
534
|
+
continue;
|
|
535
|
+
}
|
|
536
|
+
case 3: {
|
|
537
|
+
if (tag !== 26) {
|
|
538
|
+
break;
|
|
539
|
+
}
|
|
540
|
+
message.building = reader.string();
|
|
541
|
+
continue;
|
|
542
|
+
}
|
|
543
|
+
case 4: {
|
|
544
|
+
if (tag !== 34) {
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
message.street = reader.string();
|
|
548
|
+
continue;
|
|
549
|
+
}
|
|
550
|
+
case 5: {
|
|
551
|
+
if (tag !== 42) {
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
message.city = reader.string();
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
case 6: {
|
|
558
|
+
if (tag !== 50) {
|
|
559
|
+
break;
|
|
560
|
+
}
|
|
561
|
+
message.postalCode = reader.string();
|
|
562
|
+
continue;
|
|
563
|
+
}
|
|
564
|
+
case 7: {
|
|
565
|
+
if (tag !== 58) {
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
message.country = reader.string();
|
|
569
|
+
continue;
|
|
570
|
+
}
|
|
571
|
+
case 8: {
|
|
572
|
+
if (tag !== 66) {
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
message.addressLine = reader.string();
|
|
576
|
+
continue;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
580
|
+
break;
|
|
581
|
+
}
|
|
582
|
+
reader.skip(tag & 7);
|
|
583
|
+
}
|
|
584
|
+
return message;
|
|
585
|
+
},
|
|
586
|
+
fromJSON(object) {
|
|
587
|
+
return {
|
|
588
|
+
flat: isSet(object.flat) ? globalThis.String(object.flat) : "",
|
|
589
|
+
houseNumber: isSet(object.houseNumber) ? globalThis.String(object.houseNumber) : "",
|
|
590
|
+
building: isSet(object.building) ? globalThis.String(object.building) : "",
|
|
591
|
+
street: isSet(object.street) ? globalThis.String(object.street) : "",
|
|
592
|
+
city: isSet(object.city) ? globalThis.String(object.city) : "",
|
|
593
|
+
postalCode: isSet(object.postalCode) ? globalThis.String(object.postalCode) : "",
|
|
594
|
+
country: isSet(object.country) ? globalThis.String(object.country) : "",
|
|
595
|
+
addressLine: isSet(object.addressLine) ? globalThis.String(object.addressLine) : ""
|
|
596
|
+
};
|
|
597
|
+
},
|
|
598
|
+
toJSON(message) {
|
|
599
|
+
const obj = {};
|
|
600
|
+
if (message.flat !== "") {
|
|
601
|
+
obj.flat = message.flat;
|
|
602
|
+
}
|
|
603
|
+
if (message.houseNumber !== "") {
|
|
604
|
+
obj.houseNumber = message.houseNumber;
|
|
605
|
+
}
|
|
606
|
+
if (message.building !== "") {
|
|
607
|
+
obj.building = message.building;
|
|
608
|
+
}
|
|
609
|
+
if (message.street !== "") {
|
|
610
|
+
obj.street = message.street;
|
|
611
|
+
}
|
|
612
|
+
if (message.city !== "") {
|
|
613
|
+
obj.city = message.city;
|
|
614
|
+
}
|
|
615
|
+
if (message.postalCode !== "") {
|
|
616
|
+
obj.postalCode = message.postalCode;
|
|
617
|
+
}
|
|
618
|
+
if (message.country !== "") {
|
|
619
|
+
obj.country = message.country;
|
|
620
|
+
}
|
|
621
|
+
if (message.addressLine !== "") {
|
|
622
|
+
obj.addressLine = message.addressLine;
|
|
623
|
+
}
|
|
624
|
+
return obj;
|
|
625
|
+
},
|
|
626
|
+
create(base) {
|
|
627
|
+
return AddressData.fromPartial(base ?? {});
|
|
628
|
+
},
|
|
629
|
+
fromPartial(object) {
|
|
630
|
+
const message = createBaseAddressData();
|
|
631
|
+
message.flat = object.flat ?? "";
|
|
632
|
+
message.houseNumber = object.houseNumber ?? "";
|
|
633
|
+
message.building = object.building ?? "";
|
|
634
|
+
message.street = object.street ?? "";
|
|
635
|
+
message.city = object.city ?? "";
|
|
636
|
+
message.postalCode = object.postalCode ?? "";
|
|
637
|
+
message.country = object.country ?? "";
|
|
638
|
+
message.addressLine = object.addressLine ?? "";
|
|
639
|
+
return message;
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
function createBaseImage() {
|
|
643
|
+
return { contentType: "", data: new Uint8Array(0), provenance: 0 };
|
|
644
|
+
}
|
|
645
|
+
var Image = {
|
|
646
|
+
encode(message, writer = new BinaryWriter()) {
|
|
647
|
+
if (message.contentType !== "") {
|
|
648
|
+
writer.uint32(10).string(message.contentType);
|
|
649
|
+
}
|
|
650
|
+
if (message.data.length !== 0) {
|
|
651
|
+
writer.uint32(18).bytes(message.data);
|
|
652
|
+
}
|
|
653
|
+
if (message.provenance !== 0) {
|
|
654
|
+
writer.uint32(24).int32(message.provenance);
|
|
655
|
+
}
|
|
656
|
+
return writer;
|
|
657
|
+
},
|
|
658
|
+
decode(input, length) {
|
|
659
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
660
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
661
|
+
const message = createBaseImage();
|
|
662
|
+
while (reader.pos < end) {
|
|
663
|
+
const tag = reader.uint32();
|
|
664
|
+
switch (tag >>> 3) {
|
|
665
|
+
case 1: {
|
|
666
|
+
if (tag !== 10) {
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
message.contentType = reader.string();
|
|
670
|
+
continue;
|
|
671
|
+
}
|
|
672
|
+
case 2: {
|
|
673
|
+
if (tag !== 18) {
|
|
674
|
+
break;
|
|
675
|
+
}
|
|
676
|
+
message.data = reader.bytes();
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
679
|
+
case 3: {
|
|
680
|
+
if (tag !== 24) {
|
|
681
|
+
break;
|
|
682
|
+
}
|
|
683
|
+
message.provenance = reader.int32();
|
|
684
|
+
continue;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
688
|
+
break;
|
|
689
|
+
}
|
|
690
|
+
reader.skip(tag & 7);
|
|
691
|
+
}
|
|
692
|
+
return message;
|
|
693
|
+
},
|
|
694
|
+
fromJSON(object) {
|
|
695
|
+
return {
|
|
696
|
+
contentType: isSet(object.contentType) ? globalThis.String(object.contentType) : "",
|
|
697
|
+
data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0),
|
|
698
|
+
provenance: isSet(object.provenance) ? imageProvenanceFromJSON(object.provenance) : 0
|
|
699
|
+
};
|
|
700
|
+
},
|
|
701
|
+
toJSON(message) {
|
|
702
|
+
const obj = {};
|
|
703
|
+
if (message.contentType !== "") {
|
|
704
|
+
obj.contentType = message.contentType;
|
|
705
|
+
}
|
|
706
|
+
if (message.data.length !== 0) {
|
|
707
|
+
obj.data = base64FromBytes(message.data);
|
|
708
|
+
}
|
|
709
|
+
if (message.provenance !== 0) {
|
|
710
|
+
obj.provenance = imageProvenanceToJSON(message.provenance);
|
|
711
|
+
}
|
|
712
|
+
return obj;
|
|
713
|
+
},
|
|
714
|
+
create(base) {
|
|
715
|
+
return Image.fromPartial(base ?? {});
|
|
716
|
+
},
|
|
717
|
+
fromPartial(object) {
|
|
718
|
+
const message = createBaseImage();
|
|
719
|
+
message.contentType = object.contentType ?? "";
|
|
720
|
+
message.data = object.data ?? new Uint8Array(0);
|
|
721
|
+
message.provenance = object.provenance ?? 0;
|
|
722
|
+
return message;
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
function createBaseDocument() {
|
|
726
|
+
return { personalData: void 0, documentData: void 0, addressData: void 0 };
|
|
727
|
+
}
|
|
728
|
+
var Document = {
|
|
729
|
+
encode(message, writer = new BinaryWriter()) {
|
|
730
|
+
if (message.personalData !== void 0) {
|
|
731
|
+
PersonalData.encode(message.personalData, writer.uint32(10).fork()).join();
|
|
732
|
+
}
|
|
733
|
+
if (message.documentData !== void 0) {
|
|
734
|
+
DocumentData.encode(message.documentData, writer.uint32(18).fork()).join();
|
|
735
|
+
}
|
|
736
|
+
if (message.addressData !== void 0) {
|
|
737
|
+
AddressData.encode(message.addressData, writer.uint32(26).fork()).join();
|
|
738
|
+
}
|
|
739
|
+
return writer;
|
|
740
|
+
},
|
|
741
|
+
decode(input, length) {
|
|
742
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
743
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
744
|
+
const message = createBaseDocument();
|
|
745
|
+
while (reader.pos < end) {
|
|
746
|
+
const tag = reader.uint32();
|
|
747
|
+
switch (tag >>> 3) {
|
|
748
|
+
case 1: {
|
|
749
|
+
if (tag !== 10) {
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
message.personalData = PersonalData.decode(reader, reader.uint32());
|
|
753
|
+
continue;
|
|
754
|
+
}
|
|
755
|
+
case 2: {
|
|
756
|
+
if (tag !== 18) {
|
|
757
|
+
break;
|
|
758
|
+
}
|
|
759
|
+
message.documentData = DocumentData.decode(reader, reader.uint32());
|
|
760
|
+
continue;
|
|
761
|
+
}
|
|
762
|
+
case 3: {
|
|
763
|
+
if (tag !== 26) {
|
|
764
|
+
break;
|
|
765
|
+
}
|
|
766
|
+
message.addressData = AddressData.decode(reader, reader.uint32());
|
|
767
|
+
continue;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
771
|
+
break;
|
|
772
|
+
}
|
|
773
|
+
reader.skip(tag & 7);
|
|
774
|
+
}
|
|
775
|
+
return message;
|
|
776
|
+
},
|
|
777
|
+
fromJSON(object) {
|
|
778
|
+
return {
|
|
779
|
+
personalData: isSet(object.personalData) ? PersonalData.fromJSON(object.personalData) : void 0,
|
|
780
|
+
documentData: isSet(object.documentData) ? DocumentData.fromJSON(object.documentData) : void 0,
|
|
781
|
+
addressData: isSet(object.addressData) ? AddressData.fromJSON(object.addressData) : void 0
|
|
782
|
+
};
|
|
783
|
+
},
|
|
784
|
+
toJSON(message) {
|
|
785
|
+
const obj = {};
|
|
786
|
+
if (message.personalData !== void 0) {
|
|
787
|
+
obj.personalData = PersonalData.toJSON(message.personalData);
|
|
788
|
+
}
|
|
789
|
+
if (message.documentData !== void 0) {
|
|
790
|
+
obj.documentData = DocumentData.toJSON(message.documentData);
|
|
791
|
+
}
|
|
792
|
+
if (message.addressData !== void 0) {
|
|
793
|
+
obj.addressData = AddressData.toJSON(message.addressData);
|
|
794
|
+
}
|
|
795
|
+
return obj;
|
|
796
|
+
},
|
|
797
|
+
create(base) {
|
|
798
|
+
return Document.fromPartial(base ?? {});
|
|
799
|
+
},
|
|
800
|
+
fromPartial(object) {
|
|
801
|
+
const message = createBaseDocument();
|
|
802
|
+
message.personalData = object.personalData !== void 0 && object.personalData !== null ? PersonalData.fromPartial(object.personalData) : void 0;
|
|
803
|
+
message.documentData = object.documentData !== void 0 && object.documentData !== null ? DocumentData.fromPartial(object.documentData) : void 0;
|
|
804
|
+
message.addressData = object.addressData !== void 0 && object.addressData !== null ? AddressData.fromPartial(object.addressData) : void 0;
|
|
805
|
+
return message;
|
|
806
|
+
}
|
|
807
|
+
};
|
|
808
|
+
function createBaseDetails() {
|
|
809
|
+
return { status: 0, requestLog: "", responseLog: "" };
|
|
810
|
+
}
|
|
811
|
+
var Details = {
|
|
812
|
+
encode(message, writer = new BinaryWriter()) {
|
|
813
|
+
if (message.status !== 0) {
|
|
814
|
+
writer.uint32(8).int32(message.status);
|
|
815
|
+
}
|
|
816
|
+
if (message.requestLog !== "") {
|
|
817
|
+
writer.uint32(18).string(message.requestLog);
|
|
818
|
+
}
|
|
819
|
+
if (message.responseLog !== "") {
|
|
820
|
+
writer.uint32(26).string(message.responseLog);
|
|
821
|
+
}
|
|
822
|
+
return writer;
|
|
823
|
+
},
|
|
824
|
+
decode(input, length) {
|
|
825
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
826
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
827
|
+
const message = createBaseDetails();
|
|
828
|
+
while (reader.pos < end) {
|
|
829
|
+
const tag = reader.uint32();
|
|
830
|
+
switch (tag >>> 3) {
|
|
831
|
+
case 1: {
|
|
832
|
+
if (tag !== 8) {
|
|
833
|
+
break;
|
|
834
|
+
}
|
|
835
|
+
message.status = reader.int32();
|
|
836
|
+
continue;
|
|
837
|
+
}
|
|
838
|
+
case 2: {
|
|
839
|
+
if (tag !== 18) {
|
|
840
|
+
break;
|
|
841
|
+
}
|
|
842
|
+
message.requestLog = reader.string();
|
|
843
|
+
continue;
|
|
844
|
+
}
|
|
845
|
+
case 3: {
|
|
846
|
+
if (tag !== 26) {
|
|
847
|
+
break;
|
|
848
|
+
}
|
|
849
|
+
message.responseLog = reader.string();
|
|
850
|
+
continue;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
854
|
+
break;
|
|
855
|
+
}
|
|
856
|
+
reader.skip(tag & 7);
|
|
857
|
+
}
|
|
858
|
+
return message;
|
|
859
|
+
},
|
|
860
|
+
fromJSON(object) {
|
|
861
|
+
return {
|
|
862
|
+
status: isSet(object.status) ? resultStatusFromJSON(object.status) : 0,
|
|
863
|
+
requestLog: isSet(object.requestLog) ? globalThis.String(object.requestLog) : "",
|
|
864
|
+
responseLog: isSet(object.responseLog) ? globalThis.String(object.responseLog) : ""
|
|
865
|
+
};
|
|
866
|
+
},
|
|
867
|
+
toJSON(message) {
|
|
868
|
+
const obj = {};
|
|
869
|
+
if (message.status !== 0) {
|
|
870
|
+
obj.status = resultStatusToJSON(message.status);
|
|
871
|
+
}
|
|
872
|
+
if (message.requestLog !== "") {
|
|
873
|
+
obj.requestLog = message.requestLog;
|
|
874
|
+
}
|
|
875
|
+
if (message.responseLog !== "") {
|
|
876
|
+
obj.responseLog = message.responseLog;
|
|
877
|
+
}
|
|
878
|
+
return obj;
|
|
879
|
+
},
|
|
880
|
+
create(base) {
|
|
881
|
+
return Details.fromPartial(base ?? {});
|
|
882
|
+
},
|
|
883
|
+
fromPartial(object) {
|
|
884
|
+
const message = createBaseDetails();
|
|
885
|
+
message.status = object.status ?? 0;
|
|
886
|
+
message.requestLog = object.requestLog ?? "";
|
|
887
|
+
message.responseLog = object.responseLog ?? "";
|
|
888
|
+
return message;
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
function createBaseMessage() {
|
|
892
|
+
return {
|
|
893
|
+
document: void 0,
|
|
894
|
+
frontImage: void 0,
|
|
895
|
+
backImage: void 0,
|
|
896
|
+
otherImage: void 0,
|
|
897
|
+
details: void 0
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
var Message = {
|
|
901
|
+
encode(message, writer = new BinaryWriter()) {
|
|
902
|
+
if (message.document !== void 0) {
|
|
903
|
+
Document.encode(message.document, writer.uint32(10).fork()).join();
|
|
904
|
+
}
|
|
905
|
+
if (message.frontImage !== void 0) {
|
|
906
|
+
Image.encode(message.frontImage, writer.uint32(18).fork()).join();
|
|
907
|
+
}
|
|
908
|
+
if (message.backImage !== void 0) {
|
|
909
|
+
Image.encode(message.backImage, writer.uint32(26).fork()).join();
|
|
910
|
+
}
|
|
911
|
+
if (message.otherImage !== void 0) {
|
|
912
|
+
Image.encode(message.otherImage, writer.uint32(34).fork()).join();
|
|
913
|
+
}
|
|
914
|
+
if (message.details !== void 0) {
|
|
915
|
+
Details.encode(message.details, writer.uint32(42).fork()).join();
|
|
916
|
+
}
|
|
917
|
+
return writer;
|
|
918
|
+
},
|
|
919
|
+
decode(input, length) {
|
|
920
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
921
|
+
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
922
|
+
const message = createBaseMessage();
|
|
923
|
+
while (reader.pos < end) {
|
|
924
|
+
const tag = reader.uint32();
|
|
925
|
+
switch (tag >>> 3) {
|
|
926
|
+
case 1: {
|
|
927
|
+
if (tag !== 10) {
|
|
928
|
+
break;
|
|
929
|
+
}
|
|
930
|
+
message.document = Document.decode(reader, reader.uint32());
|
|
931
|
+
continue;
|
|
932
|
+
}
|
|
933
|
+
case 2: {
|
|
934
|
+
if (tag !== 18) {
|
|
935
|
+
break;
|
|
936
|
+
}
|
|
937
|
+
message.frontImage = Image.decode(reader, reader.uint32());
|
|
938
|
+
continue;
|
|
939
|
+
}
|
|
940
|
+
case 3: {
|
|
941
|
+
if (tag !== 26) {
|
|
942
|
+
break;
|
|
943
|
+
}
|
|
944
|
+
message.backImage = Image.decode(reader, reader.uint32());
|
|
945
|
+
continue;
|
|
946
|
+
}
|
|
947
|
+
case 4: {
|
|
948
|
+
if (tag !== 34) {
|
|
949
|
+
break;
|
|
950
|
+
}
|
|
951
|
+
message.otherImage = Image.decode(reader, reader.uint32());
|
|
952
|
+
continue;
|
|
953
|
+
}
|
|
954
|
+
case 5: {
|
|
955
|
+
if (tag !== 42) {
|
|
956
|
+
break;
|
|
957
|
+
}
|
|
958
|
+
message.details = Details.decode(reader, reader.uint32());
|
|
959
|
+
continue;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
965
|
+
reader.skip(tag & 7);
|
|
966
|
+
}
|
|
967
|
+
return message;
|
|
968
|
+
},
|
|
969
|
+
fromJSON(object) {
|
|
970
|
+
return {
|
|
971
|
+
document: isSet(object.document) ? Document.fromJSON(object.document) : void 0,
|
|
972
|
+
frontImage: isSet(object.frontImage) ? Image.fromJSON(object.frontImage) : void 0,
|
|
973
|
+
backImage: isSet(object.backImage) ? Image.fromJSON(object.backImage) : void 0,
|
|
974
|
+
otherImage: isSet(object.otherImage) ? Image.fromJSON(object.otherImage) : void 0,
|
|
975
|
+
details: isSet(object.details) ? Details.fromJSON(object.details) : void 0
|
|
976
|
+
};
|
|
977
|
+
},
|
|
978
|
+
toJSON(message) {
|
|
979
|
+
const obj = {};
|
|
980
|
+
if (message.document !== void 0) {
|
|
981
|
+
obj.document = Document.toJSON(message.document);
|
|
982
|
+
}
|
|
983
|
+
if (message.frontImage !== void 0) {
|
|
984
|
+
obj.frontImage = Image.toJSON(message.frontImage);
|
|
985
|
+
}
|
|
986
|
+
if (message.backImage !== void 0) {
|
|
987
|
+
obj.backImage = Image.toJSON(message.backImage);
|
|
988
|
+
}
|
|
989
|
+
if (message.otherImage !== void 0) {
|
|
990
|
+
obj.otherImage = Image.toJSON(message.otherImage);
|
|
991
|
+
}
|
|
992
|
+
if (message.details !== void 0) {
|
|
993
|
+
obj.details = Details.toJSON(message.details);
|
|
994
|
+
}
|
|
995
|
+
return obj;
|
|
996
|
+
},
|
|
997
|
+
create(base) {
|
|
998
|
+
return Message.fromPartial(base ?? {});
|
|
999
|
+
},
|
|
1000
|
+
fromPartial(object) {
|
|
1001
|
+
const message = createBaseMessage();
|
|
1002
|
+
message.document = object.document !== void 0 && object.document !== null ? Document.fromPartial(object.document) : void 0;
|
|
1003
|
+
message.frontImage = object.frontImage !== void 0 && object.frontImage !== null ? Image.fromPartial(object.frontImage) : void 0;
|
|
1004
|
+
message.backImage = object.backImage !== void 0 && object.backImage !== null ? Image.fromPartial(object.backImage) : void 0;
|
|
1005
|
+
message.otherImage = object.otherImage !== void 0 && object.otherImage !== null ? Image.fromPartial(object.otherImage) : void 0;
|
|
1006
|
+
message.details = object.details !== void 0 && object.details !== null ? Details.fromPartial(object.details) : void 0;
|
|
1007
|
+
return message;
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
function bytesFromBase64(b64) {
|
|
1011
|
+
if (globalThis.Buffer) {
|
|
1012
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
1013
|
+
} else {
|
|
1014
|
+
const bin = globalThis.atob(b64);
|
|
1015
|
+
const arr = new Uint8Array(bin.length);
|
|
1016
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
1017
|
+
arr[i] = bin.charCodeAt(i);
|
|
1018
|
+
}
|
|
1019
|
+
return arr;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
function base64FromBytes(arr) {
|
|
1023
|
+
if (globalThis.Buffer) {
|
|
1024
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
1025
|
+
} else {
|
|
1026
|
+
const bin = [];
|
|
1027
|
+
arr.forEach((byte) => {
|
|
1028
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
1029
|
+
});
|
|
1030
|
+
return globalThis.btoa(bin.join(""));
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
function isSet(value) {
|
|
1034
|
+
return value !== null && value !== void 0;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// src/utils/protobuf.ts
|
|
1038
|
+
function decodeLengthPrefixedMessages(buffer) {
|
|
1039
|
+
const result = {};
|
|
1040
|
+
let currentOffset = 0;
|
|
1041
|
+
while (currentOffset < buffer.length) {
|
|
1042
|
+
const { length, offset } = readVarint(buffer.slice(currentOffset));
|
|
1043
|
+
const messageStart = currentOffset + offset;
|
|
1044
|
+
const messageEnd = messageStart + length;
|
|
1045
|
+
if (buffer.length < messageEnd) {
|
|
1046
|
+
throw new Error("Incomplete Protobuf Message");
|
|
1047
|
+
}
|
|
1048
|
+
const messageBuffer = buffer.slice(messageStart, messageEnd);
|
|
1049
|
+
const message = Message.decode(messageBuffer);
|
|
1050
|
+
if (message.document) {
|
|
1051
|
+
result.document = message.document;
|
|
1052
|
+
} else if (message.frontImage) {
|
|
1053
|
+
result.frontImage = message.frontImage;
|
|
1054
|
+
} else if (message.backImage) {
|
|
1055
|
+
result.backImage = message.backImage;
|
|
1056
|
+
} else if (message.otherImage) {
|
|
1057
|
+
result.otherImages = result.otherImages ?? [];
|
|
1058
|
+
result.otherImages.push(message.otherImage);
|
|
1059
|
+
} else if (message.details) {
|
|
1060
|
+
result.details = message.details;
|
|
1061
|
+
}
|
|
1062
|
+
currentOffset = messageEnd;
|
|
1063
|
+
}
|
|
1064
|
+
return result;
|
|
1065
|
+
}
|
|
1066
|
+
function readVarint(buffer) {
|
|
1067
|
+
let result = 0, shift = 0, offset = 0;
|
|
1068
|
+
const maxBytes = Math.min(buffer.length, 5);
|
|
1069
|
+
for (let i = 0; i < maxBytes; i++) {
|
|
1070
|
+
const byte = buffer[offset];
|
|
1071
|
+
if (byte === void 0) {
|
|
1072
|
+
break;
|
|
1073
|
+
}
|
|
1074
|
+
offset++;
|
|
1075
|
+
result |= (byte & 127) << shift;
|
|
1076
|
+
if ((byte & 128) === 0) {
|
|
1077
|
+
return { length: result, offset };
|
|
1078
|
+
}
|
|
1079
|
+
shift += 7;
|
|
1080
|
+
}
|
|
1081
|
+
throw new Error("Malformed Varint: Too many bytes without termination.");
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
// src/flow-results.ts
|
|
1085
|
+
async function getFlowResult({ organizationId, flowResultId, isSandbox }, opts) {
|
|
1086
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
1087
|
+
const client = zypheApiClient(opts);
|
|
1088
|
+
const response = await client.GET(
|
|
1089
|
+
"/sdk/organizations/{organization_id}/flow-results/{flow_result_id}/details",
|
|
1090
|
+
{
|
|
1091
|
+
params: {
|
|
1092
|
+
path: {
|
|
1093
|
+
organization_id: organizationId,
|
|
1094
|
+
flow_result_id: flowResultId
|
|
1095
|
+
},
|
|
1096
|
+
query: {
|
|
1097
|
+
sandbox: isSandbox
|
|
1098
|
+
}
|
|
1099
|
+
},
|
|
1100
|
+
headers: {
|
|
1101
|
+
[API_KEY_HEADER]: opts.apiKey
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
);
|
|
1105
|
+
const { data, ...rest } = response;
|
|
1106
|
+
return {
|
|
1107
|
+
...rest,
|
|
1108
|
+
data: {
|
|
1109
|
+
...data,
|
|
1110
|
+
dvResults: data?.dvResults.toSorted((a, b) => {
|
|
1111
|
+
return b.createdAt?.localeCompare(a.createdAt ?? "") ?? 0;
|
|
1112
|
+
}),
|
|
1113
|
+
amlResults: data?.amlResults.toSorted((a, b) => {
|
|
1114
|
+
return b.createdAt.localeCompare(a.createdAt);
|
|
1115
|
+
}),
|
|
1116
|
+
poaResults: data?.poaResults.toSorted((a, b) => {
|
|
1117
|
+
return b.createdAt.localeCompare(a.createdAt);
|
|
1118
|
+
})
|
|
1119
|
+
}
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
async function getDvResult({ organizationId, flowResultId, dvResultId, isSandbox }, opts) {
|
|
1123
|
+
ensureApiKeyType(opts.apiKey, ["SECRET"]);
|
|
1124
|
+
const client = zypheApiClient(opts);
|
|
1125
|
+
const response = await client.GET(
|
|
1126
|
+
"/sdk/organizations/{organization_id}/flow-results/{flow_result_id}/dv/{dv_result_id}/details",
|
|
1127
|
+
{
|
|
1128
|
+
params: {
|
|
1129
|
+
path: {
|
|
1130
|
+
organization_id: organizationId,
|
|
1131
|
+
flow_result_id: flowResultId,
|
|
1132
|
+
dv_result_id: dvResultId
|
|
1133
|
+
},
|
|
1134
|
+
query: {
|
|
1135
|
+
sandbox: isSandbox
|
|
1136
|
+
}
|
|
1137
|
+
},
|
|
1138
|
+
headers: {
|
|
1139
|
+
[API_KEY_HEADER]: opts.apiKey,
|
|
1140
|
+
Accept: "application/x-protobuf"
|
|
1141
|
+
},
|
|
1142
|
+
parseAs: "arrayBuffer"
|
|
1143
|
+
}
|
|
1144
|
+
);
|
|
1145
|
+
const { data, ...rest } = response;
|
|
1146
|
+
return {
|
|
1147
|
+
...rest,
|
|
1148
|
+
data: data ? decodeLengthPrefixedMessages(new Uint8Array(data)) : void 0
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
|
|
94
1152
|
// src/webhook.ts
|
|
95
1153
|
function parseSignatureHeader(signatureHeader) {
|
|
96
1154
|
const match = signatureHeader.match(/^t=(\d+),v0=([a-fA-F0-9]+)$/);
|
|
@@ -141,6 +1199,8 @@ export {
|
|
|
141
1199
|
bufferToHex,
|
|
142
1200
|
constructVerificationSessionUrl,
|
|
143
1201
|
createVerificationSession,
|
|
1202
|
+
getDvResult,
|
|
1203
|
+
getFlowResult,
|
|
144
1204
|
hexToBytes,
|
|
145
1205
|
parseSignatureHeader,
|
|
146
1206
|
timingSafeEqual
|