@authme/identity-verification 2.8.49 → 2.8.51
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/index.cjs.js +39 -61
- package/index.esm.js +39 -61
- package/package.json +1 -1
- package/src/lib/ui/liveness-flow.d.ts +2 -2
package/index.cjs.js
CHANGED
|
@@ -29696,7 +29696,6 @@ async function startLiveness(config) {
|
|
|
29696
29696
|
sendFrame(canvasSizeInfo, canvas, uiComponentBasic.video, config.onFrame, livenessConfig.fasMaxFps, true, 'all', undefined, frameFlags), rxjs.tap(({
|
|
29697
29697
|
result
|
|
29698
29698
|
}) => {
|
|
29699
|
-
// console.log('result', result);
|
|
29700
29699
|
applyTextByResult(result);
|
|
29701
29700
|
}),
|
|
29702
29701
|
// filter(
|
|
@@ -29725,20 +29724,14 @@ async function startLiveness(config) {
|
|
|
29725
29724
|
return Object.assign({}, data, {
|
|
29726
29725
|
isSuccess
|
|
29727
29726
|
});
|
|
29728
|
-
}))))), rxjs.tap(
|
|
29729
|
-
|
|
29730
|
-
|
|
29731
|
-
|
|
29732
|
-
|
|
29733
|
-
|
|
29734
|
-
|
|
29735
|
-
|
|
29736
|
-
});
|
|
29737
|
-
} else {
|
|
29738
|
-
// Engine 返回 timeout 或其他失敗狀態
|
|
29739
|
-
throw new core.AuthmeError(core.ErrorCode.LIVENESS_NOT_PASSED);
|
|
29740
|
-
}
|
|
29741
|
-
}), rxjs.filter(res => res.isSuccess), rxjs.switchMap(() => rxjs.defer(() => config.onSuccess())));
|
|
29727
|
+
}))))), rxjs.tap(() => {
|
|
29728
|
+
sendStatusDescription$2(core.StatusDescription.UploadingStart);
|
|
29729
|
+
util.startSpinner({
|
|
29730
|
+
text: translateService.translate('sdk.general.uploading'),
|
|
29731
|
+
statement: translateService.translate('sdk.general.footer'),
|
|
29732
|
+
backgroundOpaque: true
|
|
29733
|
+
});
|
|
29734
|
+
}), rxjs.switchMap(res => rxjs.defer(() => config.onSuccess(res.isSuccess))));
|
|
29742
29735
|
return rxjs.of({}).pipe(() => {
|
|
29743
29736
|
eventListenerService$2.start();
|
|
29744
29737
|
setStatusView$2(core.StatusView.Init);
|
|
@@ -34233,6 +34226,9 @@ class LivenessVerifyModule {
|
|
|
34233
34226
|
let id = '';
|
|
34234
34227
|
let frameWidth;
|
|
34235
34228
|
let frameHeight;
|
|
34229
|
+
// 保存 API 返回的參數,避免在 onStart 中被 setStage reinit 覆蓋
|
|
34230
|
+
let apiTimeoutSec;
|
|
34231
|
+
let apiFasThreshold;
|
|
34236
34232
|
try {
|
|
34237
34233
|
const result = await rxjs.firstValueFrom(await startLiveness({
|
|
34238
34234
|
getOptionConfig: async function () {
|
|
@@ -34252,15 +34248,11 @@ class LivenessVerifyModule {
|
|
|
34252
34248
|
}
|
|
34253
34249
|
await _this.fasService.init();
|
|
34254
34250
|
const params = await _this.fasService.getParams();
|
|
34255
|
-
|
|
34256
|
-
|
|
34257
|
-
|
|
34258
|
-
|
|
34259
|
-
|
|
34260
|
-
// fTop: 0.3,
|
|
34261
|
-
// fRight: 0.7,
|
|
34262
|
-
// fBottom: 0.7,
|
|
34263
|
-
// };
|
|
34251
|
+
// 保存 API 參數,在 onStart 中 setStage reinit 後重新套用
|
|
34252
|
+
apiTimeoutSec = resp.parameters.fasTimeout || params.timeoutSec;
|
|
34253
|
+
apiFasThreshold = resp.parameters.fasThreshold || params.fFASTh;
|
|
34254
|
+
params.timeoutSec = apiTimeoutSec;
|
|
34255
|
+
params.fFASTh = apiFasThreshold;
|
|
34264
34256
|
await _this.fasService.setParams(params);
|
|
34265
34257
|
return resp.parameters;
|
|
34266
34258
|
} catch (e) {
|
|
@@ -34295,6 +34287,13 @@ class LivenessVerifyModule {
|
|
|
34295
34287
|
onStart: async function (canvasSizeInfoCan) {
|
|
34296
34288
|
frameWidth = canvasSizeInfoCan.canvasWidth;
|
|
34297
34289
|
frameHeight = canvasSizeInfoCan.canvasHeight;
|
|
34290
|
+
// 先 setStage(會 reinit FAS service),再 setParams,
|
|
34291
|
+
// 避免 setStage reinit 後重置已設定的 params
|
|
34292
|
+
if (config.active) {
|
|
34293
|
+
await _this.fasService.setStage([liveness.EAuthMeFASServiceStage.Passive, liveness.EAuthMeFASServiceStage.OpenMouth, liveness.EAuthMeFASServiceStage.CloseMouth]);
|
|
34294
|
+
} else {
|
|
34295
|
+
await _this.fasService.setStage([liveness.EAuthMeFASServiceStage.Passive]);
|
|
34296
|
+
}
|
|
34298
34297
|
const params = await _this.fasService.getParams();
|
|
34299
34298
|
const oldROI = params.faceROI;
|
|
34300
34299
|
const actualHight = frameHeight * (oldROI.fBottom - oldROI.fTop);
|
|
@@ -34307,12 +34306,10 @@ class LivenessVerifyModule {
|
|
|
34307
34306
|
params.faceROI.fLeft = (1 - widthPercent) / 2;
|
|
34308
34307
|
params.faceROI.fRight = 1 - (1 - widthPercent) / 2;
|
|
34309
34308
|
}
|
|
34309
|
+
// 保留 API 設定的 timeout 和 threshold,避免被 getParams() 的預設值覆蓋
|
|
34310
|
+
params.timeoutSec = apiTimeoutSec;
|
|
34311
|
+
params.fFASTh = apiFasThreshold;
|
|
34310
34312
|
await _this.fasService.setParams(params);
|
|
34311
|
-
if (config.active) {
|
|
34312
|
-
await _this.fasService.setStage([liveness.EAuthMeFASServiceStage.Passive, liveness.EAuthMeFASServiceStage.OpenMouth, liveness.EAuthMeFASServiceStage.CloseMouth]);
|
|
34313
|
-
} else {
|
|
34314
|
-
await _this.fasService.setStage([liveness.EAuthMeFASServiceStage.Passive]);
|
|
34315
|
-
}
|
|
34316
34313
|
await _this.fasService.startSession();
|
|
34317
34314
|
return params;
|
|
34318
34315
|
},
|
|
@@ -34539,21 +34536,16 @@ class LivenessModule {
|
|
|
34539
34536
|
await _this.fasService.setPublicKeyForJson('');
|
|
34540
34537
|
}
|
|
34541
34538
|
await _this.fasService.init();
|
|
34539
|
+
// 先 setStage(會 reinit FAS service),再 setParams,
|
|
34540
|
+
// 避免 setStage reinit 後重置已設定的 params
|
|
34541
|
+
await _this.fasService.setStage(resp.parameters.fasStages.map(x => `EAuthMeFASServiceStage_${x}`));
|
|
34542
34542
|
const params = await _this.fasService.getParams();
|
|
34543
|
-
// sample code for manually change faceROI when need. TonyQ@20230106
|
|
34544
|
-
// this.params.faceROI = {
|
|
34545
|
-
// fLeft: 0.3,
|
|
34546
|
-
// fTop: 0.3,
|
|
34547
|
-
// fRight: 0.7,
|
|
34548
|
-
// fBottom: 0.7,
|
|
34549
|
-
// };
|
|
34550
34543
|
// 保存 API 參數,在 onStart 中使用
|
|
34551
34544
|
apiTimeoutSec = resp.parameters.fasTimeout || params.timeoutSec;
|
|
34552
34545
|
apiFasThreshold = resp.parameters.fasThreshold || params.fFASTh;
|
|
34553
34546
|
params.timeoutSec = apiTimeoutSec;
|
|
34554
34547
|
params.fFASTh = apiFasThreshold;
|
|
34555
34548
|
await _this.fasService.setParams(params);
|
|
34556
|
-
await _this.fasService.setStage(resp.parameters.fasStages.map(x => `EAuthMeFASServiceStage_${x}`));
|
|
34557
34549
|
// return resp.parameters;
|
|
34558
34550
|
return resp;
|
|
34559
34551
|
},
|
|
@@ -34645,33 +34637,19 @@ class LivenessModule {
|
|
|
34645
34637
|
getSelectedImage: () => {
|
|
34646
34638
|
return selectedImage;
|
|
34647
34639
|
},
|
|
34648
|
-
onSuccess: async function () {
|
|
34640
|
+
onSuccess: async function (isSuccess) {
|
|
34649
34641
|
await _this.fasService.stop();
|
|
34650
34642
|
const meta = await _this.fasService.getReport();
|
|
34651
|
-
// await SendRequestWithRetry(() =>
|
|
34652
|
-
// this.postResult(
|
|
34653
|
-
// id,
|
|
34654
|
-
// frameList,
|
|
34655
|
-
// resultList,
|
|
34656
|
-
// meta,
|
|
34657
|
-
// {
|
|
34658
|
-
// uploadFullFrame: config.uploadFullFrame,
|
|
34659
|
-
// },
|
|
34660
|
-
// shouldEncrypt,
|
|
34661
|
-
// encryptDataBase64
|
|
34662
|
-
// )
|
|
34663
|
-
// );
|
|
34664
34643
|
await handleUpload(id, frameList, resultList, meta, config, shouldEncrypt, encryptDataBase64);
|
|
34665
|
-
|
|
34666
|
-
|
|
34667
|
-
|
|
34668
|
-
|
|
34669
|
-
|
|
34670
|
-
|
|
34671
|
-
|
|
34672
|
-
// }, 900);
|
|
34644
|
+
if (isSuccess) {
|
|
34645
|
+
// upload finish view
|
|
34646
|
+
util.uploadModal({
|
|
34647
|
+
type: 'success',
|
|
34648
|
+
titleSuccess: core.getTranslateInstance().translate('sdk.general.successUpload')
|
|
34649
|
+
});
|
|
34650
|
+
}
|
|
34673
34651
|
const result = await _this.getResult(id);
|
|
34674
|
-
return result.isPass;
|
|
34652
|
+
return isSuccess ? result.isPass : false;
|
|
34675
34653
|
},
|
|
34676
34654
|
onDestroy: async function () {
|
|
34677
34655
|
var _this$fasService2;
|
|
@@ -37344,7 +37322,7 @@ class AuthmeIdentityVerification extends engine.AuthmeFunctionModule {
|
|
|
37344
37322
|
}
|
|
37345
37323
|
|
|
37346
37324
|
var name = "authme/sdk";
|
|
37347
|
-
var version$1 = "2.8.
|
|
37325
|
+
var version$1 = "2.8.51";
|
|
37348
37326
|
var packageInfo = {
|
|
37349
37327
|
name: name,
|
|
37350
37328
|
version: version$1};
|
package/index.esm.js
CHANGED
|
@@ -29694,7 +29694,6 @@ async function startLiveness(config) {
|
|
|
29694
29694
|
sendFrame(canvasSizeInfo, canvas, uiComponentBasic.video, config.onFrame, livenessConfig.fasMaxFps, true, 'all', undefined, frameFlags), tap(({
|
|
29695
29695
|
result
|
|
29696
29696
|
}) => {
|
|
29697
|
-
// console.log('result', result);
|
|
29698
29697
|
applyTextByResult(result);
|
|
29699
29698
|
}),
|
|
29700
29699
|
// filter(
|
|
@@ -29723,20 +29722,14 @@ async function startLiveness(config) {
|
|
|
29723
29722
|
return Object.assign({}, data, {
|
|
29724
29723
|
isSuccess
|
|
29725
29724
|
});
|
|
29726
|
-
}))))), tap(
|
|
29727
|
-
|
|
29728
|
-
|
|
29729
|
-
|
|
29730
|
-
|
|
29731
|
-
|
|
29732
|
-
|
|
29733
|
-
|
|
29734
|
-
});
|
|
29735
|
-
} else {
|
|
29736
|
-
// Engine 返回 timeout 或其他失敗狀態
|
|
29737
|
-
throw new AuthmeError(ErrorCode.LIVENESS_NOT_PASSED);
|
|
29738
|
-
}
|
|
29739
|
-
}), filter(res => res.isSuccess), switchMap(() => defer(() => config.onSuccess())));
|
|
29725
|
+
}))))), tap(() => {
|
|
29726
|
+
sendStatusDescription$2(StatusDescription.UploadingStart);
|
|
29727
|
+
startSpinner({
|
|
29728
|
+
text: translateService.translate('sdk.general.uploading'),
|
|
29729
|
+
statement: translateService.translate('sdk.general.footer'),
|
|
29730
|
+
backgroundOpaque: true
|
|
29731
|
+
});
|
|
29732
|
+
}), switchMap(res => defer(() => config.onSuccess(res.isSuccess))));
|
|
29740
29733
|
return of({}).pipe(() => {
|
|
29741
29734
|
eventListenerService$2.start();
|
|
29742
29735
|
setStatusView$2(StatusView.Init);
|
|
@@ -34231,6 +34224,9 @@ class LivenessVerifyModule {
|
|
|
34231
34224
|
let id = '';
|
|
34232
34225
|
let frameWidth;
|
|
34233
34226
|
let frameHeight;
|
|
34227
|
+
// 保存 API 返回的參數,避免在 onStart 中被 setStage reinit 覆蓋
|
|
34228
|
+
let apiTimeoutSec;
|
|
34229
|
+
let apiFasThreshold;
|
|
34234
34230
|
try {
|
|
34235
34231
|
const result = await firstValueFrom(await startLiveness({
|
|
34236
34232
|
getOptionConfig: async function () {
|
|
@@ -34250,15 +34246,11 @@ class LivenessVerifyModule {
|
|
|
34250
34246
|
}
|
|
34251
34247
|
await _this.fasService.init();
|
|
34252
34248
|
const params = await _this.fasService.getParams();
|
|
34253
|
-
|
|
34254
|
-
|
|
34255
|
-
|
|
34256
|
-
|
|
34257
|
-
|
|
34258
|
-
// fTop: 0.3,
|
|
34259
|
-
// fRight: 0.7,
|
|
34260
|
-
// fBottom: 0.7,
|
|
34261
|
-
// };
|
|
34249
|
+
// 保存 API 參數,在 onStart 中 setStage reinit 後重新套用
|
|
34250
|
+
apiTimeoutSec = resp.parameters.fasTimeout || params.timeoutSec;
|
|
34251
|
+
apiFasThreshold = resp.parameters.fasThreshold || params.fFASTh;
|
|
34252
|
+
params.timeoutSec = apiTimeoutSec;
|
|
34253
|
+
params.fFASTh = apiFasThreshold;
|
|
34262
34254
|
await _this.fasService.setParams(params);
|
|
34263
34255
|
return resp.parameters;
|
|
34264
34256
|
} catch (e) {
|
|
@@ -34293,6 +34285,13 @@ class LivenessVerifyModule {
|
|
|
34293
34285
|
onStart: async function (canvasSizeInfoCan) {
|
|
34294
34286
|
frameWidth = canvasSizeInfoCan.canvasWidth;
|
|
34295
34287
|
frameHeight = canvasSizeInfoCan.canvasHeight;
|
|
34288
|
+
// 先 setStage(會 reinit FAS service),再 setParams,
|
|
34289
|
+
// 避免 setStage reinit 後重置已設定的 params
|
|
34290
|
+
if (config.active) {
|
|
34291
|
+
await _this.fasService.setStage([EAuthMeFASServiceStage.Passive, EAuthMeFASServiceStage.OpenMouth, EAuthMeFASServiceStage.CloseMouth]);
|
|
34292
|
+
} else {
|
|
34293
|
+
await _this.fasService.setStage([EAuthMeFASServiceStage.Passive]);
|
|
34294
|
+
}
|
|
34296
34295
|
const params = await _this.fasService.getParams();
|
|
34297
34296
|
const oldROI = params.faceROI;
|
|
34298
34297
|
const actualHight = frameHeight * (oldROI.fBottom - oldROI.fTop);
|
|
@@ -34305,12 +34304,10 @@ class LivenessVerifyModule {
|
|
|
34305
34304
|
params.faceROI.fLeft = (1 - widthPercent) / 2;
|
|
34306
34305
|
params.faceROI.fRight = 1 - (1 - widthPercent) / 2;
|
|
34307
34306
|
}
|
|
34307
|
+
// 保留 API 設定的 timeout 和 threshold,避免被 getParams() 的預設值覆蓋
|
|
34308
|
+
params.timeoutSec = apiTimeoutSec;
|
|
34309
|
+
params.fFASTh = apiFasThreshold;
|
|
34308
34310
|
await _this.fasService.setParams(params);
|
|
34309
|
-
if (config.active) {
|
|
34310
|
-
await _this.fasService.setStage([EAuthMeFASServiceStage.Passive, EAuthMeFASServiceStage.OpenMouth, EAuthMeFASServiceStage.CloseMouth]);
|
|
34311
|
-
} else {
|
|
34312
|
-
await _this.fasService.setStage([EAuthMeFASServiceStage.Passive]);
|
|
34313
|
-
}
|
|
34314
34311
|
await _this.fasService.startSession();
|
|
34315
34312
|
return params;
|
|
34316
34313
|
},
|
|
@@ -34537,21 +34534,16 @@ class LivenessModule {
|
|
|
34537
34534
|
await _this.fasService.setPublicKeyForJson('');
|
|
34538
34535
|
}
|
|
34539
34536
|
await _this.fasService.init();
|
|
34537
|
+
// 先 setStage(會 reinit FAS service),再 setParams,
|
|
34538
|
+
// 避免 setStage reinit 後重置已設定的 params
|
|
34539
|
+
await _this.fasService.setStage(resp.parameters.fasStages.map(x => `EAuthMeFASServiceStage_${x}`));
|
|
34540
34540
|
const params = await _this.fasService.getParams();
|
|
34541
|
-
// sample code for manually change faceROI when need. TonyQ@20230106
|
|
34542
|
-
// this.params.faceROI = {
|
|
34543
|
-
// fLeft: 0.3,
|
|
34544
|
-
// fTop: 0.3,
|
|
34545
|
-
// fRight: 0.7,
|
|
34546
|
-
// fBottom: 0.7,
|
|
34547
|
-
// };
|
|
34548
34541
|
// 保存 API 參數,在 onStart 中使用
|
|
34549
34542
|
apiTimeoutSec = resp.parameters.fasTimeout || params.timeoutSec;
|
|
34550
34543
|
apiFasThreshold = resp.parameters.fasThreshold || params.fFASTh;
|
|
34551
34544
|
params.timeoutSec = apiTimeoutSec;
|
|
34552
34545
|
params.fFASTh = apiFasThreshold;
|
|
34553
34546
|
await _this.fasService.setParams(params);
|
|
34554
|
-
await _this.fasService.setStage(resp.parameters.fasStages.map(x => `EAuthMeFASServiceStage_${x}`));
|
|
34555
34547
|
// return resp.parameters;
|
|
34556
34548
|
return resp;
|
|
34557
34549
|
},
|
|
@@ -34643,33 +34635,19 @@ class LivenessModule {
|
|
|
34643
34635
|
getSelectedImage: () => {
|
|
34644
34636
|
return selectedImage;
|
|
34645
34637
|
},
|
|
34646
|
-
onSuccess: async function () {
|
|
34638
|
+
onSuccess: async function (isSuccess) {
|
|
34647
34639
|
await _this.fasService.stop();
|
|
34648
34640
|
const meta = await _this.fasService.getReport();
|
|
34649
|
-
// await SendRequestWithRetry(() =>
|
|
34650
|
-
// this.postResult(
|
|
34651
|
-
// id,
|
|
34652
|
-
// frameList,
|
|
34653
|
-
// resultList,
|
|
34654
|
-
// meta,
|
|
34655
|
-
// {
|
|
34656
|
-
// uploadFullFrame: config.uploadFullFrame,
|
|
34657
|
-
// },
|
|
34658
|
-
// shouldEncrypt,
|
|
34659
|
-
// encryptDataBase64
|
|
34660
|
-
// )
|
|
34661
|
-
// );
|
|
34662
34641
|
await handleUpload(id, frameList, resultList, meta, config, shouldEncrypt, encryptDataBase64);
|
|
34663
|
-
|
|
34664
|
-
|
|
34665
|
-
|
|
34666
|
-
|
|
34667
|
-
|
|
34668
|
-
|
|
34669
|
-
|
|
34670
|
-
// }, 900);
|
|
34642
|
+
if (isSuccess) {
|
|
34643
|
+
// upload finish view
|
|
34644
|
+
uploadModal({
|
|
34645
|
+
type: 'success',
|
|
34646
|
+
titleSuccess: getTranslateInstance().translate('sdk.general.successUpload')
|
|
34647
|
+
});
|
|
34648
|
+
}
|
|
34671
34649
|
const result = await _this.getResult(id);
|
|
34672
|
-
return result.isPass;
|
|
34650
|
+
return isSuccess ? result.isPass : false;
|
|
34673
34651
|
},
|
|
34674
34652
|
onDestroy: async function () {
|
|
34675
34653
|
var _this$fasService2;
|
|
@@ -37342,7 +37320,7 @@ class AuthmeIdentityVerification extends AuthmeFunctionModule {
|
|
|
37342
37320
|
}
|
|
37343
37321
|
|
|
37344
37322
|
var name = "authme/sdk";
|
|
37345
|
-
var version$1 = "2.8.
|
|
37323
|
+
var version$1 = "2.8.51";
|
|
37346
37324
|
var packageInfo = {
|
|
37347
37325
|
name: name,
|
|
37348
37326
|
version: version$1};
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ export declare function startLiveness(config: {
|
|
|
12
12
|
}) => Promise<FasResult>;
|
|
13
13
|
setFrameSize: (width: number, height: number) => void;
|
|
14
14
|
getSelectedImage: () => Uint8Array | Uint8ClampedArray | null;
|
|
15
|
-
onSuccess: () => Promise<boolean>;
|
|
15
|
+
onSuccess: (isSuccess: boolean) => Promise<boolean>;
|
|
16
16
|
onDestroy: () => Promise<void>;
|
|
17
17
|
getNormalizedROI: () => Promise<{
|
|
18
18
|
width: number;
|
|
@@ -20,4 +20,4 @@ export declare function startLiveness(config: {
|
|
|
20
20
|
x: number;
|
|
21
21
|
y: number;
|
|
22
22
|
}>;
|
|
23
|
-
}): Promise<import("rxjs").Observable<
|
|
23
|
+
}): Promise<import("rxjs").Observable<boolean>>;
|