diff --git a/entry/src/main/ets/model/TrustedAuthentication.ets b/entry/src/main/ets/model/TrustedAuthentication.ets index a86dfc6de6e5e2d9f0469e1a44f559a6bf5ddfec..123fd8e8b7c222cb1a5252003ebea19108850d94 100644 --- a/entry/src/main/ets/model/TrustedAuthentication.ets +++ b/entry/src/main/ets/model/TrustedAuthentication.ets @@ -255,7 +255,7 @@ class TrustedAuth { const buffer: ArrayBuffer = await this.ImportImage(); const label: trustedAuthentication.TUILable = { image: buffer, - title: context.resourceManager.getStringSync($r('app.string.ShieldPwVerification')) + title: context.resourceManager.getStringSync($r('app.string.ShieldPwVerification').id) } const result = await trustedAuthentication.trustedAuthentication(challenge, credentialID, label); hilog.info(DOMAIN, 'testTag', 'DigitalShield password verification success:', result.authToken.length, @@ -279,7 +279,7 @@ class TrustedAuth { const buffer: ArrayBuffer = await this.ImportImage(); const label: trustedAuthentication.TUILable = { image: buffer, - title: context.resourceManager.getStringSync($r('app.string.OpenShield')) + title: context.resourceManager.getStringSync($r('app.string.OpenShield').id) } const authInfo = await trustedAuthentication.enableTrustedAuthentication(challenge, passwordInfo, label); let assetLabel = assetName + 'label'; @@ -305,7 +305,7 @@ class TrustedAuth { const buffer: ArrayBuffer = await this.ImportImage(); const label: trustedAuthentication.TUILable = { image: buffer, - title: context.resourceManager.getStringSync($r('app.string.OpenShield')) + title: context.resourceManager.getStringSync($r('app.string.OpenShield').id) } const authInfo = await trustedAuthentication.enableTrustedAuthentication(challenge, passwordInfo, label); let assetLabel = assetName + 'label'; @@ -333,7 +333,7 @@ class TrustedAuth { const buffer: ArrayBuffer = await this.ImportImage(); const label: trustedAuthentication.TUILable = { image: buffer, - title: context.resourceManager.getStringSync($r('app.string.ModifyShield')) + title: context.resourceManager.getStringSync($r('app.string.ModifyShield').id) } const authInfo = await trustedAuthentication.modifyTrustedAuthenticationPwd(challenge, passwordInfo, credentialID, label); @@ -359,7 +359,7 @@ class TrustedAuth { const buffer: ArrayBuffer = await this.ImportImage(); const label: trustedAuthentication.TUILable = { image: buffer, - title: context.resourceManager.getStringSync($r('app.string.ModifyShield')) + title: context.resourceManager.getStringSync($r('app.string.ModifyShield').id) } const authInfo = await trustedAuthentication.modifyTrustedAuthenticationPwd(challenge, passwordInfo, credentialID, label); @@ -379,7 +379,7 @@ class TrustedAuth { const buffer: ArrayBuffer = await this.ImportImage(); const label: trustedAuthentication.TUILable = { image: buffer, - title: context.resourceManager.getStringSync($r('app.string.CloseShield')) + title: context.resourceManager.getStringSync($r('app.string.CloseShield').id) } const authInfo = await trustedAuthentication.disableTrustedAuthentication(challenge, true, credentialID, label); AssetUtils.DeleteDataFromAssetStore('pin_label1'); @@ -432,7 +432,7 @@ class TrustedAuth { } const label: trustedAuthentication.TUILable = { image: buffer, - title: context.resourceManager.getStringSync($r('app.string.FaceVerification')) + title: context.resourceManager.getStringSync($r('app.string.FaceVerification').id) } const result = await trustedAuthentication.procContentAuthentication(challenge, credentialID, reqParams, label); hilog.info(DOMAIN, 'testTag', 'Face Verification Success:', result.authToken); @@ -459,7 +459,7 @@ class TrustedAuth { } const label: trustedAuthentication.TUILable = { image: buffer, - title: context.resourceManager.getStringSync($r('app.string.FingerprintVerification')) + title: context.resourceManager.getStringSync($r('app.string.FingerprintVerification').id) } const result = await trustedAuthentication.procContentAuthentication(challenge, credentialID, reqParams, label); hilog.info(DOMAIN, 'testTag', 'Fingerprint Verification Success:', result.authToken); @@ -483,7 +483,7 @@ class TrustedAuth { } const label: trustedAuthentication.TUILable = { image: buffer, - title: context.resourceManager.getStringSync($r('app.string.PINVerification')) + title: context.resourceManager.getStringSync($r('app.string.PINVerification').id) } const result = await trustedAuthentication.procContentAuthentication(challenge, credentialID, reqParams, label); hilog.info(DOMAIN, 'testTag', 'Pin Verification Success:', result.authToken); diff --git a/entry/src/main/ets/pages/MainPage.ets b/entry/src/main/ets/pages/MainPage.ets index c53e05ae80edfc3911bb23bd0fb2f5daecef59b3..aa055f7e211709d6b5a0d10e1af108ed7c25206e 100644 --- a/entry/src/main/ets/pages/MainPage.ets +++ b/entry/src/main/ets/pages/MainPage.ets @@ -183,13 +183,13 @@ export struct MainPage { hilog.info(DOMAIN, 'testTag', 'Finish Signature Initialization'); let indata: string = 'placeholder'; await TrustedAuth.UserAuthTUIPINBeforeSign(indata, session, TUI_PIN_DISABLE, 'pin_label1'); - this.message += this.resourceManager.getStringSync($r('app.string.CloseShieldSuccess')); + this.message += this.resourceManager.getStringSync($r('app.string.CloseShieldSuccess').id); this.hasShield = false; this.fingerprintBind = false; this.faceBind = false; } catch (error) { hilog.error(DOMAIN, 'testTag', 'Close Shield Fail:', error); - this.message += this.resourceManager.getStringSync($r('app.string.CloseShieldFail')) + + this.message += this.resourceManager.getStringSync($r('app.string.CloseShieldFail').id) + `: ${error}`; } this.promptAction.openToast({ @@ -218,13 +218,13 @@ export struct MainPage { const challenge: Uint8Array = rand?.generateRandomSync(len)?.data; const authToken = await TrustedAuth.disablePwdWithoutAuth(challenge, 'pin_label1'); hilog.info(DOMAIN, 'testTag', 'Close Shield Success:', authToken); - this.message += this.resourceManager.getStringSync($r('app.string.CloseShieldSuccess')); + this.message += this.resourceManager.getStringSync($r('app.string.CloseShieldSuccess').id); this.hasShield = false; this.fingerprintBind = false; this.faceBind = false; } catch (error) { hilog.error(DOMAIN, 'testTag', 'Close Shield Fail:', error); - this.message += this.resourceManager.getStringSync($r('app.string.CloseShieldFail')) + + this.message += this.resourceManager.getStringSync($r('app.string.CloseShieldFail').id) + `: ${error}`; } this.promptAction.openToast({ @@ -287,14 +287,14 @@ export struct MainPage { await trustedAuthentication.getBiometricAuthToken(operType, tuiAuthToken, bioAuthToken); let inputdata = 'placeholder'; await TrustedAuth.bindFingerID(session.handle, resignAuthToken.authToken, inputdata) - this.message += this.resourceManager.getStringSync($r('app.string.BindFingerprintSuccess')); + this.message += this.resourceManager.getStringSync($r('app.string.BindFingerprintSuccess').id); this.fingerprintBind = true; } catch (error) { hilog.error(DOMAIN, 'testTag', 'Bind Fingerprint Fail:', error); if (error.message === 'Authentication template has not been enrolled.') { - this.message += this.resourceManager.getStringSync($r('app.string.BindFingerprintFailWithNotification')); + this.message += this.resourceManager.getStringSync($r('app.string.BindFingerprintFailWithNotification').id); } else { - this.message += this.resourceManager.getStringSync($r('app.string.BindFingerprintFail')) + + this.message += this.resourceManager.getStringSync($r('app.string.BindFingerprintFail').id) + `: ${error}`; } } @@ -320,12 +320,12 @@ export struct MainPage { try { let authType = trustedAuthentication.AuthType.AUTH_TYPE_FINGERPRINT; await TrustedAuth.disableTrustedBioAuthentication('pin_label1', authType); - this.message += this.resourceManager.getStringSync($r('app.string.UnBoundFingerprintSuccess')); + this.message += this.resourceManager.getStringSync($r('app.string.UnBoundFingerprintSuccess').id); this.fingerprintBind = false; } catch (error) { // 捕获错误并处理 hilog.error(DOMAIN, 'testTag', 'UnBound Fingerprint Fail:', error); - this.message += this.resourceManager.getStringSync($r('app.string.UnBoundFingerprintFail')) + + this.message += this.resourceManager.getStringSync($r('app.string.UnBoundFingerprintFail').id) + `: ${error}`; } this.promptAction.openToast({ @@ -364,14 +364,14 @@ export struct MainPage { await trustedAuthentication.getBiometricAuthToken(operType, tuiAuthToken, bioAuthToken); let inputdata = 'placeholder'; await TrustedAuth.bindFaceID(session.handle, resignAuthToken.authToken, inputdata) - this.message += this.resourceManager.getStringSync($r('app.string.BindFaceSuccess')); + this.message += this.resourceManager.getStringSync($r('app.string.BindFaceSuccess').id); this.faceBind = true; } catch (error) { hilog.error(DOMAIN, 'testTag', 'Bind Face Fail:', error); if (error.message === 'Authentication template has not been enrolled.') { - this.message += this.resourceManager.getStringSync($r('app.string.BindFaceFailWithNotification')) + this.message += this.resourceManager.getStringSync($r('app.string.BindFaceFailWithNotification').id) } else { - this.message += this.resourceManager.getStringSync($r('app.string.BindFaceFail')) + + this.message += this.resourceManager.getStringSync($r('app.string.BindFaceFail').id) + ` : ${error}`; } } @@ -396,12 +396,12 @@ export struct MainPage { try { let authType = trustedAuthentication.AuthType.AUTH_TYPE_FACE; await TrustedAuth.disableTrustedBioAuthentication('pin_label1', authType); - this.message += this.resourceManager.getStringSync($r('app.string.UnBoundFaceSuccess')); + this.message += this.resourceManager.getStringSync($r('app.string.UnBoundFaceSuccess').id); this.faceBind = false; } catch (error) { // 捕获错误并处理 hilog.error(DOMAIN, 'testTag', 'UnBound Face Fail:', error); - this.message += this.resourceManager.getStringSync($r('app.string.UnBoundFaceFail')) + + this.message += this.resourceManager.getStringSync($r('app.string.UnBoundFaceFail').id) + `: ${error}`; } this.promptAction.openToast({ diff --git a/entry/src/main/ets/pages/PasswordSelectionPage.ets b/entry/src/main/ets/pages/PasswordSelectionPage.ets index 21b9fcd97a2dc6c366153073658604b1bb395185..0d5b4c226989d37918bbfe54d57bfa007d152e87 100644 --- a/entry/src/main/ets/pages/PasswordSelectionPage.ets +++ b/entry/src/main/ets/pages/PasswordSelectionPage.ets @@ -102,12 +102,12 @@ export struct PasswordSelectionPage { hilog.info(DOMAIN, 'testTag', 'Signature Initialization success'); let indata: string = 'placeholder'; await TrustedAuth.UserAuthTUIPINBeforeSign(indata, session, this.type, 'pin_label1'); - this.message += this.resourceManager.getStringSync($r('app.string.ModifyPwSuccess')); + this.message += this.resourceManager.getStringSync($r('app.string.ModifyPwSuccess').id); this.hasShield = true; } catch (error) { // catch error hilog.error(DOMAIN, 'testTag', 'Modify Pw Fail:', error); - this.message += this.resourceManager.getStringSync($r('app.string.ModifyPwFail')) + `: ${error}`; + this.message += this.resourceManager.getStringSync($r('app.string.ModifyPwFail').id) + `: ${error}`; } this.promptAction.openToast({ message: this.message, @@ -132,12 +132,12 @@ export struct PasswordSelectionPage { hilog.info(DOMAIN, 'testTag', 'Signature Initialization success'); let indata: string = 'placeholder'; await TrustedAuth.UserAuthTUIPINBeforeSign(indata, session, this.type, 'pin_label1'); - this.message += this.resourceManager.getStringSync($r('app.string.OpenShieldSuccess')); + this.message += this.resourceManager.getStringSync($r('app.string.OpenShieldSuccess').id); this.hasShield = true; } catch (error) { // catch error hilog.error(DOMAIN, 'testTag', 'OpenShield Fail:', error); - this.message += this.resourceManager.getStringSync($r('app.string.OpenShieldFail')) + `: ${error}`; + this.message += this.resourceManager.getStringSync($r('app.string.OpenShieldFail').id) + `: ${error}`; } this.promptAction.openToast({ message: this.message, diff --git a/entry/src/main/ets/pages/TradingPage.ets b/entry/src/main/ets/pages/TradingPage.ets index 7e1c3b94ceaf2e20dfbb55bcaeff37345ede66cf..4b21a2e5b19b7cc423caa5050961356c0b0911d5 100644 --- a/entry/src/main/ets/pages/TradingPage.ets +++ b/entry/src/main/ets/pages/TradingPage.ets @@ -57,14 +57,14 @@ export struct BindSheetTemp { let session = await TrustedAuth.SignInit(); hilog.info(DOMAIN, 'testTag', 'Signature Initialization success'); let indata: string = - this.resourceManager.getStringSync($r('app.string.Recipient')) + ':' + this.receiver + '\n' + - this.resourceManager.getStringSync($r('app.string.AccountNumber')) + ':' + this.receiveAccount + '\n' + - this.resourceManager.getStringSync($r('app.string.TradingAmount')) + ':' + this.tradingAmount; + this.resourceManager.getStringSync($r('app.string.Recipient').id) + ':' + this.receiver + '\n' + + this.resourceManager.getStringSync($r('app.string.AccountNumber').id) + ':' + this.receiveAccount + '\n' + + this.resourceManager.getStringSync($r('app.string.TradingAmount').id) + ':' + this.tradingAmount; await TrustedAuth.UserAuthTUIPINBeforeSign(indata, session, TUI_CONTENT_PWD_VERIFY, 'pin_label1'); - this.message += this.resourceManager.getStringSync($r('app.string.PINVerificationSuccess')); + this.message += this.resourceManager.getStringSync($r('app.string.PINVerificationSuccess').id); } catch (error) { hilog.error(DOMAIN, 'testTag', 'PIN Verification Fail:', error); - this.message += this.resourceManager.getStringSync($r('app.string.PINVerificationFail')) + `: ${error}`; + this.message += this.resourceManager.getStringSync($r('app.string.PINVerificationFail').id) + `: ${error}`; } this.promptAction.openToast({ message: this.message, @@ -83,9 +83,9 @@ export struct BindSheetTemp { let session = await TrustedAuth.SignInit(); hilog.info(DOMAIN, 'testTag', 'Signature Initialization success'); let indata: string = - this.resourceManager.getStringSync($r('app.string.Recipient')) + ':' + this.receiver + '\n' + - this.resourceManager.getStringSync($r('app.string.AccountNumber')) + ':' + this.receiveAccount + '\n' + - this.resourceManager.getStringSync($r('app.string.TradingAmount')) + ':' + this.tradingAmount; + this.resourceManager.getStringSync($r('app.string.Recipient').id) + ':' + this.receiver + '\n' + + this.resourceManager.getStringSync($r('app.string.AccountNumber').id) + ':' + this.receiveAccount + '\n' + + this.resourceManager.getStringSync($r('app.string.TradingAmount').id) + ':' + this.tradingAmount; const tuiAuthToken: Uint8Array = await TrustedAuth.GetTUIAuthTokenBeforeBioVerify(indata, session, TUI_CONTENT_FINGERPRINT_VERIFY, 'pin_label1'); let bioAuthToken: Uint8Array = @@ -94,13 +94,13 @@ export struct BindSheetTemp { let resignAuthToken = await trustedAuthentication.getBiometricAuthToken(operType, tuiAuthToken, bioAuthToken); await TrustedAuth.HuksSignAndVerify(indata, session, resignAuthToken.authToken) - this.message += this.resourceManager.getStringSync($r('app.string.FingerprintVerificationSuccess')); + this.message += this.resourceManager.getStringSync($r('app.string.FingerprintVerificationSuccess').id); } catch (error) { hilog.error(DOMAIN, 'testTag', 'Fingerprint Verification Fail:', error); if (error.code === 1019100019) { - this.message += this.resourceManager.getStringSync($r('app.string.FingerprintVerificationFailWithNotification')); + this.message += this.resourceManager.getStringSync($r('app.string.FingerprintVerificationFailWithNotification').id); } else { - this.message += this.resourceManager.getStringSync($r('app.string.FingerprintVerificationFail')) + + this.message += this.resourceManager.getStringSync($r('app.string.FingerprintVerificationFail').id) + `: ${error}`; } } @@ -122,9 +122,9 @@ export struct BindSheetTemp { let session = await TrustedAuth.SignInit(); hilog.info(DOMAIN, 'testTag', 'Signature Initialization success'); let indata: string = - this.resourceManager.getStringSync($r('app.string.Recipient')) + ':' + this.receiver + '\n' + - this.resourceManager.getStringSync($r('app.string.AccountNumber')) + ':' + this.receiveAccount + '\n' + - this.resourceManager.getStringSync($r('app.string.TradingAmount')) + ':' + this.tradingAmount; + this.resourceManager.getStringSync($r('app.string.Recipient').id) + ':' + this.receiver + '\n' + + this.resourceManager.getStringSync($r('app.string.AccountNumber').id) + ':' + this.receiveAccount + '\n' + + this.resourceManager.getStringSync($r('app.string.TradingAmount').id) + ':' + this.tradingAmount; const tuiAuthToken: Uint8Array = await TrustedAuth.GetTUIAuthTokenBeforeBioVerify(indata, session, TUI_CONTENT_FACE_VERIFY, 'pin_label1'); let bioAuthToken: Uint8Array = @@ -133,13 +133,13 @@ export struct BindSheetTemp { let resignAuthToken = await trustedAuthentication.getBiometricAuthToken(operType, tuiAuthToken, bioAuthToken); await TrustedAuth.HuksSignAndVerify(indata, session, resignAuthToken.authToken) - this.message += this.resourceManager.getStringSync($r('app.string.FaceVerificationSuccess')); + this.message += this.resourceManager.getStringSync($r('app.string.FaceVerificationSuccess').id); } catch (error) { hilog.error(DOMAIN, 'testTag', 'Face Verification Fail:', error); if (error.code === 1019100019) { - this.message += this.resourceManager.getStringSync($r('app.string.FaceVerificationFailWithNotification')); + this.message += this.resourceManager.getStringSync($r('app.string.FaceVerificationFailWithNotification').id); } else { - this.message += this.resourceManager.getStringSync($r('app.string.FaceVerificationFail')) + + this.message += this.resourceManager.getStringSync($r('app.string.FaceVerificationFail').id) + `: ${error}`; } }