@authme/identity-verification 2.8.50 → 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.
Files changed (3) hide show
  1. package/index.cjs.js +22 -23
  2. package/index.esm.js +22 -23
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -34226,6 +34226,9 @@ class LivenessVerifyModule {
34226
34226
  let id = '';
34227
34227
  let frameWidth;
34228
34228
  let frameHeight;
34229
+ // 保存 API 返回的參數,避免在 onStart 中被 setStage reinit 覆蓋
34230
+ let apiTimeoutSec;
34231
+ let apiFasThreshold;
34229
34232
  try {
34230
34233
  const result = await rxjs.firstValueFrom(await startLiveness({
34231
34234
  getOptionConfig: async function () {
@@ -34245,15 +34248,11 @@ class LivenessVerifyModule {
34245
34248
  }
34246
34249
  await _this.fasService.init();
34247
34250
  const params = await _this.fasService.getParams();
34248
- params.timeoutSec = resp.parameters.fasTimeout || params.timeoutSec;
34249
- params.fFASTh = resp.parameters.fasThreshold || params.fFASTh;
34250
- // sample code for manually change faceROI when need. TonyQ@20230106
34251
- // this.params.faceROI = {
34252
- // fLeft: 0.3,
34253
- // fTop: 0.3,
34254
- // fRight: 0.7,
34255
- // fBottom: 0.7,
34256
- // };
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;
34257
34256
  await _this.fasService.setParams(params);
34258
34257
  return resp.parameters;
34259
34258
  } catch (e) {
@@ -34288,6 +34287,13 @@ class LivenessVerifyModule {
34288
34287
  onStart: async function (canvasSizeInfoCan) {
34289
34288
  frameWidth = canvasSizeInfoCan.canvasWidth;
34290
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
+ }
34291
34297
  const params = await _this.fasService.getParams();
34292
34298
  const oldROI = params.faceROI;
34293
34299
  const actualHight = frameHeight * (oldROI.fBottom - oldROI.fTop);
@@ -34300,12 +34306,10 @@ class LivenessVerifyModule {
34300
34306
  params.faceROI.fLeft = (1 - widthPercent) / 2;
34301
34307
  params.faceROI.fRight = 1 - (1 - widthPercent) / 2;
34302
34308
  }
34309
+ // 保留 API 設定的 timeout 和 threshold,避免被 getParams() 的預設值覆蓋
34310
+ params.timeoutSec = apiTimeoutSec;
34311
+ params.fFASTh = apiFasThreshold;
34303
34312
  await _this.fasService.setParams(params);
34304
- if (config.active) {
34305
- await _this.fasService.setStage([liveness.EAuthMeFASServiceStage.Passive, liveness.EAuthMeFASServiceStage.OpenMouth, liveness.EAuthMeFASServiceStage.CloseMouth]);
34306
- } else {
34307
- await _this.fasService.setStage([liveness.EAuthMeFASServiceStage.Passive]);
34308
- }
34309
34313
  await _this.fasService.startSession();
34310
34314
  return params;
34311
34315
  },
@@ -34532,21 +34536,16 @@ class LivenessModule {
34532
34536
  await _this.fasService.setPublicKeyForJson('');
34533
34537
  }
34534
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}`));
34535
34542
  const params = await _this.fasService.getParams();
34536
- // sample code for manually change faceROI when need. TonyQ@20230106
34537
- // this.params.faceROI = {
34538
- // fLeft: 0.3,
34539
- // fTop: 0.3,
34540
- // fRight: 0.7,
34541
- // fBottom: 0.7,
34542
- // };
34543
34543
  // 保存 API 參數,在 onStart 中使用
34544
34544
  apiTimeoutSec = resp.parameters.fasTimeout || params.timeoutSec;
34545
34545
  apiFasThreshold = resp.parameters.fasThreshold || params.fFASTh;
34546
34546
  params.timeoutSec = apiTimeoutSec;
34547
34547
  params.fFASTh = apiFasThreshold;
34548
34548
  await _this.fasService.setParams(params);
34549
- await _this.fasService.setStage(resp.parameters.fasStages.map(x => `EAuthMeFASServiceStage_${x}`));
34550
34549
  // return resp.parameters;
34551
34550
  return resp;
34552
34551
  },
@@ -37323,7 +37322,7 @@ class AuthmeIdentityVerification extends engine.AuthmeFunctionModule {
37323
37322
  }
37324
37323
 
37325
37324
  var name = "authme/sdk";
37326
- var version$1 = "2.8.50";
37325
+ var version$1 = "2.8.51";
37327
37326
  var packageInfo = {
37328
37327
  name: name,
37329
37328
  version: version$1};
package/index.esm.js CHANGED
@@ -34224,6 +34224,9 @@ class LivenessVerifyModule {
34224
34224
  let id = '';
34225
34225
  let frameWidth;
34226
34226
  let frameHeight;
34227
+ // 保存 API 返回的參數,避免在 onStart 中被 setStage reinit 覆蓋
34228
+ let apiTimeoutSec;
34229
+ let apiFasThreshold;
34227
34230
  try {
34228
34231
  const result = await firstValueFrom(await startLiveness({
34229
34232
  getOptionConfig: async function () {
@@ -34243,15 +34246,11 @@ class LivenessVerifyModule {
34243
34246
  }
34244
34247
  await _this.fasService.init();
34245
34248
  const params = await _this.fasService.getParams();
34246
- params.timeoutSec = resp.parameters.fasTimeout || params.timeoutSec;
34247
- params.fFASTh = resp.parameters.fasThreshold || params.fFASTh;
34248
- // sample code for manually change faceROI when need. TonyQ@20230106
34249
- // this.params.faceROI = {
34250
- // fLeft: 0.3,
34251
- // fTop: 0.3,
34252
- // fRight: 0.7,
34253
- // fBottom: 0.7,
34254
- // };
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;
34255
34254
  await _this.fasService.setParams(params);
34256
34255
  return resp.parameters;
34257
34256
  } catch (e) {
@@ -34286,6 +34285,13 @@ class LivenessVerifyModule {
34286
34285
  onStart: async function (canvasSizeInfoCan) {
34287
34286
  frameWidth = canvasSizeInfoCan.canvasWidth;
34288
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
+ }
34289
34295
  const params = await _this.fasService.getParams();
34290
34296
  const oldROI = params.faceROI;
34291
34297
  const actualHight = frameHeight * (oldROI.fBottom - oldROI.fTop);
@@ -34298,12 +34304,10 @@ class LivenessVerifyModule {
34298
34304
  params.faceROI.fLeft = (1 - widthPercent) / 2;
34299
34305
  params.faceROI.fRight = 1 - (1 - widthPercent) / 2;
34300
34306
  }
34307
+ // 保留 API 設定的 timeout 和 threshold,避免被 getParams() 的預設值覆蓋
34308
+ params.timeoutSec = apiTimeoutSec;
34309
+ params.fFASTh = apiFasThreshold;
34301
34310
  await _this.fasService.setParams(params);
34302
- if (config.active) {
34303
- await _this.fasService.setStage([EAuthMeFASServiceStage.Passive, EAuthMeFASServiceStage.OpenMouth, EAuthMeFASServiceStage.CloseMouth]);
34304
- } else {
34305
- await _this.fasService.setStage([EAuthMeFASServiceStage.Passive]);
34306
- }
34307
34311
  await _this.fasService.startSession();
34308
34312
  return params;
34309
34313
  },
@@ -34530,21 +34534,16 @@ class LivenessModule {
34530
34534
  await _this.fasService.setPublicKeyForJson('');
34531
34535
  }
34532
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}`));
34533
34540
  const params = await _this.fasService.getParams();
34534
- // sample code for manually change faceROI when need. TonyQ@20230106
34535
- // this.params.faceROI = {
34536
- // fLeft: 0.3,
34537
- // fTop: 0.3,
34538
- // fRight: 0.7,
34539
- // fBottom: 0.7,
34540
- // };
34541
34541
  // 保存 API 參數,在 onStart 中使用
34542
34542
  apiTimeoutSec = resp.parameters.fasTimeout || params.timeoutSec;
34543
34543
  apiFasThreshold = resp.parameters.fasThreshold || params.fFASTh;
34544
34544
  params.timeoutSec = apiTimeoutSec;
34545
34545
  params.fFASTh = apiFasThreshold;
34546
34546
  await _this.fasService.setParams(params);
34547
- await _this.fasService.setStage(resp.parameters.fasStages.map(x => `EAuthMeFASServiceStage_${x}`));
34548
34547
  // return resp.parameters;
34549
34548
  return resp;
34550
34549
  },
@@ -37321,7 +37320,7 @@ class AuthmeIdentityVerification extends AuthmeFunctionModule {
37321
37320
  }
37322
37321
 
37323
37322
  var name = "authme/sdk";
37324
- var version$1 = "2.8.50";
37323
+ var version$1 = "2.8.51";
37325
37324
  var packageInfo = {
37326
37325
  name: name,
37327
37326
  version: version$1};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authme/identity-verification",
3
- "version": "2.8.50",
3
+ "version": "2.8.51",
4
4
  "peerDependencies": {
5
5
  "core-js": "^3.6.0",
6
6
  "lottie-web": "^5.9.2",