From df5ebbbb8a60211d2227f8bf7a574e6c0d342fb1 Mon Sep 17 00:00:00 2001 From: hid21342512 Date: Fri, 15 Aug 2025 16:56:12 +0800 Subject: [PATCH 1/2] code review fix 2 --- README.md | 2 +- .../main/ets/model/TrustedAuthentication.ets | 113 ++++++----- entry/src/main/ets/pages/Index.ets | 1 + entry/src/main/ets/pages/MainPage.ets | 129 ++++++++----- .../main/ets/pages/PasswordSelectionPage.ets | 29 +-- entry/src/main/ets/pages/TradingPage.ets | 178 +++++++++++------- .../main/resources/base/element/string.json | 2 +- 7 files changed, 283 insertions(+), 171 deletions(-) diff --git a/README.md b/README.md index a7e61fe..85de618 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ 3. User Authentication Kit (用户认证服务) ## 约束与限制 -1. 本示例仅支持标准系统上运行,支持设备:手机。 +1. 本示例仅支持标准系统上运行,支持设备:华为手机。 2. HarmonyOS系统:HarmonyOS 6.0 Beta3及以上。 3. DevEco Studio版本:DevEco Studio 6.0 Beta3及以上。 4. HarmonyOS SDK版本:HarmonyOS 6.0 Bete3 SDK及以上。 diff --git a/entry/src/main/ets/model/TrustedAuthentication.ets b/entry/src/main/ets/model/TrustedAuthentication.ets index 30fcb2c..c830ae9 100644 --- a/entry/src/main/ets/model/TrustedAuthentication.ets +++ b/entry/src/main/ets/model/TrustedAuthentication.ets @@ -223,12 +223,25 @@ class TrustedAuth { hilog.info(DOMAIN, 'testTag', 'credentialId', credentialID); hilog.info(DOMAIN, 'testTag', 'checkHash', checkHash); hilog.info(DOMAIN, 'testTag', 'authType', authType); - await AssetUtils.AddDataToAssetStore(credentialID, 'face_credentialID', 'face_credential_label'); + AssetUtils.AddDataToAssetStore(credentialID, 'face_credentialID', 'face_credential_label'); + } + + async bindFingerID(handle: number, authToken: Uint8Array, inputdata: string): Promise { + let signature = await SignFinish(handle, authToken, inputdata); + await Verify(inputdata, signature); + let appendInfo = signature.subarray(0, 42); + let credentialID = appendInfo.subarray(8, 40); + let checkHash = appendInfo.subarray(40, 41); + let authType = appendInfo.subarray(4, 8); + hilog.info(DOMAIN, 'testTag', 'credentialId', credentialID); + hilog.info(DOMAIN, 'testTag', 'checkHash', checkHash); + hilog.info(DOMAIN, 'testTag', 'authType', authType); + AssetUtils.AddDataToAssetStore(credentialID, 'finger_credentialID', 'finger_credential_label'); } async ImportImage(): Promise { try { - const context = getContext(this); + const context = AppStorage.get('context') as Context; const resourceMgr: resourceManager.ResourceManager = context.resourceManager; const fileData: Uint8Array = await resourceMgr.getRawFileContent('startIcon.png'); @@ -246,13 +259,15 @@ class TrustedAuth { try { let resArray: Uint8Array = await AssetUtils.QueryDataFromAssetStore(assetName); let credentialID: bigint = this.uint8ArrayToBigInt(resArray); + const context = AppStorage.get('context') as Context; const buffer: ArrayBuffer = await this.ImportImage(); const label: trustedAuthentication.TUILable = { image: buffer, - title: $r('app.string.ShieldPwVerification') + title: context.resourceManager.getStringSync($r('app.string.ShieldPwVerification')) } const result = await trustedAuthentication.trustedAuthentication(challenge, credentialID, label); - hilog.info(DOMAIN, 'testTag', 'DigitalShield password verification success:', result.authToken.length, result.authToken); + hilog.info(DOMAIN, 'testTag', 'DigitalShield password verification success:', result.authToken.length, + result.authToken); return result; } catch (error) { hilog.error(DOMAIN, 'testTag', 'DigitalShield password verification failed:', error); @@ -268,15 +283,17 @@ class TrustedAuth { pwdMinLength: 6, maxAuthFailCount: 6 }; + const context = AppStorage.get('context') as Context; const buffer: ArrayBuffer = await this.ImportImage(); const label: trustedAuthentication.TUILable = { image: buffer, - title: $r('app.string.OpenShield') + title: context.resourceManager.getStringSync($r('app.string.OpenShield')) } const authInfo = await trustedAuthentication.enableTrustedAuthentication(challenge, passwordInfo, label); let assetLabel = assetName + 'label'; - await AssetUtils.AddDataToAssetStore(this.bigIntToUint8Array(authInfo.authID), assetName, assetLabel); - hilog.info(DOMAIN, 'testTag', 'Open Shield Success:', authInfo.authID, authInfo.authToken.length, authInfo.authToken); + AssetUtils.AddDataToAssetStore(this.bigIntToUint8Array(authInfo.authID), assetName, assetLabel); + hilog.info(DOMAIN, 'testTag', 'Open Shield Success:', authInfo.authID, authInfo.authToken.length, + authInfo.authToken); return authInfo; } catch (error) { hilog.error(DOMAIN, 'testTag', 'Open Shield Fail:', error); @@ -292,15 +309,17 @@ class TrustedAuth { pwdMinLength: 6, maxAuthFailCount: 6 }; + const context = AppStorage.get('context') as Context; const buffer: ArrayBuffer = await this.ImportImage(); const label: trustedAuthentication.TUILable = { image: buffer, - title: $r('app.string.OpenShield') + title: context.resourceManager.getStringSync($r('app.string.OpenShield')) } const authInfo = await trustedAuthentication.enableTrustedAuthentication(challenge, passwordInfo, label); let assetLabel = assetName + 'label'; - await AssetUtils.AddDataToAssetStore(this.bigIntToUint8Array(authInfo.authID), assetName, assetLabel); - hilog.info(DOMAIN, 'testTag', 'Open Shield Success:', authInfo.authID, authInfo.authToken.length, authInfo.authToken); + AssetUtils.AddDataToAssetStore(this.bigIntToUint8Array(authInfo.authID), assetName, assetLabel); + hilog.info(DOMAIN, 'testTag', 'Open Shield Success:', authInfo.authID, authInfo.authToken.length, + authInfo.authToken); return authInfo; } catch (error) { hilog.error(DOMAIN, 'testTag', 'Open Shield Fail:', error); @@ -318,10 +337,11 @@ class TrustedAuth { }; let resArray: Uint8Array = await AssetUtils.QueryDataFromAssetStore(assetName); let credentialID: bigint = this.uint8ArrayToBigInt(resArray); + const context = AppStorage.get('context') as Context; const buffer: ArrayBuffer = await this.ImportImage(); const label: trustedAuthentication.TUILable = { image: buffer, - title: $r('app.string.ModifyShield') + title: context.resourceManager.getStringSync($r('app.string.ModifyShield')) } const authInfo = await trustedAuthentication.modifyTrustedAuthenticationPwd(challenge, passwordInfo, credentialID, label); @@ -343,10 +363,11 @@ class TrustedAuth { }; let resArray: Uint8Array = await AssetUtils.QueryDataFromAssetStore(assetName); let credentialID: bigint = this.uint8ArrayToBigInt(resArray); + const context = AppStorage.get('context') as Context; const buffer: ArrayBuffer = await this.ImportImage(); const label: trustedAuthentication.TUILable = { image: buffer, - title: $r('app.string.ModifyShield') + title: context.resourceManager.getStringSync($r('app.string.ModifyShield')) } const authInfo = await trustedAuthentication.modifyTrustedAuthenticationPwd(challenge, passwordInfo, credentialID, label); @@ -362,10 +383,11 @@ class TrustedAuth { try { let resArray: Uint8Array = await AssetUtils.QueryDataFromAssetStore(assetName); let credentialID: bigint = this.uint8ArrayToBigInt(resArray); + const context = AppStorage.get('context') as Context; const buffer: ArrayBuffer = await this.ImportImage(); const label: trustedAuthentication.TUILable = { image: buffer, - title: $r('app.string.CloseShield') + title: context.resourceManager.getStringSync($r('app.string.CloseShield')) } const authInfo = await trustedAuthentication.disableTrustedAuthentication(challenge, true, credentialID, label); AssetUtils.DeleteDataFromAssetStore('pin_label1'); @@ -393,7 +415,7 @@ class TrustedAuth { AssetUtils.DeleteDataFromAssetStore('pin_label1'); AssetUtils.DeleteDataFromAssetStore('credentialID'); AssetUtils.DeleteDataFromAssetStore('face_credentialID'); - AssetUtils.DeleteDataFromAssetStore('finger+credentialID'); + AssetUtils.DeleteDataFromAssetStore('finger_credentialID'); hilog.info(DOMAIN, 'testTag', 'Close Shield Success:', authInfo.authToken); return authInfo.authToken; } catch (error) { @@ -402,22 +424,23 @@ class TrustedAuth { } } - async FaceAuthContent(challenge: Uint8Array, assetName: string): Promise { + async FaceAuthContent(indata: string, challenge: Uint8Array, + assetName: string): Promise { try { let enrolledState = userAuth.getEnrolledState(userAuth.UserAuthType.FACE); hilog.info(DOMAIN, 'testTag', `get current enrolled state success enrolledState = ${JSON.stringify(enrolledState)}`); let resArray: Uint8Array = await AssetUtils.QueryDataFromAssetStore(assetName); let credentialID: bigint = this.uint8ArrayToBigInt(resArray); + const context = AppStorage.get('context') as Context; const buffer: ArrayBuffer = await this.ImportImage(); const reqParams: trustedAuthentication.AuthReqParams = { reqType: trustedAuthentication.AuthType.AUTH_TYPE_FACE, - authContent: ['challenge:123456|0', '用户:张家龙|1', '账号:123456|1', '交易金额: 10000000|2', - '交易时间:2025-0605|2'] + authContent: indata.split('\n') } const label: trustedAuthentication.TUILable = { image: buffer, - title: $r('app.string.FaceVerification') + title: context.resourceManager.getStringSync($r('app.string.FaceVerification')) } const result = await trustedAuthentication.procContentAuthentication(challenge, credentialID, reqParams, label); hilog.info(DOMAIN, 'testTag', 'Face Verification Success:', result.authToken); @@ -428,22 +451,23 @@ class TrustedAuth { } } - async FingerPrintAuthContent(challenge: Uint8Array, assetName: string): Promise { + async FingerPrintAuthContent(indata: string, challenge: Uint8Array, + assetName: string): Promise { try { let enrolledState = userAuth.getEnrolledState(userAuth.UserAuthType.FINGERPRINT); hilog.info(DOMAIN, 'testTag', `get current enrolled state success enrolledState = ${JSON.stringify(enrolledState)}`); let resArray: Uint8Array = await AssetUtils.QueryDataFromAssetStore(assetName); let credentialID: bigint = this.uint8ArrayToBigInt(resArray); + const context = AppStorage.get('context') as Context; const buffer: ArrayBuffer = await this.ImportImage(); const reqParams: trustedAuthentication.AuthReqParams = { reqType: trustedAuthentication.AuthType.AUTH_TYPE_FINGERPRINT, - authContent: ['challenge:123456|0', '用户:张家龙|1', '账号:123456|1', '交易金额: 10000000|2', - '交易时间:2025-0605|2'] + authContent: indata.split('\n') } const label: trustedAuthentication.TUILable = { image: buffer, - title: $r('app.string.FingerprintVerification') + title: context.resourceManager.getStringSync($r('app.string.FingerprintVerification')) } const result = await trustedAuthentication.procContentAuthentication(challenge, credentialID, reqParams, label); hilog.info(DOMAIN, 'testTag', 'Fingerprint Verification Success:', result.authToken); @@ -454,19 +478,20 @@ class TrustedAuth { } } - async ContentVerifyByPwd(challenge: Uint8Array, assetName: string): Promise { + async ContentVerifyByPwd(indata: string, challenge: Uint8Array, + assetName: string): Promise { try { let resArray: Uint8Array = await AssetUtils.QueryDataFromAssetStore(assetName); let credentialID: bigint = this.uint8ArrayToBigInt(resArray); + const context = AppStorage.get('context') as Context; const buffer: ArrayBuffer = await this.ImportImage(); const reqParams: trustedAuthentication.AuthReqParams = { reqType: trustedAuthentication.AuthType.AUTH_TYPE_TUI_PIN, - authContent: ['challenge:123456|0', '用户:张家龙|1', '账号:123456|1', '交易金额: 10000000|2', - '交易时间:2025-0605|2'] + authContent: indata.split('\n') } const label: trustedAuthentication.TUILable = { image: buffer, - title: $r('app.string.PINVerification') + title: context.resourceManager.getStringSync($r('app.string.PINVerification')) } const result = await trustedAuthentication.procContentAuthentication(challenge, credentialID, reqParams, label); hilog.info(DOMAIN, 'testTag', 'Pin Verification Success:', result.authToken); @@ -518,11 +543,16 @@ class TrustedAuth { inData: new Uint8Array } - let result = await huks.initSession(KEY_ALIAS, options); - let handle = result.handle; - let challenge = result.challenge as Uint8Array - hilog.info(DOMAIN, 'testTag', 'initSession complete' + handle + '----' + challenge); - return result; + try { + let result = await huks.initSession(KEY_ALIAS, options); + let handle = result.handle; + let challenge = result.challenge as Uint8Array + hilog.info(DOMAIN, 'testTag', 'initSession complete' + handle + '----' + challenge); + return result; + } catch (error) { + hilog.error(DOMAIN, 'testTag', 'initSession failed'); + throw new Error('initSession fail' + (error as BusinessError).message); + } } async disableTrustedBioAuthentication(assetName: string, authType: number): Promise { @@ -537,11 +567,10 @@ class TrustedAuth { } } - async HuksSignAndVerify(session: huks.HuksSessionHandle, authToken: Uint8Array): Promise { - let inputdata = 'challenge:123456|0\n用户:张家龙|1\n账号:123456|1\n交易金额: 10000000|2\n交易时间:2025-0605|2'; + async HuksSignAndVerify(indata:string, session: huks.HuksSessionHandle, authToken: Uint8Array): Promise { try { - let signature = await SignFinish(session.handle, authToken, inputdata); - hilog.info(DOMAIN, 'testTag', 'IAM auth on success'); + let signature = await SignFinish(session.handle, authToken, indata); + hilog.info(DOMAIN, 'testTag', 'IAM auth on success' + signature); } catch (error) { hilog.error(DOMAIN, 'testTag', 'IAM auth catch error', JSON.stringify(error)); throw new Error('pull up IAM Fail' + (error as BusinessError).message); @@ -569,16 +598,14 @@ class TrustedAuth { tempAuthToken = await this.ModifyPwdMix(challenge, label); } else { hilog.info(DOMAIN, 'testTag', '============startPINVerification============'); - tempAuthToken = await this.ContentVerifyByPwd(challenge, label); + tempAuthToken = await this.ContentVerifyByPwd(indata, challenge, label); } const TuiAuthToken: trustedAuthentication.AuthToken = tempAuthToken; let authToken = TuiAuthToken.authToken; - let inputdata = - 'challenge:123456|0\n用户:张家龙|1\n账号:123456|1\n交易金额: 10000000|2\n交易时间:2025-0605|2'; try { - SignFinish(session.handle, authToken, inputdata).then((data) => { + SignFinish(session.handle, authToken, indata).then((data) => { let signature = data as Uint8Array; - Verify(inputdata, signature); + Verify(indata, signature); }); hilog.info(DOMAIN, 'testTag', 'HUKS -> IAM auth on success'); } catch (error) { @@ -623,7 +650,7 @@ class TrustedAuth { } } - async GetTUIAuthTokenBeforeBioVerify(session: huks.HuksSessionHandle, authType: number, + async GetTUIAuthTokenBeforeBioVerify(indata: string, session: huks.HuksSessionHandle, authType: number, assetName: string): Promise { let challenge: Uint8Array = session.challenge as Uint8Array; let tempAuthToken: trustedAuthentication.AuthToken; @@ -651,9 +678,9 @@ class TrustedAuth { } tempAuthToken = await this.PwdVerify(challenge, assetName); } else if (authType === TUI_CONTENT_FACE_VERIFY) { - tempAuthToken = await this.FaceAuthContent(challenge, assetName); + tempAuthToken = await this.FaceAuthContent(indata, challenge, assetName); } else if (authType === TUI_CONTENT_FINGERPRINT_VERIFY) { - tempAuthToken = await this.FingerPrintAuthContent(challenge, assetName); + tempAuthToken = await this.FingerPrintAuthContent(indata, challenge, assetName); } else { throw new Error(`invalid auth type; ${JSON.stringify(authType)}`); } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 0893998..0bb639c 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -22,6 +22,7 @@ struct Index { aboutToAppear(): void { this.pageInfos.pushPath({name: "MainPage"}) + AppStorage.setOrCreate('context', this.getUIContext().getHostContext()) } build() { diff --git a/entry/src/main/ets/pages/MainPage.ets b/entry/src/main/ets/pages/MainPage.ets index 1dfc656..c94764b 100644 --- a/entry/src/main/ets/pages/MainPage.ets +++ b/entry/src/main/ets/pages/MainPage.ets @@ -46,6 +46,8 @@ export struct MainPage { @Consume pageInfos: NavPathStack; uiContext: UIContext = this.getUIContext(); promptAction: PromptAction = this.uiContext.getPromptAction(); + context: Context = this.uiContext.getHostContext() as Context; + resourceManager = this.context.resourceManager; async aboutToAppear(): Promise { const bytes = [0x00, 0x00, 0x00, 0x80, 0x80, 0xd2, 0x41, 0x40]; @@ -63,31 +65,43 @@ export struct MainPage { if (resArray.length != 0) { this.hasShield = true; } - if(this.hasFingerprintAbility){ + let resFaceArray: Uint8Array = await AssetUtils.QueryDataFromAssetStore('face_credentialID') + if (resFaceArray.length != 0) { + this.faceBind = true; + } + let resFingerArray: Uint8Array = await AssetUtils.QueryDataFromAssetStore('finger_credentialID') + if (resFingerArray.length != 0) { + this.fingerprintBind = true; + } + if (this.hasFingerprintAbility) { try { userAuth.getAvailableStatus(userAuth.UserAuthType.FINGERPRINT, userAuth.AuthTrustLevel.ATL3); hilog.info(DOMAIN, 'testTag', 'current auth trust level supported'); } catch (error) { const err: BusinessError = error as BusinessError; - if(error.code === NOT_ENROLLED_ERROR){ - hilog.error(DOMAIN, 'testTag', `Authentication bio is not enrolled. Code is ${err?.code}, message is ${err?.message}`); - }else{ - hilog.error(DOMAIN, 'testTag', `current auth trust level not supported. Code is ${err?.code}, message is ${err?.message}`); + if (error.code === NOT_ENROLLED_ERROR) { + hilog.error(DOMAIN, 'testTag', + `Authentication bio is not enrolled. Code is ${err?.code}, message is ${err?.message}`); + } else { + hilog.error(DOMAIN, 'testTag', + `current auth trust level not supported. Code is ${err?.code}, message is ${err?.message}`); this.hasFingerprintAbility = false; this.bioState--; } } } - if(this.hasFaceAbility){ + if (this.hasFaceAbility) { try { userAuth.getAvailableStatus(userAuth.UserAuthType.FACE, userAuth.AuthTrustLevel.ATL4); hilog.info(DOMAIN, 'testTag', 'current auth trust level supported'); } catch (error) { const err: BusinessError = error as BusinessError; - if(error.code === NOT_ENROLLED_ERROR){ - hilog.error(DOMAIN, 'testTag', `Authentication bio is not enrolled. Code is ${err?.code}, message is ${err?.message}`); - }else{ - hilog.error(DOMAIN, 'testTag', `current auth trust level not supported. Code is ${err?.code}, message is ${err?.message}`); + if (error.code === NOT_ENROLLED_ERROR) { + hilog.error(DOMAIN, 'testTag', + `Authentication bio is not enrolled. Code is ${err?.code}, message is ${err?.message}`); + } else { + hilog.error(DOMAIN, 'testTag', + `current auth trust level not supported. Code is ${err?.code}, message is ${err?.message}`); this.hasFaceAbility = false; this.bioState--; } @@ -107,7 +121,7 @@ export struct MainPage { .textAlign(TextAlign.Start) .margin({ top: 28, bottom: 8 }) } - .width('calc(100% - 56vp)') + .width('calc(100% - 56vp)') // 100% stand for whole element and vp stand for margin .margin({ left: 28, right: 28 @@ -121,7 +135,7 @@ export struct MainPage { .buttonStyle(ButtonStyleMode.NORMAL) .margin({ top: 14, bottom: 14, right: 12 }) .onClick(async () => { - this.pageInfos.pushPath({name: 'PasswordSelectionPage'}) + this.pageInfos.pushPath({ name: 'PasswordSelectionPage' }) }); } else { Button($r('app.string.OpenWord')) @@ -132,7 +146,7 @@ export struct MainPage { }) } } - .width('calc(100% - 32vp)') + .width('calc(100% - 32vp)') // 100% stand for whole element and vp stand for margin .height(56) .backgroundColor(Color.White) .borderRadius(16) @@ -150,7 +164,7 @@ export struct MainPage { .textAlign(TextAlign.Start) .margin({ top: 28, bottom: 8 }) } - .width('calc(100% - 56vp)') + .width('calc(100% - 56vp)') // 100% stand for whole element and vp stand for margin .margin({ left: 28, right: 28 @@ -168,19 +182,22 @@ export struct MainPage { try { let session = await TrustedAuth.SignInit(); hilog.info(DOMAIN, 'testTag', 'Finish Signature Initialization'); - let indata: string = 'aaabbb'; + let indata: string = 'placeholder'; await TrustedAuth.UserAuthTUIPINBeforeSign(indata, session, TUI_PIN_DISABLE, 'pin_label1'); - this.message += $r('app.string.CloseShieldSuccess'); + this.message += this.resourceManager.getStringSync($r('app.string.CloseShieldSuccess')); this.hasShield = false; this.fingerprintBind = false; this.faceBind = false; } catch (error) { hilog.error(DOMAIN, 'testTag', 'Close Shield Fail:', error); - this.message += $r('app.string.CloseShieldFail') + `: ${error}`; + this.message += this.resourceManager.getStringSync($r('app.string.CloseShieldFail')) + + `: ${error}`; } this.promptAction.openToast({ message: this.message, duration: 100, + }).catch(() => { + hilog.error(DOMAIN, 'testTag', 'toast open failed'); }) }); } @@ -202,24 +219,27 @@ 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 += $r('app.string.CloseShieldSuccess'); + this.message += this.resourceManager.getStringSync($r('app.string.CloseShieldSuccess')); this.hasShield = false; this.fingerprintBind = false; this.faceBind = false; } catch (error) { hilog.error(DOMAIN, 'testTag', 'Close Shield Fail:', error); - this.message += $r('app.string.CloseShieldFail')+ `: ${error}`; + this.message += this.resourceManager.getStringSync($r('app.string.CloseShieldFail')) + + `: ${error}`; } this.promptAction.openToast({ message: this.message, duration: 100, + }).catch(() => { + hilog.error(DOMAIN, 'testTag', 'toast open failed'); }) }); } .width('100%') .height(56) } - .width('calc(100% - 32vp)') + .width('calc(100% - 32vp)') // 100% stand for whole element and vp stand for margin .height(112) .backgroundColor(Color.White) .borderRadius(16) @@ -228,7 +248,7 @@ export struct MainPage { right: 16 }) - if(this.bioState != 0){ + if (this.bioState != 0) { Column() { Text($r('app.string.BioFeatureVerification')) .width('100%') @@ -237,7 +257,7 @@ export struct MainPage { .textAlign(TextAlign.Start) .margin({ top: 28, bottom: 8 }) } - .width('calc(100% - 56vp)') + .width('calc(100% - 56vp)') // 100% stand for whole element and vp stand for margin .margin({ left: 28, right: 28 @@ -245,7 +265,7 @@ export struct MainPage { } Column() { - if(this.hasFingerprintAbility){ + if (this.hasFingerprintAbility) { if (!this.fingerprintBind) { Row() { Text($r('app.string.Fingerprint')).textAlign(TextAlign.Start).margin({ left: 12 }) @@ -259,28 +279,31 @@ export struct MainPage { let session = await TrustedAuth.SignInit(); hilog.info(DOMAIN, 'testTag', 'Finish Signature Initialization'); const tuiAuthToken: Uint8Array = - await TrustedAuth.GetTUIAuthTokenBeforeBioVerify(session, TUI_BIND_FINGERPRINT, + await TrustedAuth.GetTUIAuthTokenBeforeBioVerify('placeholder', session, TUI_BIND_FINGERPRINT, 'pin_label1'); let bioAuthToken: Uint8Array = await TrustedAuth.UserAuthBeforeSign(session, TUI_BIND_FINGERPRINT); let operType = trustedAuthentication.OperateType.OPERATE_TYPE_BIOMETRIC_AUTH; let resignAuthToken = await trustedAuthentication.getBiometricAuthToken(operType, tuiAuthToken, bioAuthToken); - let inputdata = 'challenge:123456|0\n用户:张家龙|1\n账号:123456|1\n交易金额:1000000000|2'; - await TrustedAuth.bindFaceID(session.handle, resignAuthToken.authToken, inputdata) - this.message += $r('app.string.BindFingerprintSuccess'); + let inputdata = 'placeholder'; + await TrustedAuth.bindFingerID(session.handle, resignAuthToken.authToken, inputdata) + this.message += this.resourceManager.getStringSync($r('app.string.BindFingerprintSuccess')); this.fingerprintBind = true; } catch (error) { hilog.error(DOMAIN, 'testTag', 'Bind Fingerprint Fail:', error); - if(error.message === 'Authentication template has not been enrolled.'){ - this.message += $r('app.string.BindFingerprintFailWithNotification') - }else{ - this.message += $r('app.string.BindFingerprintFail')+ `: ${error}`; + if (error.message === 'Authentication template has not been enrolled.') { + this.message += this.resourceManager.getStringSync($r('app.string.BindFingerprintFailWithNotification')); + } else { + this.message += this.resourceManager.getStringSync($r('app.string.BindFingerprintFail')) + + `: ${error}`; } } this.promptAction.openToast({ message: this.message, duration: 100, + }).catch(() => { + hilog.error(DOMAIN, 'testTag', 'toast open failed'); }) }); } @@ -288,7 +311,7 @@ export struct MainPage { .height(56) } else { Row() { - Text( $r('app.string.FingerprintBound')).textAlign(TextAlign.Start).margin({ left: 12 }) + Text($r('app.string.FingerprintBound')).textAlign(TextAlign.Start).margin({ left: 12 }) Blank() Button($r('app.string.UnBound')) .buttonStyle(ButtonStyleMode.NORMAL) @@ -298,26 +321,29 @@ export struct MainPage { try { let authType = trustedAuthentication.AuthType.AUTH_TYPE_FINGERPRINT; await TrustedAuth.disableTrustedBioAuthentication('pin_label1', authType); - this.message += $r('app.string.UnBoundFingerprintSuccess'); + this.message += this.resourceManager.getStringSync($r('app.string.UnBoundFingerprintSuccess')); this.fingerprintBind = false; } catch (error) { // 捕获错误并处理 hilog.error(DOMAIN, 'testTag', 'UnBound Fingerprint Fail:', error); - this.message += $r('app.string.UnBoundFingerprintFail')+`: ${error}`; + this.message += this.resourceManager.getStringSync($r('app.string.UnBoundFingerprintFail')) + + `: ${error}`; } this.promptAction.openToast({ message: this.message, duration: 100, + }).catch(() => { + hilog.error(DOMAIN, 'testTag', 'toast open failed'); }) }); }.width('100%') .height(56) } } - if(this.bioState === 2){ + if (this.bioState === 2) { Divider().width('93%') } - if(this.hasFaceAbility){ + if (this.hasFaceAbility) { if (!this.faceBind) { Row() { Text($r('app.string.Face')).textAlign(TextAlign.Start).margin({ left: 12 }) @@ -331,27 +357,30 @@ export struct MainPage { let session = await TrustedAuth.SignInit(); hilog.info(DOMAIN, 'testTag', 'Finish Signature Initialization'); const tuiAuthToken: Uint8Array = - await TrustedAuth.GetTUIAuthTokenBeforeBioVerify(session, TUI_BIND_FACE, 'pin_label1'); + await TrustedAuth.GetTUIAuthTokenBeforeBioVerify('placeholder', session, TUI_BIND_FACE, 'pin_label1'); let bioAuthToken: Uint8Array = await TrustedAuth.UserAuthBeforeSign(session, TUI_BIND_FACE); let operType = trustedAuthentication.OperateType.OPERATE_TYPE_BIOMETRIC_AUTH; let resignAuthToken = await trustedAuthentication.getBiometricAuthToken(operType, tuiAuthToken, bioAuthToken); - let inputdata = 'challenge:123456|0\n用户:张家龙|1\n账号:123456|1\n交易金额:1000000000|2'; + let inputdata = 'placeholder'; await TrustedAuth.bindFaceID(session.handle, resignAuthToken.authToken, inputdata) - this.message += $r('app.string.BindFaceSuccess'); + this.message += this.resourceManager.getStringSync($r('app.string.BindFaceSuccess')); this.faceBind = true; } catch (error) { hilog.error(DOMAIN, 'testTag', 'Bind Face Fail:', error); - if(error.message === 'Authentication template has not been enrolled.'){ - this.message += $r('app.string.BindFaceFailWithNotification') - }else{ - this.message += $r('app.string.BindFaceFail')+ ` : ${error}`; + if (error.message === 'Authentication template has not been enrolled.') { + this.message += this.resourceManager.getStringSync($r('app.string.BindFaceFailWithNotification')) + } else { + this.message += this.resourceManager.getStringSync($r('app.string.BindFaceFail')) + + ` : ${error}`; } } this.promptAction.openToast({ message: this.message, duration: 100, + }).catch(() => { + hilog.error(DOMAIN, 'testTag', 'toast open failed'); }) }); }.width('100%') @@ -368,16 +397,19 @@ export struct MainPage { try { let authType = trustedAuthentication.AuthType.AUTH_TYPE_FACE; await TrustedAuth.disableTrustedBioAuthentication('pin_label1', authType); - this.message += $r('app.string.UnBoundFaceSuccess'); + this.message += this.resourceManager.getStringSync($r('app.string.UnBoundFaceSuccess')); this.faceBind = false; } catch (error) { // 捕获错误并处理 hilog.error(DOMAIN, 'testTag', 'UnBound Face Fail:', error); - this.message += $r('app.string.UnBoundFaceFail')+`: ${error}`; + this.message += this.resourceManager.getStringSync($r('app.string.UnBoundFaceFail')) + + `: ${error}`; } this.promptAction.openToast({ message: this.message, duration: 100, + }).catch(() => { + hilog.error(DOMAIN, 'testTag', 'toast open failed'); }) }); } @@ -386,7 +418,7 @@ export struct MainPage { } } } - .width('calc(100% - 32vp)') + .width('calc(100% - 32vp)') // 100% stand for whole element and vp stand for margin .height(`calc(56vp * ${this.bioState})`) .backgroundColor(Color.White) .borderRadius(16) @@ -398,9 +430,10 @@ export struct MainPage { } } .justifyContent(FlexAlign.Start) - .constraintSize({minHeight:'100%'}) + .constraintSize({ minHeight: '100%' }) .width('100%') - }.height('calc(100% - 56vp)') + }.height('calc(100% - 56vp)') // 100% stand for whole element and vp stand for margin + Button($r('app.string.Trade')).width('calc(100% - 32vp)').onClick(() => { this.pageInfos.pushPath({ name: 'TradingPage' }) }).margin({ bottom: 16 }) diff --git a/entry/src/main/ets/pages/PasswordSelectionPage.ets b/entry/src/main/ets/pages/PasswordSelectionPage.ets index 5ff9689..3e8ceeb 100644 --- a/entry/src/main/ets/pages/PasswordSelectionPage.ets +++ b/entry/src/main/ets/pages/PasswordSelectionPage.ets @@ -36,6 +36,8 @@ export struct PasswordSelectionPage { @Consume pageInfos: NavPathStack; uiContext: UIContext = this.getUIContext(); promptAction: PromptAction = this.uiContext.getPromptAction(); + context: Context = this.uiContext.getHostContext() as Context; + resourceManager = this.context.resourceManager; build() { NavDestination() { @@ -48,7 +50,7 @@ export struct PasswordSelectionPage { .textAlign(TextAlign.Start) .margin({ top: 28, bottom: 8 }) } - .width('calc(100% - 56vp)') + .width('calc(100% - 56vp)') // 100% stand for whole element and vp stand for margin .margin({ left: 28, right: 28 @@ -58,7 +60,7 @@ export struct PasswordSelectionPage { Checkbox().margin({ left: 18 }).select(this.onlyNum!!) Text($r('app.string.PureNumber')).textAlign(TextAlign.Start).margin({ left: 8 }) } - .width('calc(100% - 32vp)') + .width('calc(100% - 32vp)') // 100% stand for whole element and vp stand for margin .height(56) .backgroundColor(Color.White) .borderRadius(16) @@ -74,7 +76,7 @@ export struct PasswordSelectionPage { }) Text($r('app.string.NumberPlusAlphabet')).textAlign(TextAlign.Start).margin({ left: 8 }) } - .width('calc(100% - 32vp)') + .width('calc(100% - 32vp)') // 100% stand for whole element and vp stand for margin .height(56) .backgroundColor(Color.White) .borderRadius(16) @@ -84,7 +86,7 @@ export struct PasswordSelectionPage { }) Blank() - if(this.hasShield){ + if (this.hasShield) { Button($r('app.string.ModifyWord')).width('calc(100% - 32vp)').onClick(async () => { this.message = ''; if (this.onlyNum) { @@ -97,23 +99,24 @@ export struct PasswordSelectionPage { hilog.info(DOMAIN, 'testTag', 'Generate Key Success'); let session = await TrustedAuth.SignInit(); hilog.info(DOMAIN, 'testTag', 'Signature Initialization success'); - let indata: string = 'aaabbb'; + let indata: string = 'placeholder'; await TrustedAuth.UserAuthTUIPINBeforeSign(indata, session, this.type, 'pin_label1'); - this.message += $r('app.string.ModifyPwSuccess'); + this.message += this.resourceManager.getStringSync($r('app.string.ModifyPwSuccess')); this.hasShield = true; } catch (error) { // catch error hilog.error(DOMAIN, 'testTag', 'Modify Pw Fail:', error); - this.message += $r('app.string.ModifyPwFail')+`: ${error}`; + this.message += this.resourceManager.getStringSync($r('app.string.ModifyPwFail')) + `: ${error}`; } this.promptAction.openToast({ message: this.message, duration: 100, + }).catch(() => { + hilog.error(DOMAIN, 'testTag', 'toast open failed'); }) this.pageInfos.pop(); }).margin({ bottom: 16 }) - } - else{ + } else { Button($r('app.string.OpenWord')).width('calc(100% - 32vp)').onClick(async () => { this.message = ''; if (this.onlyNum) { @@ -126,18 +129,20 @@ export struct PasswordSelectionPage { hilog.info(DOMAIN, 'testTag', 'GenerateKeySuccess'); let session = await TrustedAuth.SignInit(); hilog.info(DOMAIN, 'testTag', 'Signature Initialization success'); - let indata: string = 'aaabbb'; + let indata: string = 'placeholder'; await TrustedAuth.UserAuthTUIPINBeforeSign(indata, session, this.type, 'pin_label1'); - this.message += $r('app.string.OpenShieldSuccess'); + this.message += this.resourceManager.getStringSync($r('app.string.OpenShieldSuccess')); this.hasShield = true; } catch (error) { // catch error hilog.error(DOMAIN, 'testTag', 'OpenShield Fail:', error); - this.message += $r('app.string.OpenShieldFail')+`: ${error}`; + this.message += this.resourceManager.getStringSync($r('app.string.OpenShieldFail')) + `: ${error}`; } this.promptAction.openToast({ message: this.message, duration: 100, + }).catch(() => { + hilog.error(DOMAIN, 'testTag', 'toast open failed'); }) this.pageInfos.pop(); }).margin({ bottom: 16 }) diff --git a/entry/src/main/ets/pages/TradingPage.ets b/entry/src/main/ets/pages/TradingPage.ets index 1b0ce10..35094e8 100644 --- a/entry/src/main/ets/pages/TradingPage.ets +++ b/entry/src/main/ets/pages/TradingPage.ets @@ -42,85 +42,113 @@ export struct BindSheetTemp { @Consume fingerprintBind: boolean; uiContext: UIContext = this.getUIContext(); promptAction: PromptAction = this.uiContext.getPromptAction(); + context: Context = this.uiContext.getHostContext() as Context; + resourceManager = this.context.resourceManager; build() { Column({ space: 12 }) { - Button($r('app.string.PINVerification')).width('calc(100% - 32vp)').buttonStyle(ButtonStyleMode.NORMAL).onClick(async () => { - this.message = ''; - try { - let session = await TrustedAuth.SignInit(); - hilog.info(DOMAIN, 'testTag', 'Signature Initialization success'); - let indata: string = this.receiver + '/' + this.receiveAccount + '/' + this.tradingAmount; - await TrustedAuth.UserAuthTUIPINBeforeSign(indata, session, TUI_CONTENT_PWD_VERIFY, 'pin_label1'); - this.message += $r('app.string.PINVerificationSuccess'); - } catch (error) { - hilog.error(DOMAIN, 'testTag', 'PIN Verification Fail:', error); - this.message += $r('app.string.PINVerificationFail')+ `: ${error}`; - } - this.promptAction.openToast({ - message: this.message, - duration: 100, - }) - }); - if (this.fingerprintBind) { - Button($r('app.string.FingerprintVerification')).width('calc(100% - 32vp)').buttonStyle(ButtonStyleMode.NORMAL).onClick(async () => { + Button($r('app.string.PINVerification')) + .width('calc(100% - 32vp)') + .buttonStyle(ButtonStyleMode.NORMAL) + .onClick(async () => { this.message = ''; try { let session = await TrustedAuth.SignInit(); hilog.info(DOMAIN, 'testTag', 'Signature Initialization success'); - const tuiAuthToken: Uint8Array = - await TrustedAuth.GetTUIAuthTokenBeforeBioVerify(session, TUI_CONTENT_FINGERPRINT_VERIFY, 'pin_label1'); - let bioAuthToken: Uint8Array = - await TrustedAuth.UserAuthBeforeSign(session, TUI_CONTENT_FINGERPRINT_VERIFY); - let operType = trustedAuthentication.OperateType.OPERATE_TYPE_CONTENT_AUTH; - let resignAuthToken = - await trustedAuthentication.getBiometricAuthToken(operType, tuiAuthToken, bioAuthToken); - await TrustedAuth.HuksSignAndVerify(session, resignAuthToken.authToken) - this.message += $r('app.string.FingerprintVerificationSuccess'); + let indata: string = + this.resourceManager.getStringSync($r('app.string.Recipient')) + ':' + this.receiver + '/' + + this.resourceManager.getStringSync($r('app.string.AccountNumber')) + ':' + this.receiveAccount + '/' + + this.resourceManager.getStringSync($r('app.string.TradingAmount')) + ':' + this.tradingAmount; + await TrustedAuth.UserAuthTUIPINBeforeSign(indata, session, TUI_CONTENT_PWD_VERIFY, 'pin_label1'); + this.message += this.resourceManager.getStringSync($r('app.string.PINVerificationSuccess')); } catch (error) { - hilog.error(DOMAIN, 'testTag', 'Fingerprint Verification Fail:', error); - if(error.code === 1019100019){ - this.message += $r('app.string.FingerprintVerificationFailWithNotification'); - } - else{ - this.message += $r('app.string.FingerprintVerificationFail')+ `: ${error}`; - } + hilog.error(DOMAIN, 'testTag', 'PIN Verification Fail:', error); + this.message += this.resourceManager.getStringSync($r('app.string.PINVerificationFail')) + `: ${error}`; } this.promptAction.openToast({ message: this.message, duration: 100, + }).catch(() => { + hilog.error(DOMAIN, 'testTag', 'toast open failed'); }) }); + if (this.fingerprintBind) { + Button($r('app.string.FingerprintVerification')) + .width('calc(100% - 32vp)') + .buttonStyle(ButtonStyleMode.NORMAL) + .onClick(async () => { + this.message = ''; + try { + let session = await TrustedAuth.SignInit(); + hilog.info(DOMAIN, 'testTag', 'Signature Initialization success'); + let indata: string = + this.resourceManager.getStringSync($r('app.string.Recipient')) + ':' + this.receiver + '/' + + this.resourceManager.getStringSync($r('app.string.AccountNumber')) + ':' + this.receiveAccount + '/' + + this.resourceManager.getStringSync($r('app.string.TradingAmount')) + ':' + this.tradingAmount; + const tuiAuthToken: Uint8Array = + await TrustedAuth.GetTUIAuthTokenBeforeBioVerify(indata, session, TUI_CONTENT_FINGERPRINT_VERIFY, 'pin_label1'); + let bioAuthToken: Uint8Array = + await TrustedAuth.UserAuthBeforeSign(session, TUI_CONTENT_FINGERPRINT_VERIFY); + let operType = trustedAuthentication.OperateType.OPERATE_TYPE_CONTENT_AUTH; + let resignAuthToken = + await trustedAuthentication.getBiometricAuthToken(operType, tuiAuthToken, bioAuthToken); + await TrustedAuth.HuksSignAndVerify(indata, session, resignAuthToken.authToken) + this.message += this.resourceManager.getStringSync($r('app.string.FingerprintVerificationSuccess')); + } catch (error) { + hilog.error(DOMAIN, 'testTag', 'Fingerprint Verification Fail:', error); + if (error.code === 1019100019) { + this.message += this.resourceManager.getStringSync($r('app.string.FingerprintVerificationFailWithNotification')); + } else { + this.message += this.resourceManager.getStringSync($r('app.string.FingerprintVerificationFail')) + + `: ${error}`; + } + } + this.promptAction.openToast({ + message: this.message, + duration: 100, + }).catch(() => { + hilog.error(DOMAIN, 'testTag', 'toast open failed'); + }) + }); } if (this.faceBind) { - Button($r('app.string.FaceVerification')).width('calc(100% - 32vp)').buttonStyle(ButtonStyleMode.NORMAL).onClick(async () => { - this.message = ''; - try { - let session = await TrustedAuth.SignInit(); - hilog.info(DOMAIN, 'testTag', 'Signature Initialization success'); - const tuiAuthToken: Uint8Array = - await TrustedAuth.GetTUIAuthTokenBeforeBioVerify(session, TUI_CONTENT_FACE_VERIFY, 'pin_label1'); - let bioAuthToken: Uint8Array = - await TrustedAuth.UserAuthBeforeSign(session, TUI_CONTENT_FACE_VERIFY); - let operType = trustedAuthentication.OperateType.OPERATE_TYPE_CONTENT_AUTH; - let resignAuthToken = - await trustedAuthentication.getBiometricAuthToken(operType, tuiAuthToken, bioAuthToken); - await TrustedAuth.HuksSignAndVerify(session, resignAuthToken.authToken) - this.message += $r('app.string.FaceVerificationSuccess'); - } catch (error) { - hilog.error(DOMAIN, 'testTag', 'Face Verification Fail:', error); - if(error.code === 1019100019){ - this.message += $r('app.string.FaceVerificationFailWithNotification'); - } - else{ - this.message += $r('app.string.FaceVerificationFail')+ `: ${error}`; + Button($r('app.string.FaceVerification')) + .width('calc(100% - 32vp)') + .buttonStyle(ButtonStyleMode.NORMAL) + .onClick(async () => { + this.message = ''; + try { + let session = await TrustedAuth.SignInit(); + hilog.info(DOMAIN, 'testTag', 'Signature Initialization success'); + let indata: string = + this.resourceManager.getStringSync($r('app.string.Recipient')) + ':' + this.receiver + '/' + + this.resourceManager.getStringSync($r('app.string.AccountNumber')) + ':' + this.receiveAccount + '/' + + this.resourceManager.getStringSync($r('app.string.TradingAmount')) + ':' + this.tradingAmount; + const tuiAuthToken: Uint8Array = + await TrustedAuth.GetTUIAuthTokenBeforeBioVerify(indata, session, TUI_CONTENT_FACE_VERIFY, 'pin_label1'); + let bioAuthToken: Uint8Array = + await TrustedAuth.UserAuthBeforeSign(session, TUI_CONTENT_FACE_VERIFY); + let operType = trustedAuthentication.OperateType.OPERATE_TYPE_CONTENT_AUTH; + let resignAuthToken = + await trustedAuthentication.getBiometricAuthToken(operType, tuiAuthToken, bioAuthToken); + await TrustedAuth.HuksSignAndVerify(indata, session, resignAuthToken.authToken) + this.message += this.resourceManager.getStringSync($r('app.string.FaceVerificationSuccess')); + } catch (error) { + hilog.error(DOMAIN, 'testTag', 'Face Verification Fail:', error); + if (error.code === 1019100019) { + this.message += this.resourceManager.getStringSync($r('app.string.FaceVerificationFailWithNotification')); + } else { + this.message += this.resourceManager.getStringSync($r('app.string.FaceVerificationFail')) + + `: ${error}`; + } } - } - this.promptAction.openToast({ - message: this.message, - duration: 100, - }) - }); + this.promptAction.openToast({ + message: this.message, + duration: 100, + }).catch(() => { + hilog.error(DOMAIN, 'testTag', 'toast open failed'); + }) + }); } }.margin({ top: 24, bottom: 24 }) } @@ -148,29 +176,46 @@ export struct TradingPage { .width('75%') .fontSize(16) .backgroundColor(Color.White) + .onChange((value) => { + this.receiver = value; + }) }.width('100%').height(48) Divider().width('93%') Row() { - Text($r('app.string.AccountNumber')).width('20%').fontSize(14).textAlign(TextAlign.Start).margin({ left: 12 }) + Text($r('app.string.AccountNumber')) + .width('20%') + .fontSize(14) + .textAlign(TextAlign.Start) + .margin({ left: 12 }) TextArea({ placeholder: '6666 1234 **** **** 888', text: this.receiveAccount }) .width('75%') .fontSize(16) .backgroundColor(Color.White) + .onChange((value) => { + this.receiveAccount = value; + }) }.width('100%').height(48) Divider().width('93%') Row() { - Text($r('app.string.TradingAmount')).width('20%').fontSize(14).textAlign(TextAlign.Start).margin({ left: 12 }) + Text($r('app.string.TradingAmount')) + .width('20%') + .fontSize(14) + .textAlign(TextAlign.Start) + .margin({ left: 12 }) TextArea({ placeholder: '0.0', text: this.tradingAmount }) .width('75%') .fontSize(16) .backgroundColor(Color.White) + .onChange((value) => { + this.tradingAmount = value; + }) }.width('100%').height(48) Blank().height(4) } - .width('calc(100% - 32vp)') + .width('calc(100% - 32vp)') // 100% stand for whole element and vp stand for margin .backgroundColor(Color.White) .borderRadius(16) .margin({ @@ -180,7 +225,8 @@ export struct TradingPage { bottom: 24 }) - Button($r('app.string.NextWord')).width('calc(100% - 32vp)') + Button($r('app.string.NextWord')) + .width('calc(100% - 32vp)')// 100% stand for whole element and vp stand for margin .onClick(() => { this.bindSheetShow = true; }) diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index cc9f5b7..e0f4462 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -58,7 +58,7 @@ }, { "name": "CloseShieldWithoutVerification", - "value": "Unable shield without Verification" + "value": "Unable shield without verification" }, { "name": "BioFeatureVerification", -- Gitee From a2be70c4e3cf16676074cc87ca5ba92d458c85e4 Mon Sep 17 00:00:00 2001 From: hid21342512 Date: Fri, 15 Aug 2025 17:00:58 +0800 Subject: [PATCH 2/2] code review fix 3 --- entry/src/main/ets/pages/TradingPage.ets | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/entry/src/main/ets/pages/TradingPage.ets b/entry/src/main/ets/pages/TradingPage.ets index 35094e8..88b8fcc 100644 --- a/entry/src/main/ets/pages/TradingPage.ets +++ b/entry/src/main/ets/pages/TradingPage.ets @@ -56,8 +56,8 @@ 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 + '/' + - this.resourceManager.getStringSync($r('app.string.AccountNumber')) + ':' + this.receiveAccount + '/' + + 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; await TrustedAuth.UserAuthTUIPINBeforeSign(indata, session, TUI_CONTENT_PWD_VERIFY, 'pin_label1'); this.message += this.resourceManager.getStringSync($r('app.string.PINVerificationSuccess')); @@ -82,8 +82,8 @@ 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 + '/' + - this.resourceManager.getStringSync($r('app.string.AccountNumber')) + ':' + this.receiveAccount + '/' + + 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; const tuiAuthToken: Uint8Array = await TrustedAuth.GetTUIAuthTokenBeforeBioVerify(indata, session, TUI_CONTENT_FINGERPRINT_VERIFY, 'pin_label1'); @@ -121,8 +121,8 @@ 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 + '/' + - this.resourceManager.getStringSync($r('app.string.AccountNumber')) + ':' + this.receiveAccount + '/' + + 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; const tuiAuthToken: Uint8Array = await TrustedAuth.GetTUIAuthTokenBeforeBioVerify(indata, session, TUI_CONTENT_FACE_VERIFY, 'pin_label1'); -- Gitee