From 6314f45cbfab1b902fad6d3b37a0c9f3df40cc3b Mon Sep 17 00:00:00 2001 From: CheungVane Date: Wed, 3 Aug 2022 10:23:15 +0800 Subject: [PATCH] add attestkey api Signed-off-by: zhangwenzhi --- .../extend/systemplugin/napi/ohos_security_huks.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/runtime/main/extend/systemplugin/napi/ohos_security_huks.js b/runtime/main/extend/systemplugin/napi/ohos_security_huks.js index 9e7fb70f..cbe48ac8 100644 --- a/runtime/main/extend/systemplugin/napi/ohos_security_huks.js +++ b/runtime/main/extend/systemplugin/napi/ohos_security_huks.js @@ -527,6 +527,18 @@ export function mockHuks() { }) } }, + attestKey: function (...args) { + console.warn("huks.attestKey interface mocked in the Previewer. How this interface works on the Previewer" + + " may be different from that on a real device.") + const len = args.length + if (typeof args[len - 1] === 'function') { + args[len - 1].call(this, paramMock.businessErrorMock, HuksResult) + } else { + return new Promise((resolve, reject) => { + resolve(HuksResult) + }) + } + }, getSdkVersion: function (...args) { console.warn("huks.getSdkVersion interface mocked in the Previewer. How this interface works on the Previewer" + " may be different from that on a real device.")