bry-biometric-collector 2.0.3 → 2.0.4

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.
@@ -1,6 +1,6 @@
1
- import { u as D, $ as C, n as y, g, i as b, a as M, s as l, b as h, c as U, F, d as x, e as c, v, f as P, A as B, h as S, j as E, k as W, l as k, m as X, o as w, p as $, q as G } from "./main_4a3321b2_2.0.3.js";
1
+ import { o as D, X as C, n as y, g, i as b, a as M, s as l, b as h, c as U, F, d as x, e as c, v, f as P, A as B, h as S, j as E, k as W, l as k, u as X, m as R, p as G, q as V } from "./main_14ce11df_2.0.4.js";
2
2
  const d = D(C);
3
- var V = /* @__PURE__ */ ((n) => (n.EXTENSION_MISSING = "EXTENSION_MISSING", n.USER_CANCELLED = "USER_CANCELLED", n.UNAUTHORIZED_EXTENSION = "UNAUTHORIZED_EXTENSION", n.SCANNER_NOT_FOUND = "SCANNER_NOT_FOUND", n.EXTENSION_MODULE_NOT_INSTALLED = "EXTENSION_MODULE_NOT_INSTALLED", n.FINGER_NOT_REMOVED = "FINGER_NOT_REMOVED", n.UNKNOWN_ERROR = "UNKNOWN_ERROR", n.EVALUATE_BIOMETRICS_TIMEOUT = "EVALUATE_BIOMETRICS_TIMEOUT", n.EVALUATE_BIOMETRICS_NETWORK_ISSUE = "EVALUATE_BIOMETRICS_NETWORK_ISSUE", n))(V || {});
3
+ var q = /* @__PURE__ */ ((n) => (n.EXTENSION_MISSING = "EXTENSION_MISSING", n.USER_CANCELLED = "USER_CANCELLED", n.UNAUTHORIZED_EXTENSION = "UNAUTHORIZED_EXTENSION", n.SCANNER_NOT_FOUND = "SCANNER_NOT_FOUND", n.EXTENSION_MODULE_NOT_INSTALLED = "EXTENSION_MODULE_NOT_INSTALLED", n.FINGER_NOT_REMOVED = "FINGER_NOT_REMOVED", n.UNKNOWN_ERROR = "UNKNOWN_ERROR", n.EVALUATE_BIOMETRICS_TIMEOUT = "EVALUATE_BIOMETRICS_TIMEOUT", n.EVALUATE_BIOMETRICS_NETWORK_ISSUE = "EVALUATE_BIOMETRICS_NETWORK_ISSUE", n))(q || {});
4
4
  class s extends Error {
5
5
  constructor(a, T) {
6
6
  super(a), this.status = T;
@@ -73,7 +73,7 @@ async function K(n, a) {
73
73
  "USER_CANCELLED"
74
74
  /* USER_CANCELLED */
75
75
  );
76
- const i = q(T);
76
+ const i = $(T);
77
77
  i.image = N?.content.image?.data, i.base64WSQ = N?.content.fingerprint.data, i.nfiqRating = (N?.content.score || 0) + 98, i.status = F.AVAILABLE;
78
78
  const L = x(c());
79
79
  let r, _ = !1;
@@ -100,14 +100,14 @@ async function K(n, a) {
100
100
  /* EVALUATE_BIOMETRICS_NETWORK_ISSUE */
101
101
  ));
102
102
  }
103
- let R, f, O, A, u, o = E.LOW_QUALITY;
103
+ let w, f, O, A, u, o = E.LOW_QUALITY;
104
104
  if (r) {
105
105
  const e = r.bodyParts.find(
106
106
  (t) => t.bodyPart === i.bodyPart
107
107
  );
108
- i.nfiqRating = e.quality, (e.quality > W() || e.status === "LOW_QUALITY") && (R = !0, o = E.LOW_QUALITY), r.bodyParts.find((t) => t.status === "DUPLICATE") && (f = !0, o = E.DUPLICATE), r.bodyParts.find((t) => t.status === "FORBIDDEN") && (O = !0, o = E.FORBIDDEN), r.bodyParts.find((t) => t.status === "AGR") && (A = !0, o = E.AGR_DETECTED), r.bodyParts.find((t) => t.status === "AGR_NOT_MATCH") && (u = !0, o = E.AGR_NO_MATCH);
108
+ i.nfiqRating = e.quality, (e.quality > W() || e.status === "LOW_QUALITY") && (w = !0, o = E.LOW_QUALITY), r.bodyParts.find((t) => t.status === "DUPLICATE") && (f = !0, o = E.DUPLICATE), r.bodyParts.find((t) => t.status === "FORBIDDEN") && (O = !0, o = E.FORBIDDEN), r.bodyParts.find((t) => t.status === "AGR") && (A = !0, o = E.AGR_DETECTED), r.bodyParts.find((t) => t.status === "AGR_NOT_MATCH") && (u = !0, o = E.AGR_NO_MATCH);
109
109
  }
110
- if (f || R || O || u || A || _) {
110
+ if (f || w || O || u || A || _) {
111
111
  i.nfiqRating = -1, i.base64WSQ = "", i.image = "", i.status = F.AVAILABLE;
112
112
  let e = "badFingerQualitySwal";
113
113
  f ? e = "unknownDuplicateFingerSwal" : O ? e = "forbiddenFingerSwal" : A ? e = "agrFinger" : u && (e = "agrFingerNotMatched");
@@ -119,7 +119,7 @@ async function K(n, a) {
119
119
  finger2: d(`${e}.${r.matchingFingers?.[1]}`)
120
120
  }
121
121
  });
122
- const m = w();
122
+ const m = R();
123
123
  return {
124
124
  returnCode: o,
125
125
  bodyParts: m,
@@ -127,13 +127,13 @@ async function K(n, a) {
127
127
  message: t
128
128
  };
129
129
  }
130
- const p = w();
130
+ const p = R();
131
131
  return { returnCode: o, bodyParts: p, message: t };
132
132
  }
133
- return S(c()), l(!1), $(), { returnCode: E.CAPTURED, bodyParts: w() };
133
+ return S(c()), l(!1), G(), { returnCode: E.CAPTURED, bodyParts: R() };
134
134
  }
135
- function q(n) {
136
- G();
135
+ function $(n) {
136
+ V();
137
137
  for (const a of c())
138
138
  if (a.index === n)
139
139
  return a.selected = !0, a;
@@ -141,6 +141,6 @@ function q(n) {
141
141
  }
142
142
  export {
143
143
  s as CaptureApiError,
144
- V as CaptureErrorStatusEnum,
144
+ q as CaptureErrorStatusEnum,
145
145
  K as captureSingleFinger
146
146
  };
Binary file
@@ -0,0 +1,198 @@
1
+ export interface livenessResult {
2
+ capture_liveness: { probability: number; score: number };
3
+ face_liveness: { probability: number };
4
+ }
5
+
6
+ export interface livenessErrorResult {
7
+ error: string;
8
+ error_code: string;
9
+ }
10
+ export interface BodyPart {
11
+ /**
12
+ * bodypart name
13
+ */
14
+ bodyPart: string;
15
+ /**
16
+ * base64 data
17
+ */
18
+ data: string;
19
+ img?: string;
20
+ status?: string;
21
+ justification?: string;
22
+ nfiq?: number;
23
+ livenessBlob?: string;
24
+ livenessResult?: livenessResult | livenessErrorResult;
25
+ }
26
+ export enum Props {
27
+ EXTENSION_NAME = 'extension_name',
28
+ COLLECTOR_SELECT = 'collector_select',
29
+ VIDEO_DIMENSIONS = 'video_dimensions',
30
+ ENABLE_MINUTIAE = 'enable_minutiae',
31
+ WEIGHTS_PATH = 'weights_path',
32
+ LIVENESS_ENABLE = 'liveness_enable',
33
+ IMPORT_LOTTIE = 'import_lottie',
34
+ HIDE_TABS = 'hide_tabs',
35
+ IMPORT_BRY_WEB_COLLECTOR_SCRIPT = 'import_bry_web_collector_script',
36
+ }
37
+
38
+ export const enum BodyPartNames {
39
+ LEFT_HAND_PINKY = 'LEFT_HAND_PINKY',
40
+ LEFT_HAND_RING = 'LEFT_HAND_RING',
41
+ LEFT_HAND_MIDDLE = 'LEFT_HAND_MIDDLE',
42
+ LEFT_HAND_INDEX = 'LEFT_HAND_INDEX',
43
+ LEFT_HAND_THUMB = 'LEFT_HAND_THUMB',
44
+ RIGHT_HAND_THUMB = 'RIGHT_HAND_THUMB',
45
+ RIGHT_HAND_INDEX = 'RIGHT_HAND_INDEX',
46
+ RIGHT_HAND_MIDDLE = 'RIGHT_HAND_MIDDLE',
47
+ RIGHT_HAND_RING = 'RIGHT_HAND_RING',
48
+ RIGHT_HAND_PINKY = 'RIGHT_HAND_PINKY',
49
+ RIGHT_HAND = 'RIGHT_HAND',
50
+ LEFT_HAND = 'LEFT_HAND',
51
+ }
52
+
53
+ export const enum requestResultEnum {
54
+ OK = 'OK',
55
+ TEMPLATE_EXTRACTION_ERROR = 'TEMPLATE_EXTRACTION_ERROR',
56
+ UNKNOWN_TEMPLATE_EXTRACTION_ERROR = 'UNKNOWN_TEMPLATE_EXTRACTION_ERROR',
57
+ LOW_LIVENESS_SCORE = 'LOW_LIVENESS_SCORE',
58
+ LIVENESS_DETECTION_FAILURE = 'LIVENESS_DETECTION_FAILURE',
59
+ UNKNOWN_LIVENESS_ERROR = 'UNKNOWN_LIVENESS_ERROR',
60
+ UNABLE_TO_COMMUNICATE_WITH_LIVENESS_SERVICE = 'UNABLE_TO_COMMUNICATE_WITH_LIVENESS_SERVICE',
61
+ UNABLE_TO_COMMUNICATE_WITH_TEMPLATE_EXTRACTION_SERVICE = 'UNABLE_TO_COMMUNICATE_WITH_TEMPLATE_EXTRACTION_SERVICE',
62
+ }
63
+
64
+ export type FingerIndex = 0 | 1 | 2 | 4 | 6 | 3 | 5 | 7 | 8 | 9 | 10 | 11;
65
+ export type FingerName = keyof typeof BodyPartNames;
66
+
67
+ export interface EventResult {
68
+ 'export-face': BodyPart;
69
+ }
70
+ export type BryWebCollectorComponentEvent<K> = CustomEvent<K>;
71
+
72
+ // Once the web component fires events form itself instead of from the window, we can uncomment this
73
+ // export type BryWebCollectorComponentEventMap = HTMLElementEventMap &
74
+ // {
75
+ // [P in keyof EventResult]: BryWebCollectorComponentEvent<EventResult[P]>;
76
+ // };
77
+
78
+ export type exportFace = BryWebCollectorComponentEvent<BodyPart>;
79
+ export type faceUnconformitiesValidated = BryWebCollectorComponentEvent<{
80
+ bodyParts: BodyPart[];
81
+ errorCode?: string;
82
+ icaoWarnings?: string[];
83
+ status: requestResultEnum;
84
+ }>;
85
+
86
+ declare global {
87
+ interface BryWebCollectorComponent extends HTMLElement {
88
+ // And this
89
+ // addEventListener<K extends keyof BryWebCollectorComponentEventMap>(
90
+ // type: K,
91
+ // listener: (
92
+ // this: BryWebCollectorComponent,
93
+ // ev: BryWebCollectorComponentEventMap[K]
94
+ // ) => unknown,
95
+ // options?: boolean | AddEventListenerOptions
96
+ // ): void;
97
+ // removeEventListener<K extends keyof BryWebCollectorComponentEventMap>(
98
+ // type: K,
99
+ // listener: (
100
+ // this: BryWebCollectorComponent,
101
+ // ev: BryWebCollectorComponentEventMap[K]
102
+ // ) => unknown,
103
+ // options?: boolean | EventListenerOptions
104
+ // ): void;
105
+
106
+ // PROPS
107
+ [Props.EXTENSION_NAME]: string;
108
+ [Props.COLLECTOR_SELECT]: 'BOTH' | 'FINGERS' | 'FACE';
109
+ [Props.VIDEO_DIMENSIONS]: string;
110
+ [Props.ENABLE_MINUTIAE]: string;
111
+ [Props.WEIGHTS_PATH]: string;
112
+ [Props.LIVENESS_ENABLE]: string;
113
+ [Props.IMPORT_LOTTIE]: string;
114
+ [Props.HIDE_TABS]: string;
115
+ [Props.IMPORT_BRY_WEB_COLLECTOR_SCRIPT]: string;
116
+ /**
117
+ * Clears fingers and face, to make ready for a new collection.
118
+ * Will not clear jwtToken.
119
+ */
120
+ reset(): void;
121
+ setCode(usrCode: string): this;
122
+ setBioAcJWTToken(token: string, bioacUrl: string, validateBiometricsUrl: string): this;
123
+ getJustification(): string;
124
+ /**
125
+ * Wether to send a finger-cleared message whenever the clear btn is clicked.
126
+ *
127
+ */
128
+ setNotifyFingersCleared(newValue: boolean): this;
129
+ /**
130
+ * Sets the face collector component within the web component. This is required when changing tabs in the embedded application.
131
+ * This is required because of a svelte issue. The component's onDestroy never actually gets called and therefore the on mount
132
+ * doesn't get called so we have to compensate that here. Hopefully in svelte version 4 that issue will get fixed.
133
+ * */
134
+ setFaceCollectorComponent(): Promise<this>;
135
+ /**
136
+ * You may disable face Api in case your computer isn't powerful enough.
137
+ */
138
+ setEnableFaceDetector(enabled: boolean): this;
139
+ /**
140
+ * You may define a list of fingers and their base64 values that can be captured.
141
+ * This forces the capture process to match the given finger at the given position, and stopping otherwise.
142
+ * Only works in wasm mode and requires agrAuthentication to be true
143
+ * @param _requiredFingers
144
+ */
145
+ setRequiredFingers(
146
+ _requiredFingers: {
147
+ data: string;
148
+ bodyPart: FingerName;
149
+ }[]
150
+ ): Promise<this>;
151
+ /**
152
+ * Sets pre collected fingers. The component will show the fingers as if they had
153
+ * been just collected.
154
+ */
155
+ setCollectedFingers(
156
+ fingers: Array<{
157
+ bodyPart: number | BodyPartNames;
158
+ data: string;
159
+ img?: string;
160
+ nfiq?: number;
161
+ }>
162
+ ): Promise<this>;
163
+ setLivenessEndpoint(url: string): this;
164
+ setEnableLiveness(nv: boolean): this;
165
+ setShowLivenessResultToast(nv: boolean): this;
166
+ verify(
167
+ missingFingers: Array<number | BodyPartNames>,
168
+ unavailableFingers: Array<number | BodyPartNames>,
169
+ automaticFingers: Array<number | BodyPartNames>,
170
+ code: string
171
+ ): Promise<void>;
172
+ update(
173
+ missingFingers: Array<number | BodyPartNames>,
174
+ unavailableFingers: Array<number | BodyPartNames>,
175
+ automaticFingers: Array<number | BodyPartNames>,
176
+ code: string
177
+ ): Promise<void>;
178
+ /**
179
+ * Sets up the component to perform an enroll according to the PSBIO rules
180
+ */
181
+ enroll(code: string): Promise<void>;
182
+ verifyAgr(
183
+ missingFingers: Array<number | BodyPartNames>,
184
+ unavailableFingers: Array<number | BodyPartNames>,
185
+ automaticFingers: Array<number | BodyPartNames>,
186
+ blacklistedFingers: { data: string; bodyPart: FingerName }[],
187
+ code: string,
188
+ agrCode: string
189
+ ): Promise<void>;
190
+ }
191
+ interface HTMLElementTagNameMap {
192
+ 'biometric-collector': this;
193
+ }
194
+ interface WindowEventMap {
195
+ 'export-face': exportFace;
196
+ 'face-unconformities-validated': faceUnconformitiesValidated;
197
+ }
198
+ }
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { aY as f } from "./main_14ce11df_2.0.4.js";
2
+ export {
3
+ f as default
4
+ };