Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0d7b9091
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0d7b9091
编写于
6月 22, 2022
作者:
H
hu-jixiang1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hujixiang1@huawei.com
Signed-off-by:
N
hu-jixiang1
<
hujixiang1@huawei.com
>
上级
d60c9f66
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
98 addition
and
5515 deletion
+98
-5515
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/List.test.js
...on_test/userauthpart2/entry/src/main/js/test/List.test.js
+0
-10
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Publicfunction-n.js
.../userauthpart2/entry/src/main/js/test/Publicfunction-n.js
+0
-490
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_Coauth_DFX_CallbackJsunit.test.js
...in/js/test/Security_IAM_Coauth_DFX_CallbackJsunit.test.js
+0
-218
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_Coauth_Func_CallbackJsunit.test.js
...n/js/test/Security_IAM_Coauth_Func_CallbackJsunit.test.js
+0
-725
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_Face_DFX_CallbackJsunit.test.js
...main/js/test/Security_IAM_Face_DFX_CallbackJsunit.test.js
+0
-720
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_Face_Func_CallbackJsunit.test.js
...ain/js/test/Security_IAM_Face_Func_CallbackJsunit.test.js
+0
-837
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_Interface_DFX_CallbackJsunit.test.js
...js/test/Security_IAM_Interface_DFX_CallbackJsunit.test.js
+0
-637
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_Interface_Func_CallbackJsunit.test.js
...s/test/Security_IAM_Interface_Func_CallbackJsunit.test.js
+0
-160
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_PIN_DFX_CallbackJsunit.test.js
.../main/js/test/Security_IAM_PIN_DFX_CallbackJsunit.test.js
+0
-337
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_PIN_Func_CallbackJsunit.test.js
...main/js/test/Security_IAM_PIN_Func_CallbackJsunit.test.js
+0
-1158
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_PIN_Kit_CallbackJsunit.test.js
.../main/js/test/Security_IAM_PIN_Kit_CallbackJsunit.test.js
+98
-223
未找到文件。
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/List.test.js
浏览文件 @
0d7b9091
...
...
@@ -13,16 +13,6 @@
* limitations under the License.
*/
require
(
'
./Security_IAM_PIN_DFX_CallbackJsunit.test.js
'
)
// require('./mytest.test.js')
require
(
'
./Security_IAM_PIN_Func_CallbackJsunit.test.js
'
)
require
(
'
./Security_IAM_PIN_Kit_CallbackJsunit.test.js
'
)
require
(
'
./Security_IAM_Face_DFX_CallbackJsunit.test.js
'
)
require
(
'
./Security_IAM_Face_Func_CallbackJsunit.test.js
'
)
require
(
'
./Security_IAM_Interface_DFX_CallbackJsunit.test.js
'
)
require
(
'
./Security_IAM_Interface_Func_CallbackJsunit.test.js
'
)
require
(
'
./Security_IAM_Coauth_DFX_CallbackJsunit.test.js
'
)
require
(
'
./Security_IAM_Coauth_Func_CallbackJsunit.test.js
'
)
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Publicfunction-n.js
已删除
100644 → 0
浏览文件 @
d60c9f66
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
userIDM
from
'
@ohos.useridm
'
import
pinAuth
from
'
@ohos.pinauth
'
import
userAuth
from
'
@ohos.userauth
'
let
UserIDM
=
null
let
PinAuth
=
null
let
UserAuth
=
null
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
//同步
function
publicRegisterInputer
(
PinAuth
,
AuthSubType
,
Inputerdata
){
console
.
info
(
'
testFace publicRegisterInputer in
'
);
try
{
console
.
info
(
'
testFace publicRegisterInputer in try
'
);
console
.
info
(
'
testFace publicRegisterInputer PinAuth =
'
+
PinAuth
);
let
registerresult
=
PinAuth
.
registerInputer
({
onGetData
:
(
AuthSubType
,
IInputData
)
=>
{
console
.
info
(
'
testFace faceDemo registerInputer AuthSubType
'
);
console
.
info
(
'
testFace faceDemo registerInputer AuthSubType111
'
);
IInputData
.
onSetData
(
AuthSubType
,
Inputerdata
)
}
})
console
.
log
(
"
testFace publicRegisterInputer result is:
"
+
registerresult
);
return
registerresult
;
}
catch
(
e
)
{
console
.
log
(
"
testFace publicRegisterInputer fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
publicunRegisterInputer
(
PinAuth
,
callback
){
console
.
info
(
'
testFace publicunRegisterInputer in
'
);
try
{
console
.
info
(
'
testFace publicunRegisterInputer in try
'
);
console
.
info
(
'
testFace publicunRegisterInputer PinAuth =
'
+
PinAuth
);
let
unRegist
=
1
;
PinAuth
.
unregisterInputer
();
callback
(
unRegist
)
}
catch
(
e
)
{
console
.
log
(
"
testFace unpublicRegisterInputer fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
publicOpenSession
(
UserIDM
,
callback
){
console
.
info
(
'
testFace publicOpenSession in
'
);
try
{
console
.
info
(
'
testFace publicOpenSession in try
'
);
console
.
info
(
'
testFace faceDemo UserIDM =
'
+
UserIDM
);
let
challenge
=
null
UserIDM
.
openSession
(
function
(
data
){
try
{
console
.
log
(
"
testFace before get challenge
"
);
console
.
log
(
"
testFace +
"
+
data
);
challenge
=
data
;
console
.
log
(
"
testFace end
"
);
console
.
log
(
"
testFace after get challenge
"
);
callback
(
challenge
);
expect
(
true
).
assertEqual
(
challenge
!=
null
);
}
catch
(
e
)
{
console
.
info
(
'
testFace faceDemo openSession error =
'
+
JSON
.
stringify
(
e
));
}
});
}
catch
(
e
)
{
console
.
log
(
"
testFace publicOpenSession fail
"
+
e
);
console
.
log
(
e
);
expect
(
null
).
assertFail
();
}
}
function
publicCloseSession
(
UserIDM
,
callback
){
console
.
info
(
'
testFace publicCloseSession in
'
);
try
{
console
.
info
(
'
testFace publicCloseSession in try
'
);
console
.
info
(
'
testFace publicCloseSession UserIDM =
'
+
UserIDM
);
let
closesession
=
0
;
UserIDM
.
closeSession
();
callback
(
closesession
);
}
catch
(
e
)
{
console
.
log
(
"
testFace publicCloseSession fail
"
+
e
);
expect
(
null
).
assertFail
();
}}
async
function
publicaddCredential
(
UserIDM
,
CredentialInfo
,
callback1
,
callback2
){
console
.
info
(
'
testFace publicaddCredential in
'
);
try
{
console
.
info
(
'
testFace publicaddCredential in try
'
);
let
onresult
=
{
addCredresult
:
null
,
credentialId
:
null
,
}
let
onAcquireInfo
=
{
addCredmodule
:
null
,
addCredacquire
:
null
,
addCredextr
:
null
}
console
.
info
(
'
faceTest publicaddCredential UserIDM =
'
+
UserIDM
);
UserIDM
.
addCredential
(
CredentialInfo
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
info
(
'
testFace aaaaaaaaaaaaa
'
);
console
.
info
(
"
testFace addCredential result =
"
+
result
);
console
.
info
(
"
testFace addCredential extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
console
.
log
(
result
)
onresult
.
addCredresult
=
result
;
if
(
extraInfo
!=
undefined
)
{
onresult
.
credentialId
=
extraInfo
.
credentialId
}
else
{
onresult
.
credentialId
=
null
;
}
callback1
(
onresult
)
},
onAcquireInfo
:
function
(
modulea
,
acquire
,
extr
){
console
.
info
(
'
testFace publicaddCredential onAcquireInfo in
'
);
onAcquireInfo
.
addCredmodule
=
modulea
;
onAcquireInfo
.
addCredacquire
=
acquire
;
onAcquireInfo
.
addCredextr
=
extr
;
console
.
info
(
'
testFace publicaddCredential onAcquireInfo =
'
+
JSON
.
stringify
(
onAcquireInfo
));
console
.
info
(
modulea
);
callback2
(
onAcquireInfo
)
},
})
}
catch
(
e
)
{
console
.
log
(
"
testFace publicaddCredential fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
publicupdateCred
(
UserIDM
,
CredentialInfo
,
callback1
,
callback2
){
console
.
info
(
'
testFace publicupdateCred in
'
);
try
{
console
.
info
(
'
testFace publicupdateCred in try
'
);
console
.
info
(
'
testFace publicupdateCred UserIDM =
'
+
UserIDM
);
let
onresult
=
{
updateCredresult
:
null
,
CredentialId
:
null
,
}
let
onacquireinfo
=
{
updateCredmodule
:
null
,
updateCredacquire
:
null
,
updateCredextr
:
null
}
UserIDM
.
updateCredential
(
CredentialInfo
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
testFace faceDemo updateCredential result =
"
+
result
)
onresult
.
updateCredresult
=
result
console
.
log
(
"
testFace faceDemo updateCredential credentialId =
"
+
extraInfo
.
credentialId
)
if
(
extraInfo
!=
undefined
)
{
onresult
.
CredentialId
=
extraInfo
.
credentialId
}
else
{
onresult
.
CredentialId
=
null
;
}
console
.
info
(
'
testFace publicupdateCred updateCredential onResult =
'
+
JSON
.
stringify
(
onresult
));
callback1
(
onresult
)
},
onAcquireInfo
:
function
(
modulea
,
acquire
,
extr
){
console
.
info
(
'
testFace publicupdateCred updateCredential onAcquireInfo in
'
);
onacquireinfo
.
updateCredmodule
=
modulea
onacquireinfo
.
updateCredacquire
=
acquire
onacquireinfo
.
updateCredextr
=
extr
console
.
info
(
'
testFace public updateCredential onacquireinfo =
'
+
JSON
.
stringify
(
onacquireinfo
));
console
.
log
(
"
testFace faceDemo updateCredential module =
"
+
modulea
)
callback2
(
onacquireinfo
)
}
})
}
catch
(
e
)
{
console
.
log
(
"
testFace publicupdateCred fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
//同步
function
publiccancel
(
UserIDM
,
challenge
){
console
.
info
(
'
testFace publiccancel in
'
);
try
{
console
.
info
(
'
testFace publiccancel in try
'
);
console
.
info
(
'
testFace publiccancel UserIDM =
'
+
UserIDM
);
let
cancelresult
=
UserIDM
.
cancel
(
challenge
)
console
.
log
(
"
testFace cancelresult is
"
+
cancelresult
);
return
cancelresult
}
catch
(
e
)
{
console
.
log
(
"
testFace publiccancel fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
publicdelUser
(
UserIDM
,
token
,
callback1
,
callback2
){
console
.
info
(
'
testFace publicdelUser in
'
);
try
{
console
.
info
(
'
testFace publicdelUser in try
'
);
console
.
info
(
'
testFace publicdelUser UserIDM =
'
+
UserIDM
);
let
onresult
=
{
delUserresult
:
null
,
CredentialId
:
null
,
}
let
onacquireinfo
=
{
delUsermodule
:
null
,
delUseracquire
:
null
,
delUserextr
:
null
}
UserIDM
.
delUser
(
token
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
testFace faceDemo delUser result =
"
+
result
)
onresult
.
delUserresult
=
result
if
(
extraInfo
!=
undefined
)
{
onresult
.
CredentialId
=
extraInfo
.
credentialId
}
else
{
onresult
.
CredentialId
=
null
;
}
console
.
info
(
'
testFace publicdelUser delUser =
'
+
JSON
.
stringify
(
onresult
));
callback1
(
onresult
)
},
onAcquireInfo
:
function
(
modulea
,
acquire
,
extr
){
console
.
log
(
"
testFace faceDemo delUser onAcquireInfo in
"
);
onacquireinfo
.
delUsermodule
=
modulea
onacquireinfo
.
delUseracquire
=
acquire
onacquireinfo
.
delUserextr
=
extr
console
.
log
(
"
testFace faceDemo delUser onAcquireInfo =
"
+
JSON
.
stringify
(
onacquireinfo
));
callback2
(
onacquireinfo
)
}
})
}
catch
(
e
)
{
console
.
log
(
"
testFace publicdelUser fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
publicdelCred
(
UserIDM
,
credentialId
,
token
,
callback1
,
callback2
){
console
.
info
(
'
testFace publicdelCred in
'
);
try
{
console
.
info
(
'
testFace publicdelCred in try
'
);
console
.
info
(
'
testFace publicdelCred UserIDM =
'
+
UserIDM
);
let
onresult
=
{
delCredresult
:
null
,
CredentialId
:
null
,
}
let
onacquireinfo
=
{
delCredmodule
:
null
,
delCredacquire
:
null
,
delCredextr
:
null
}
UserIDM
.
delCred
(
credentialId
,
token
,{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
testFace faceDemo delCred result =
"
+
result
)
onresult
.
delCredresult
=
result
console
.
log
(
"
testFace faceDemo delCred extraInfo =
"
+
extraInfo
)
if
(
extraInfo
!=
undefined
)
{
onresult
.
CredentialId
=
extraInfo
.
credentialId
}
else
{
onresult
.
CredentialId
=
null
;
}
console
.
log
(
"
testFace faceDemo delCred onresult =
"
+
JSON
.
stringify
(
onresult
));
callback1
(
onresult
)
},
onAcquireInfo
:
function
(
modulea
,
acquire
,
extr
){
console
.
info
(
'
testFace publicdelCred delCred onAcquireInfo in
'
);
onacquireinfo
.
delCredmodule
=
modulea
onacquireinfo
.
delCredacquire
=
acquire
onacquireinfo
.
delCredextr
=
extr
console
.
log
(
"
testFace faceDemo delCred module =
"
+
modulea
);
console
.
log
(
"
testFace faceDemo delCred onacquireinfo =
"
+
JSON
.
stringify
(
onacquireinfo
));
callback2
(
onacquireinfo
)
}
})
}
catch
(
e
)
{
console
.
log
(
"
testFace publicdelCred fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
publicgetAuthInfo
(
UserIDM
,
authType
,
callback
){
console
.
info
(
'
testFace publicgetAuthInfo in
'
);
try
{
console
.
info
(
'
testFace publicgetAuthInfo in try
'
);
console
.
info
(
'
testFace publicgetAuthInfo UserIDM =
'
+
UserIDM
);
UserIDM
.
getAuthInfo
(
authType
,
function
(
AsyncCallback
)
{
console
.
log
(
"
testFace faceDemo getAuthInfo AsyncCallback =
"
+
JSON
.
stringify
(
AsyncCallback
))
callback
(
AsyncCallback
)
})
}
catch
(
e
)
{
console
.
log
(
"
testFace publicgetAuthInfo fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
publicgetallAuthInfo
(
UserIDM
,
callback
){
console
.
info
(
'
testFace publicgetallAuthInfo in
'
);
try
{
console
.
info
(
'
testFace publicgetallAuthInfo in try
'
);
console
.
info
(
'
testFace publicgetallAuthInfo UserIDM =
'
+
UserIDM
);
UserIDM
.
getAuthInfo
(
function
(
AsyncCallback
)
{
console
.
log
(
"
testFace faceDemo getallAuthInfo AsyncCallback =
"
+
JSON
.
stringify
(
AsyncCallback
))
callback
(
AsyncCallback
)
})
}
catch
(
e
)
{
console
.
log
(
"
testFace publicgetallAuthInfo fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
//同步
function
publicgetAvailabeStatus
(
UserAuth
,
authType
,
authTrustLevel
){
console
.
info
(
'
testFace publicgetAvailableStatus in
'
);
try
{
console
.
info
(
'
testFace publicgetAvailableStatus in try
'
);
console
.
info
(
'
testFace publicgetAvailableStatus UserAuth =
'
+
UserAuth
);
let
AvailabeStatus
=
null
AvailabeStatus
=
UserAuth
.
getAvailableStatus
(
authType
,
authTrustLevel
);
console
.
info
(
'
testFace publicgetAvailableStatus result =
'
+
JSON
.
stringify
(
AvailabeStatus
));
return
AvailabeStatus
}
catch
(
e
)
{
console
.
log
(
"
testFace publicgetAvailableStatus fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
publicgetProperty
(
UserAuth
,
GetPropertyRequest
,
callback
){
console
.
info
(
'
testFace publicgetProperty in
'
);
try
{
console
.
info
(
'
testFace publicgetProperty in try
'
);
console
.
info
(
'
testFace publicgetProperty UserAuth =
'
+
UserAuth
);
UserAuth
.
getProperty
(
GetPropertyRequest
,
function
(
AsyncCallback
)
{
console
.
log
(
"
testFace faceDemo getallAuthInfo AsyncCallback =
"
+
JSON
.
stringify
(
AsyncCallback
))
callback
(
AsyncCallback
)
})
}
catch
(
e
)
{
console
.
log
(
"
testFace publicgetProperty fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
publicsetProperty
(
UserAuth
,
SetPropertyRequest
,
callback
){
console
.
info
(
'
testFace publicsetProperty in
'
);
try
{
console
.
info
(
'
testFace publicsetProperty in try
'
);
console
.
info
(
'
testFace publicsetProperty UserAuth =
'
+
UserAuth
);
UserAuth
.
setProperty
(
SetPropertyRequest
,
function
(
AsyncCallback
)
{
console
.
log
(
"
testFace faceDemo setProperty inside =
"
)
console
.
log
(
"
testFace faceDemo setProperty AsyncCallback =
"
+
JSON
.
stringify
(
AsyncCallback
))
callback
(
AsyncCallback
)
})
}
catch
(
e
)
{
console
.
log
(
"
testFace publicsetProperty fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
publicauth
(
UserAuth
,
challenge
,
authType
,
authTrustLevel
,
callback1
,
callback2
){
console
.
info
(
'
testFace publicauth in
'
);
try
{
console
.
info
(
'
testFace publicauth in try
'
);
console
.
info
(
'
testFace publicauth UserAuth =
'
+
UserAuth
);
let
onresult
=
{
authresult
:
null
,
authextr
:
null
,
}
let
onacquireinfo
=
{
authmodule
:
null
,
authacquire
:
null
,
authextr
:
null
}
let
contextID1
=
null
contextID1
=
UserAuth
.
auth
(
challenge
,
authType
,
authTrustLevel
,{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
testFace faceDemo auth result =
"
+
result
)
onresult
.
authresult
=
result
console
.
log
(
"
testFace faceDemo auth extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
onresult
.
authextr
=
extraInfo
;
console
.
info
(
'
testFace publicauth auth onResult =
'
+
JSON
.
stringify
(
onresult
));
callback1
(
onresult
)
},
onAcquireInfo
:
function
(
modulea
,
acquire
,
extr
){
console
.
info
(
'
faceTest publicauth auth onAcquireInfo in
'
);
onacquireinfo
.
authmodule
=
modulea
;
onacquireinfo
.
authacquire
=
acquire
;
onacquireinfo
.
authextr
=
extr
;
console
.
log
(
"
testFace faceDemo auth module =
"
+
JSON
.
stringify
(
modulea
));
console
.
info
(
'
testFace publicauth auth onAcquireInfo =
'
+
JSON
.
stringify
(
onacquireinfo
));
callback2
(
onacquireinfo
)
}
});
console
.
info
(
'
testFace publicauth auth contextID1 =
'
+
contextID1
);
return
contextID1
}
catch
(
e
)
{
console
.
log
(
"
testFace publicauth fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
publicauthUser
(
UserAuth
,
userID
,
challenge
,
authType
,
authTrustLevel
,
callback1
,
callback2
){
console
.
info
(
'
testFace publicauthUser in
'
);
try
{
console
.
info
(
'
testFace publicauthUser in try
'
);
console
.
info
(
'
testFace publicauthUser UserAuth =
'
+
UserAuth
);
let
onresult
=
{
authresult
:
null
,
authextr
:
null
,
}
let
onacquireinfo
=
{
authmodule
:
null
,
authacquire
:
null
,
authextr
:
null
}
let
contextID1
=
null
contextID1
=
UserAuth
.
authUser
(
userID
,
challenge
,
authType
,
authTrustLevel
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
testFace faceDemo authUser result =
"
+
result
)
onresult
.
authresult
=
result
console
.
log
(
"
testFace faceDemo authUser authextr =
"
+
JSON
.
stringify
(
extraInfo
))
onresult
.
authextr
=
extraInfo
;
console
.
info
(
'
testFace publicauthUser authUser onResult =
'
+
JSON
.
stringify
(
onresult
));
callback1
(
onresult
)
},
onAcquireInfo
:
function
(
modulea
,
acquire
,
extr
){
console
.
info
(
'
testFace publicauthUser authUser onAcquireInfo in
'
);
onacquireinfo
.
authmodule
=
modulea
onacquireinfo
.
authacquire
=
acquire
onacquireinfo
.
authextr
=
extr
console
.
log
(
"
testFace faceDemo authUser module =
"
+
JSON
.
stringify
(
modulea
));
console
.
info
(
'
testFace publicauthUser authUser onacquireinfo =
'
+
JSON
.
stringify
(
onacquireinfo
));
callback2
(
onacquireinfo
)
}
})
console
.
info
(
'
testFace publicauthUser authUser contextID1 =
'
+
contextID1
);
return
contextID1
}
catch
(
e
)
{
console
.
log
(
"
testFace publicauthUser fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
//同步
function
publicgecancelAuth
(
UserAuth
,
contextID
){
console
.
info
(
'
testFace publicgecancelAuth in
'
);
try
{
console
.
info
(
'
testFace publicgecancelAuth in try
'
);
console
.
info
(
'
testFace publicgecancelAuth UserAuth =
'
+
UserAuth
);
let
cancelAuthresult
=
null
cancelAuthresult
=
UserAuth
.
cancelAuth
(
contextID
)
console
.
info
(
'
testFace publicgecancelAuth cancelAuth cancelAuthresult =
'
+
cancelAuthresult
);
return
cancelAuthresult
}
catch
(
e
)
{
console
.
log
(
"
testFace publiccancelAuth fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
export
{
publicRegisterInputer
,
publicgetallAuthInfo
,
publicunRegisterInputer
,
publicOpenSession
,
publicCloseSession
,
publicaddCredential
,
publicupdateCred
,
publiccancel
,
publicdelUser
,
publicdelCred
,
publicgetAuthInfo
,
publicgetAvailabeStatus
,
publicgetProperty
,
publicsetProperty
,
publicauth
,
publicauthUser
,
publicgecancelAuth
}
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_Coauth_DFX_CallbackJsunit.test.js
已删除
100644 → 0
浏览文件 @
d60c9f66
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
userAuth
from
'
@ohos.userAuth
'
import
userIDM
from
'
@ohos.userIDM
'
import
pinAuth
from
'
@ohos.pinAuth
'
import
*
as
publicFC
from
'
./Publicfunction-n
'
let
UserIDM
=
new
userIDM
.
UserIdentityManager
();
let
PinAuth
=
new
pinAuth
.
PINAuth
();
let
UserAuth
=
new
userAuth
.
UserAuth
();
let
AuthType
=
{
PIN
:
1
,
FACE
:
2
}
let
AuthSubType
=
{
PIN_SIX
:
10000
,
PIN_NUMBER
:
10001
,
PIN_MIXED
:
10002
,
FACE_2D
:
20000
,
FACE_3D
:
20001
}
let
AuthTurstLevel
=
{
ATL1
:
10000
,
ATL2
:
20000
,
ATL3
:
30000
,
ATL4
:
40000
}
let
SetPropertyType
=
{
PROCESS_ALGORITHM
:
1
,
}
let
userID
=
{
User1
:
0
,
User2
:
2
,
User3
:
3
,
User4
:
4
,
User5
:
5
}
let
ResultCode
=
{
SUCCESS
:
0
,
FAIL
:
1
,
GENERAL_ERROR
:
2
,
CANCELED
:
3
,
TIMEOUT
:
4
,
TYPE_NOT_SUPPORT
:
5
,
TRUST_LEVEL_NOT_SUPPORT
:
6
,
BUSY
:
7
,
INVALID_PARAMETERS
:
8
,
LOCKED
:
9
,
NOT_ENROLLED
:
10
,
Authfail
:
14
}
let
GetPropertyType
=
{
AUTH_SUB_TYPE
:
1
,
REMAIN_TIMES
:
2
,
FREEZING_TIME
:
3
}
let
Inputerdata
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
]);
let
GetPropertyTypearray
=
new
Array
();
GetPropertyTypearray
[
0
]
=
GetPropertyType
.
AUTH_SUB_TYPE
;
GetPropertyTypearray
[
1
]
=
GetPropertyType
.
FREEZING_TIME
;
GetPropertyTypearray
[
2
]
=
GetPropertyType
.
REMAIN_TIMES
;
let
GetPropertyRequestpin
=
{
authType
:
AuthType
.
PIN
,
keys
:
GetPropertyTypearray
}
let
GetPropertyRequestface
=
{
authType
:
AuthType
.
FACE
,
keys
:
GetPropertyTypearray
}
let
CredentialInfopinsix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_SIX
,
token
:
null
}
let
CredentialInfopinnum
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_NUMBER
,
token
:
null
}
let
CredentialInfopinmix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_MIXED
,
token
:
null
}
let
CredentialInfoface2d
=
{
credType
:
AuthType
.
FACE
,
credSubType
:
AuthSubType
.
FACE_2D
,
token
:
null
}
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
describe
(
'
userauthTest_two1
'
,
function
()
{
it
(
'
Security_IAM_Coauth_DFX_0105
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Coauth_DFX_0105 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
);
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
testFace Security_IAM_Coauth_DFX_0105 publicOpenSession data =
'
+
JSON
.
stringify
(
data
));
let
challenge1
=
data
;
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
testFace Security_IAM_Coauth_DFX_0105 publicOpenSession data =
'
+
JSON
.
stringify
(
data
));
let
challenge2
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
console
.
info
(
'
testFace Security_IAM_Coauth_DFX_0105 callback data =
'
+
JSON
.
stringify
(
data
));
let
token1
;
console
.
info
(
'
testFace Security_IAM_Coauth_DFX_0105 addSuccess
'
);
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
testFace Coauth_DFX_0105 publicauth =
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
testFace Coauth_DFX_0105 publicauth.authresult =
'
+
data
.
authresult
);
console
.
info
(
'
testFace Coauth_DFX_0105 ResultCode.SUCCESS =
'
+
ResultCode
.
SUCCESS
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
data
.
authresult
);
token1
=
data
.
authextr
.
token
;
publicFC
.
publicauth
(
UserAuth
,
challenge2
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
testFace Security_IAM_Coauth_DFX_0105 publicauth
'
);
let
token2
;
token2
=
data
.
authextr
.
token
;
console
.
info
(
'
testFace Coauth_DFX_0105 publicauth.authresult2 =
'
+
data
.
authresult
);
console
.
info
(
'
testFace Coauth_DFX_0105 ResultCode.SUCCESS =
'
+
ResultCode
.
SUCCESS
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
data
.
authresult
);
console
.
info
(
"
testFace Security_IAM_Coauth_DFX_0105 token =
"
+
token2
);
CredentialInfoface2d
.
token
=
token1
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
data
)
{
console
.
info
(
'
testFace Coauth_DFX_0105 addCredresult =
'
+
data
.
addCredresult
);
expect
(
ResultCode
.
FAIL
).
assertEqual
(
data
.
addCredresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token2
,
function
(
data
)
{
console
.
info
(
"
testFace Security_IAM_Coauth_DFX_0105 publicdelUser
"
);
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
"
testFace Coauth_DFX_0105 delUser=
"
+
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
testFace Coauth_DFX_0105 CloseSession=
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace Coauth_DFX_0105 unRegister=
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Coauth_DFX_0105 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Coauth_DFX_0106
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Coauth_DFX_0106 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge1
=
data
;
console
.
info
(
'
Security_IAM_Coauth_DFX_0106 publicOpenSession challenge1 =
'
+
challenge1
);
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge2
=
data
;
console
.
info
(
'
Security_IAM_Coauth_DFX_0106 publicOpenSession challenge2 =
'
+
challenge2
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Coauth_DFX_0106 publicCloseSession data =
'
+
data
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
let
addcredresult101
=
data
.
addCredresult
;
console
.
info
(
'
Security_IAM_Coauth_DFX_0106 addCredential=
'
+
addcredresult101
);
expect
(
ResultCode
.
FAIL
).
assertEqual
(
addcredresult101
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Coauth_DFX_0106 publicunRegisterInputer data =
'
+
data
);
done
();
})
})
})
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Coauth_DFX_0106 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
})
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_Coauth_Func_CallbackJsunit.test.js
已删除
100644 → 0
浏览文件 @
d60c9f66
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
userAuth
from
'
@ohos.userAuth
'
import
userIDM
from
'
@ohos.userIDM
'
import
pinAuth
from
'
@ohos.pinAuth
'
import
*
as
publicFC
from
'
./Publicfunction-n
'
let
UserIDM
=
new
userIDM
.
UserIdentityManager
();
let
PinAuth
=
new
pinAuth
.
PINAuth
();
let
UserAuth
=
new
userAuth
.
UserAuth
();
let
AuthType
=
{
PIN
:
1
,
FACE
:
2
}
let
AuthSubType
=
{
PIN_SIX
:
10000
,
PIN_NUMBER
:
10001
,
PIN_MIXED
:
10002
,
FACE_2D
:
20000
,
FACE_3D
:
20001
}
let
AuthTurstLevel
=
{
ATL1
:
10000
,
ATL2
:
20000
,
ATL3
:
30000
,
ATL4
:
40000
}
let
SetPropertyType
=
{
PROCESS_ALGORITHM
:
1
,
}
let
ResultCode
=
{
SUCCESS
:
0
,
FAIL
:
1
,
GENERAL_ERROR
:
2
,
CANCELED
:
3
,
TIMEOUT
:
4
,
TYPE_NOT_SUPPORT
:
5
,
TRUST_LEVEL_NOT_SUPPORT
:
6
,
BUSY
:
7
,
INVALID_PARAMETERS
:
8
,
LOCKED
:
9
,
NOT_ENROLLED
:
10
,
AUTH_FAIL
:
14
}
let
GetPropertyType
=
{
AUTH_SUB_TYPE
:
1
,
REMAIN_TIMES
:
2
,
FREEZING_TIME
:
3
}
let
Inputerdata
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
]);
let
Inputerdatan
=
new
Uint8Array
([
1
,
1
,
1
,
1
,
1
,
1
]);
let
Inputerdatanum
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
]);
let
Inputerdatanumn
=
new
Uint8Array
([
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
]);
let
Inputerdatamix
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
]);
let
Inputerdatamixn
=
new
Uint8Array
([
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
]);
let
GetPropertyTypearray
=
new
Array
();
GetPropertyTypearray
[
0
]
=
GetPropertyType
.
AUTH_SUB_TYPE
;
GetPropertyTypearray
[
1
]
=
GetPropertyType
.
FREEZING_TIME
;
GetPropertyTypearray
[
2
]
=
GetPropertyType
.
REMAIN_TIMES
;
let
GetPropertyRequestpin
=
{
authType
:
AuthType
.
PIN
,
keys
:
GetPropertyTypearray
}
let
GetPropertyRequestface
=
{
authType
:
AuthType
.
FACE
,
keys
:
GetPropertyTypearray
}
let
CredentialInfopinsix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_SIX
,
token
:
null
}
let
CredentialInfopinnum
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_NUMBER
,
token
:
null
}
let
CredentialInfopinmix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_MIXED
,
token
:
null
}
let
CredentialInfoface2d
=
{
credType
:
AuthType
.
FACE
,
credSubType
:
AuthSubType
.
FACE_2D
,
token
:
null
}
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
describe
(
'
userauthTest_two2
'
,
function
()
{
/*
* @tc.number : testGetEntriesString101
* @tc.name : Use getEntries get the value by mixing the string key
* @tc.desc : Mixed strings value can be obtained correctly
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 1
*/
it
(
'
Security_IAM_Coauth_Func_0102
'
,
3
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge1
=
data
;
console
.
info
(
'
Coauth_Func_0102 publicOpenSession challenge1 =
'
+
challenge1
);
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge2
=
data
;
console
.
info
(
'
Security_IAM_Coauth_Func_0102 publicOpenSession challenge2 =
'
+
challenge2
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
let
addcredresult101
=
data
.
addCredresult
;
console
.
info
(
'
Security_IAM_Coauth_Func_0102 addcredresult101 =
'
+
addcredresult101
);
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
info101
=
data
.
authresult
;
let
token2
=
data
.
authextr
.
token
console
.
info
(
'
Security_IAM_Coauth_Func_0102 publicauth info101 =
'
+
info101
);
publicFC
.
publicauth
(
UserAuth
,
challenge2
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
info1011
=
data
.
authresult
;
console
.
info
(
'
Security_IAM_Coauth_Func_0102 publicauth info1011 =
'
+
info1011
);
let
token1
=
data
.
authextr
.
token
publicFC
.
publicdelUser
(
UserIDM
,
token2
,
function
(
data
)
{
let
deluserresult
=
data
.
delUserresult
;
expect
(
ResultCode
.
AUTH_FAIL
).
assertEqual
(
deluserresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token1
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Coauth_Func_0102 deluserresult =
'
+
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Coauth_Func_0102 CloseSession =
'
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Coauth_Func_0102 unRegister =
'
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
})
}
catch
(
e
)
{
console
.
log
(
"
testtwochallenge101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Coauth_Func_0104
'
,
3
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
){
let
challenge
=
data
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0104 addCredresult =
'
+
onresult
.
addCredresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0104 addCred onResult =
'
+
JSON
.
stringify
(
onresult
));
let
token
=
onresult
.
authextr
.
token
CredentialInfoface2d
.
token
=
token
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
log
(
"
testFace Coauth_Func_0104 addface=
"
+
onresult
.
addCredresult
)
publicFC
.
publicgetAuthInfo
(
UserIDM
,
AuthType
.
FACE
,
function
(
AsyncCallback
)
{
console
.
log
(
"
testFace Coauth_Func_0104 getAuthInfo=
"
+
JSON
.
stringify
(
AsyncCallback
))
expect
(
AuthSubType
.
FACE_2D
).
assertEqual
(
AsyncCallback
[
0
].
authSubType
);
publicFC
.
publicgetAuthInfo
(
UserIDM
,
AuthType
.
PIN
,
function
(
AsyncCallback
)
{
console
.
log
(
"
testFace Coauth_Func_0104 getAuthInfo =
"
+
JSON
.
stringify
(
AsyncCallback
))
expect
(
AuthSubType
.
PIN_SIX
).
assertEqual
(
AsyncCallback
[
0
].
authSubType
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
onresult
){
let
delresult
=
onresult
.
delUserresult
;
console
.
log
(
"
testFace Coauth_Func_0104 delUser=
"
+
delresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
){
console
.
log
(
"
testFaceCoauth_Func_0104 CloseSession=
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
){
done
();
})
})
},
function
(
onacquireinfo
){
})
})
})
},
function
(
onAcquireInfo
)
{
})
},
function
(
onAcquireInfo
)
{
}
);
},
function
(
onAcquireInfo
)
{
});
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Coauth_Func_0104 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Coauth_Func_0105
'
,
3
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
){
let
challenge
=
data
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
testFace Security_IAM_Coauth_Func_0105 addCredresult =
'
+
onresult
.
addCredresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0105 addCred onResult =
'
+
onresult
.
authresult
);
let
token
=
onresult
.
authextr
.
token
CredentialInfoface2d
.
token
=
token
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0105 addface onResult =
'
+
onresult
.
addCredresult
);
publicFC
.
publicgetAuthInfo
(
UserIDM
,
AuthType
.
PIN
,
function
(
data
){
let
CredInfo
=
data
;
console
.
info
(
'
testFace Coauth_Func_0105 getAuthInfo =
'
+
CredInfo
[
0
].
authSubType
);
expect
(
AuthSubType
.
PIN_SIX
).
assertEqual
(
CredInfo
[
0
].
authSubType
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
onresult
){
console
.
log
(
"
testFace Coauth_Func_0105 delUser =
"
+
onresult
.
delUserresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
){
console
.
log
(
"
testFace Coauth_Func_0105 CloseSession callback =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
){
done
();
});
})
},
function
(
onacquireinfo
){
})
})
},
function
(
onAcquireInfo
)
{
})
},
function
(
onAcquireInfo
)
{
});
},
function
(
onAcquireInfo
)
{
});
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Coauth_Func_0105 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Coauth_Func_0106
'
,
3
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
){
let
challenge
=
data
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0106 addCredresult =
'
+
onresult
.
addCredresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0106 addCred=
'
+
JSON
.
stringify
(
onresult
));
let
token
=
onresult
.
authextr
.
token
CredentialInfoface2d
.
token
=
token
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
log
(
"
testFace Coauth_Func_0106 addCface =
"
+
onresult
.
addCredresult
)
publicFC
.
publicgetallAuthInfo
(
UserIDM
,
function
(
AsyncCallback
)
{
console
.
log
(
"
testFace Coauth_Func_0106 getAuthInfo =
"
+
JSON
.
stringify
(
AsyncCallback
))
expect
(
AuthSubType
.
PIN_SIX
).
assertEqual
(
AsyncCallback
[
1
].
authSubType
);
expect
(
AuthType
.
PIN
).
assertEqual
(
AsyncCallback
[
1
].
authType
);
expect
(
AuthSubType
.
FACE_2D
).
assertEqual
(
AsyncCallback
[
0
].
authSubType
);
expect
(
AuthType
.
FACE
).
assertEqual
(
AsyncCallback
[
0
].
authType
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
onresult
){
console
.
log
(
"
testFace Coauth_Func_0106delUser=
"
+
onresult
.
delUserresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
){
console
.
log
(
"
testFace Coauth_Func_0106 CloseSession =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
){
done
();
})
})
},
function
(
onacquireinfo
){
})
})
},
function
(
onAcquireInfo
)
{
})
},
function
(
onAcquireInfo
)
{
}
);
},
function
(
onAcquireInfo
)
{
});
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Coauth_Func_0106 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Coauth_Func_0108
'
,
3
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
){
let
challenge
=
data
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0108 addCredresult =
'
+
onresult
.
addCredresult
);
console
.
log
(
"
testFace faceDemo Coauth_Func_0108 authUser =
"
+
onresult
.
addCredresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0108 addCred =
'
+
JSON
.
stringify
(
onresult
));
let
token
=
onresult
.
authextr
.
token
CredentialInfoface2d
.
token
=
token
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0108 ddCredentialface=
'
+
onresult
.
authresult
);
console
.
log
(
"
testFace Coauth_Func_0108 addface result =
"
+
onresult
.
addCredresult
)
let
AvailabeStatus
=
publicFC
.
publicgetAvailabeStatus
(
UserAuth
,
AuthType
.
FACE
,
AuthTurstLevel
.
ATL1
)
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
AvailabeStatus
);
AvailabeStatus
=
publicFC
.
publicgetAvailabeStatus
(
UserAuth
,
AuthType
.
FACE
,
AuthTurstLevel
.
ATL2
)
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
AvailabeStatus
);
AvailabeStatus
=
publicFC
.
publicgetAvailabeStatus
(
UserAuth
,
AuthType
.
FACE
,
AuthTurstLevel
.
ATL3
)
expect
(
ResultCode
.
TRUST_LEVEL_NOT_SUPPORT
).
assertEqual
(
AvailabeStatus
);
AvailabeStatus
=
publicFC
.
publicgetAvailabeStatus
(
UserAuth
,
AuthType
.
FACE
,
AuthTurstLevel
.
ATL4
)
expect
(
ResultCode
.
TRUST_LEVEL_NOT_SUPPORT
).
assertEqual
(
AvailabeStatus
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
onresult
){
console
.
log
(
"
testFace Coauth_Func_0108 delUser =
"
+
onresult
.
delUserresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
){
console
.
log
(
"
testFace Coauth_Func_0108 CloseSession callback =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
){
done
();
})
})
},
function
(
onacquireinfo
){
})
},
function
(
onAcquireInfo
)
{
})
},
function
(
onAcquireInfo
)
{
}
);
},
function
(
onAcquireInfo
)
{
});
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Coauth_Func_0108 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Coauth_Func_0109
'
,
2
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
){
let
challenge
=
data
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0108 addCredresult =
'
+
onresult
.
addCredresult
);
console
.
log
(
"
testFace Coauth_Func_0109 authUser result =
"
+
onresult
.
addCredresult
);
let
AvailabeStatus
AvailabeStatus
=
publicFC
.
publicgetAvailabeStatus
(
UserAuth
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
)
console
.
info
(
'
testFace Security_IAM_Coauth_Func_0109 AvailabeStatus1 =
'
+
AvailabeStatus
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
AvailabeStatus
);
AvailabeStatus
=
publicFC
.
publicgetAvailabeStatus
(
UserAuth
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL2
)
console
.
info
(
'
testFace Security_IAM_Coauth_Func_0109 AvailabeStatus2 =
'
+
AvailabeStatus
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
AvailabeStatus
);
AvailabeStatus
=
publicFC
.
publicgetAvailabeStatus
(
UserAuth
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL3
)
console
.
info
(
'
testFace Security_IAM_Coauth_Func_0109 AvailabeStatus3 =
'
+
AvailabeStatus
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
AvailabeStatus
);
AvailabeStatus
=
publicFC
.
publicgetAvailabeStatus
(
UserAuth
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL4
)
console
.
info
(
'
testFace Security_IAM_Coauth_Func_0109 AvailabeStatus4 =
'
+
AvailabeStatus
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
AvailabeStatus
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0109 addCred onResult =
'
+
onresult
.
authresult
);
let
token
=
onresult
.
authextr
.
token
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
onresult
){
console
.
log
(
"
testFace Coauth_Func_0109 delUser result=
"
+
onresult
.
delUserresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
){
console
.
log
(
"
testFace Coauth_Func_0109 CloseSession callback =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
){
done
();
})
})
},
function
(
onacquireinfo
){
})
},
function
(
onAcquireInfo
)
{
}
);
},
function
(
onAcquireInfo
)
{
});
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Coauth_Func_0109 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Coauth_Func_0110
'
,
3
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
){
let
challenge
=
data
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0110 addCredresult =
'
+
onresult
.
addCredresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0110 addCred onResult =
'
+
JSON
.
stringify
(
onresult
));
let
token
=
onresult
.
authextr
.
token
CredentialInfoface2d
.
token
=
token
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
log
(
"
testFace Coauth_Func_0110 ddCredentialface =
"
+
onresult
.
addCredresult
)
publicFC
.
publicgetProperty
(
UserAuth
,
GetPropertyRequestface
,
function
(
onresult
)
{
console
.
log
(
"
testFace Coauth_Func_0110 GetPropertyface =
"
+
JSON
.
stringify
(
onresult
))
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
onresult
.
result
);
expect
(
AuthSubType
.
FACE_2D
).
assertEqual
(
onresult
.
authSubType
);
publicFC
.
publicgetProperty
(
UserAuth
,
GetPropertyRequestpin
,
function
(
onresult
)
{
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
onresult
.
result
);
expect
(
AuthSubType
.
PIN_SIX
).
assertEqual
(
onresult
.
authSubType
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
onresult
){
console
.
log
(
"
testFace Coauth_Func_0110 delUser=
"
+
onresult
.
delUserresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
){
console
.
log
(
"
testFace Coauth_Func_0110 CloseSession callback =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
){
done
();
})
})
},
function
(
onacquireinfo
){
})
})
})
},
function
(
onAcquireInfo
)
{
})
},
function
(
onAcquireInfo
)
{
}
)},
function
(
onAcquireInfo
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Coauth_Func_0110 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Coauth_Func_0112
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Coauth_Func_0112 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge1
=
data
;
console
.
info
(
"
Security_IAM_Coauth_Func_0112 challenge1 =
"
+
challenge1
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
let
addcredresult101
=
data
.
addcredresult
;
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth101
=
data
console
.
info
(
"
Security_IAM_Coauth_Func_0112 auth1 =
"
+
auth101
.
authresult
);
let
token
=
auth101
.
authextr
.
token
console
.
info
(
"
Security_IAM_Coauth_Func_0112 token =
"
+
token
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Security_IAM_Coauth_Func_0112 unRegist =
"
+
data
);
await
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdatan
),
500
)
console
.
info
(
"
Security_IAM_Coauth_Func_0112 challenge2 =
"
+
challenge1
);
await
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Coauth_Func_0112 authresult1 =
"
+
data
.
authresult
);
let
authresult1
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult1
);
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Coauth_Func_0112 authresult2 =
"
+
data
.
authresult
);
let
authresult2
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult2
);
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Coauth_Func_0112 authresult3 =
"
+
data
.
authresult
);
let
authresult3
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult3
);
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
"
Coauth_Func_0112 authresult4 =
"
+
data
.
authresult
);
let
authresult4
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult4
);
publicFC
.
publicgetProperty
(
UserAuth
,
GetPropertyRequestpin
,
function
(
data
){
expect
(
1
).
assertEqual
(
data
.
remainTimes
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Security_IAM_Coauth_Func_0112 unRegist =
"
+
data
);
await
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
),
500
)
console
.
info
(
"
Coauth_Func_0112 challenge2 =
"
+
challenge1
);
await
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
authresult5
=
data
.
authresult
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
authresult5
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
delresult
=
data
.
delUserresult
console
.
info
(
"
Coauth_Func_0112 delresult =
"
+
delresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Coauth_Func_0112 closesession=
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Coauth_Func_0112 unRegist=
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Coauth_Func_0112 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Coauth_Func_0122
'
,
0
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
let
challenge
;
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Coauth_Func_0122 openSession challenge =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
Security_IAM_Coauth_Func_0122 addCredential Result1 =
'
+
JSON
.
stringify
(
onresult
));
let
info101
;
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
Coauth_Func_0122 auth onResult =
'
+
JSON
.
stringify
(
data
));
info101
=
data
;
let
token
=
info101
.
authextr
.
token
;
CredentialInfoface2d
.
token
=
token
;
let
addfaceresult
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
info
(
'
Coauth_Func_0122 addCredential Result2=
'
+
JSON
.
stringify
(
onresult
));
addfaceresult
=
onresult
;
console
.
info
(
'
Coauth_Func_0122 publicaddCredential =
'
+
addfaceresult
.
addCredresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
addfaceresult
.
addCredresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
FACE
,
10000
,
async
function
(
data
)
{
// console.info('testFace AuthTest_0101 onResult = ' + JSON.stringify(data));
let
faceauth101
=
data
;
console
.
info
(
'
Coauth_Func_0122 publicauth =
'
+
faceauth101
.
authresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
faceauth101
.
authresult
);
let
authresult
;
let
contextID
=
await
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
FACE
,
10000
,
function
(
data
)
{
console
.
info
(
'
Coauth_Func_0122 addCred=
'
+
JSON
.
stringify
(
data
.
authresult
));
authresult
=
data
.
authresult
;
},
function
(
onacquireinfo
)
{
})
let
cancelresult
=
publicFC
.
publicgecancelAuth
(
UserAuth
,
contextID
);
await
sleep
(
2500
);
if
(
cancelresult
==
1
){
console
.
info
(
'
AuthTest_0101 cancel = 1 authresult =
'
+
authresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
authresult
);
}
else
if
(
cancelresult
==
0
){
console
.
info
(
'
AuthTest_0101 cancel = 0 authresult =
'
+
authresult
);
console
.
info
(
'
AuthTest_0101 cancel = 0 ResultCode.FAIL =
'
+
ResultCode
.
FAIL
);
expect
(
ResultCode
.
CANCELED
).
assertEqual
(
authresult
);
}
console
.
info
(
'
testFace AuthTest_0101 onResult =
'
+
JSON
.
stringify
(
data
));
await
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
'
AuthTest_0101 delUser =
'
+
JSON
.
stringify
(
data
));
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
AuthTest_0101 closeSession
'
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
AuthTest_0101 unRegister
'
);
done
();
})
})
},
function
(
onacquireinfo
)
{
})
},
function
(
onacquireinfo
)
{
})
},
function
(
onacquireinfo
)
{
})
},
function
(
data
)
{
})
},
function
(
onacquireinfo
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
AuthTest_0101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Coauth_Func_0113
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Coauth_Func_0113 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge1
=
data
;
console
.
info
(
"
Security_IAM_Coauth_Func_0113 challenge1 =
"
+
challenge1
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
let
addcredresult101
=
data
.
addcredresult
;
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth101
=
data
console
.
info
(
"
Security_IAM_Coauth_Func_0113 auth1 =
"
+
auth101
.
authresult
);
let
token
=
auth101
.
authextr
.
token
console
.
info
(
"
Security_IAM_Coauth_Func_0113 token =
"
+
token
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Security_IAM_Coauth_Func_0113 unRegist =
"
+
data
);
await
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdatan
),
500
)
console
.
info
(
"
Security_IAM_Coauth_Func_0113 challenge2 =
"
+
challenge1
);
await
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
authresult1
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult1
);
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
authresult2
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult2
);
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
authresult3
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult3
);
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
authresult4
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult4
);
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
authresult5
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult5
);
publicFC
.
publicgetProperty
(
UserAuth
,
GetPropertyRequestpin
,
function
(
data
){
expect
(
0
).
assertEqual
(
data
.
remainTimes
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Coauth_Func_0113 unRegist =
"
+
data
);
await
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
),
500
)
console
.
info
(
"
Coauth_Func_0113 challenge2 =
"
+
challenge1
);
await
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
async
function
(
data
)
{
let
authresult6
=
data
.
authresult
expect
(
ResultCode
.
LOCKED
).
assertEqual
(
authresult6
);
// await sleep(181000);
// await publicFC.publicauth(UserAuth, challenge1, AuthType.PIN, AuthTurstLevel.ATL1, async function (data) {
// let authresult7 = data.authresult
// expect(ResultCode.SUCCESS).assertEqual(authresult7);
// publicFC.publicdelUser(UserIDM, token, function (data) {
// let delresult = data.delUserresult
// console.info("Security_IAM_Coauth_Func_0113 delresult = " + delresult);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
closesession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
unRegist =
"
+
data
);
done
();
})
})
// }, function (data) {
// })
// }, function (data) {
// })
},
function
(
data
)
{
})
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Coauth_Func_0112 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
})
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_Face_DFX_CallbackJsunit.test.js
已删除
100644 → 0
浏览文件 @
d60c9f66
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
userAuth
from
'
@ohos.userAuth
'
import
userIDM
from
'
@ohos.userIDM
'
import
pinAuth
from
'
@ohos.pinAuth
'
import
*
as
publicFC
from
'
./Publicfunction-n
'
let
UserIDM
=
new
userIDM
.
UserIdentityManager
();
let
PinAuth
=
new
pinAuth
.
PINAuth
();
let
UserAuth
=
new
userAuth
.
UserAuth
();
let
AuthType
=
{
PIN
:
1
,
FACE
:
2
}
let
AuthSubType
=
{
PIN_SIX
:
10000
,
PIN_NUMBER
:
10001
,
PIN_MIXED
:
10002
,
FACE_2D
:
20000
,
FACE_3D
:
20001
}
let
AuthTurstLevel
=
{
ATL1
:
10000
,
ATL2
:
20000
,
ATL3
:
30000
,
ATL4
:
40000
}
let
SetPropertyType
=
{
PROCESS_ALGORITHM
:
1
,
}
let
userID
=
{
User1
:
0
,
User2
:
2
,
User3
:
3
,
User4
:
4
,
User5
:
5
}
let
ResultCode
=
{
SUCCESS
:
0
,
FAIL
:
1
,
GENERAL_ERROR
:
2
,
CANCELED
:
3
,
TIMEOUT
:
4
,
TYPE_NOT_SUPPORT
:
5
,
TRUST_LEVEL_NOT_SUPPORT
:
6
,
BUSY
:
7
,
INVALID_PARAMETERS
:
8
,
LOCKED
:
9
,
NOT_ENROLLED
:
10
,
Authfail
:
14
}
let
GetPropertyType
=
{
AUTH_SUB_TYPE
:
1
,
REMAIN_TIMES
:
2
,
FREEZING_TIME
:
3
}
let
Inputerdata
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
]);
let
GetPropertyTypearray
=
new
Array
();
GetPropertyTypearray
[
0
]
=
GetPropertyType
.
AUTH_SUB_TYPE
;
GetPropertyTypearray
[
1
]
=
GetPropertyType
.
FREEZING_TIME
;
GetPropertyTypearray
[
2
]
=
GetPropertyType
.
REMAIN_TIMES
;
let
GetPropertyRequestpin
=
{
authType
:
AuthType
.
PIN
,
keys
:
GetPropertyTypearray
}
let
GetPropertyRequestface
=
{
authType
:
AuthType
.
FACE
,
keys
:
GetPropertyTypearray
}
let
CredentialInfopinsix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_SIX
,
token
:
null
}
let
CredentialInfopinnum
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_NUMBER
,
token
:
null
}
let
CredentialInfopinmix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_MIXED
,
token
:
null
}
let
CredentialInfoface2d
=
{
credType
:
AuthType
.
FACE
,
credSubType
:
AuthSubType
.
FACE_2D
,
token
:
null
}
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
describe
(
'
userauthTest_two3
'
,
function
()
{
it
(
'
Security_IAM_Face_AddCred_DFX_0103
'
,
2
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0103 challenge =
"
+
challenge
)
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
console
.
info
(
'
testFace aaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbb
'
);
console
.
info
(
'
testFace data =
'
+
data
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
info101
=
data
;
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0103 info101 =
"
+
info101
);
let
token
=
info101
.
authextr
.
token
;
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0103 token =
"
+
token
)
CredentialInfoface2d
.
token
=
token
;
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0103 deluserresult =
"
+
deluserresult
)
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
data
)
{
let
addfaceresult
=
data
.
addCredresult
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0103 addfaceresult =
"
+
addfaceresult
);
console
.
info
(
"
Face_AddCred_DFX_0103 addfaceresult =
"
+
typeof
(
addfaceresult
));
console
.
info
(
"
Face_AddCred_DFX_0103 ResultCode.Authfail =
"
+
ResultCode
.
Authfail
);
console
.
info
(
"
Face_AddCred_DFX_0103 =
"
+
typeof
(
ResultCode
.
Authfail
));
expect
(
ResultCode
.
FAIL
).
assertEqual
(
addfaceresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0103 closesession =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0103 unRegist =
"
+
data
)
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Face_AddCred_DFX_0103 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Face_AddCred_DFX_0104
'
,
2
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0104 challenge =
"
+
challenge
)
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0104 info101 =
"
+
JSON
.
stringify
(
data
))
let
token
=
data
.
authextr
.
token
CredentialInfoface2d
.
token
=
token
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0104 token =
"
+
token
)
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
data
)
{
console
.
info
(
"
Face_AddCred_DFX_0104 addfaceresult1 =
"
+
JSON
.
stringify
(
data
))
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
data
.
addCredresult
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
data
)
{
console
.
info
(
"
Face_AddCred_DFX_0104 addfaceresult2 =
"
+
JSON
.
stringify
(
data
))
expect
(
ResultCode
.
FAIL
).
assertEqual
(
data
.
addCredresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
deluserresult
=
data
.
delUserresult
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0104 deluserresult =
"
+
deluserresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0104 closesession =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_AddCred_DFX_0104 unRegist =
"
+
data
)
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Face_AddCred_DFX_0104 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Face_Delet_DFX_0104
'
,
2
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Delet_DFX_0104 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
"
Security_IAM_Face_Delet_DFX_0104 challenge =
"
+
challenge
)
publicFC
.
publicdelCred
(
UserIDM
,
"
credentialId
"
,
"
token
"
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_Delet_DFX_0104 info101 =
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
Security_IAM_Face_Delet_DFX_0104 delCredresult =
"
+
data
.
delCredresult
)
console
.
info
(
"
Security_IAM_Face_Delet_DFX_0104 ResultCode.FAIL =
"
+
ResultCode
.
FAIL
)
expect
(
ResultCode
.
Authfail
).
assertEqual
(
data
.
delCredresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_Delet_DFX_0104 closesession =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_Delet_DFX_0104 unRegist =
"
+
data
)
done
();
})
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Face_Delet_DFX_0104 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Face_Delet_DFX_0105
'
,
2
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
console
.
info
(
"
testFace Security_IAM_Face_Delet_DFX_0105 challenge =
"
+
challenge
)
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
publicFC
.
publicdelCred
(
UserIDM
,
"
credentialId
"
,
"
token
"
,
function
(
data
)
{
let
info102
=
data
console
.
info
(
"
testFace Security_IAM_Face_Delet_DFX_0105 info102 =
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
testFace Security_IAM_Face_Delet_DFX_0105 delCredresult =
"
+
data
.
delCredresult
);
console
.
info
(
"
testFace Face_Delet_DFX_0105 ResultCode.FAIL =
"
+
ResultCode
.
Authfail
);
expect
(
ResultCode
.
Authfail
).
assertEqual
(
info102
.
delCredresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
FACE
,
AuthTurstLevel
.
ATL1
,
function
(
data
){
let
info101
=
data
console
.
info
(
"
testFace Security_IAM_Face_Delet_DFX_0105 info101 =
"
+
JSON
.
stringify
(
data
))
let
token
=
info101
.
authextr
.
token
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
deluserresult
=
data
.
delUserresult
console
.
info
(
"
testFace Face_Delet_DFX_0105 deluserresult =
"
+
deluserresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
testFace Security_IAM_Face_Delet_DFX_0105 closesession =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace Security_IAM_Face_Delet_DFX_0105 unRegist =
"
+
data
)
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Face_Delet_DFX_0105 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Face_Auth_DFX_0101
'
,
2
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Auth_DFX_0101 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0101 challenge =
"
+
challenge
)
publicFC
.
publicauth
(
UserAuth
,
"
challenge
"
,
AuthType
.
FACE
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0101 info101 =
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0101 delCredresult =
"
+
data
.
authresult
)
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0101 ResultCode.FAIL =
"
+
ResultCode
.
FAIL
)
expect
(
ResultCode
.
FAIL
).
assertEqual
(
data
.
authresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0101 closesession =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0101 unRegist =
"
+
data
)
done
();
})
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Face_Auth_DFX_0101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Face_Auth_DFX_0102
'
,
2
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0102 challenge =
"
+
JSON
.
stringify
(
data
))
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
info101
=
data
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0102 info101 =
"
+
JSON
.
stringify
(
data
))
let
token
=
info101
.
authextr
.
token
CredentialInfoface2d
.
token
=
token
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0102 token =
"
+
token
)
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
FACE
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
info102
=
data
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0102 info102 =
"
+
JSON
.
stringify
(
data
))
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0102 info102.authresult =
"
+
data
.
authresult
)
expect
(
ResultCode
.
FAIL
).
assertEqual
(
info102
.
authresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
deluserresult
=
data
.
delUserresult
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0102 deluserresult =
"
+
deluserresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0102 closesession =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0102 unRegist =
"
+
data
)
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Face_Auth_DFX_0102 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Face_Auth_DFX_0104
'
,
2
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0104 challenge =
"
+
challenge
)
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
info101
=
data
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0104 info101 =
"
+
JSON
.
stringify
(
data
))
let
token
=
info101
.
authextr
.
token
CredentialInfoface2d
.
token
=
token
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0104 token =
"
+
token
)
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
data
)
{
let
addfaceresult
=
data
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0104 addfaceresult =
"
+
JSON
.
stringify
(
data
))
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
addfaceresult
.
addCredresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
deluserresult
=
data
.
delUserresult
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0104 deluserresult =
"
+
deluserresult
)
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
FACE
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
info102
=
data
;
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0104 info102 =
"
+
JSON
.
stringify
(
data
))
expect
(
ResultCode
.
FAIL
).
assertEqual
(
info102
.
authresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0104 closesession =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_Face_Auth_DFX_0104 unRegist =
"
+
data
)
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Face_Auth_DFX_0104 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Face_AddCred_DFX_0101
'
,
0
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge2
;
challenge2
=
data
;
let
challenge1
;
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_AddCred_DFX_0101 openSession challenge =
'
+
JSON
.
stringify
(
data
));
challenge1
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
Face_AddCred_DFX_0101 addCredential Result1 =
'
+
JSON
.
stringify
(
onresult
));
let
info101
;
let
info102
;
publicFC
.
publicauth
(
UserAuth
,
challenge2
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
){
console
.
info
(
'
Security_IAM_Face_AddCred_DFX_0101 auth=
'
+
JSON
.
stringify
(
data
));
info102
=
data
;
let
token1
=
info102
.
authextr
.
token
;
CredentialInfoface2d
.
token
=
token1
;
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_AddCred_DFX_0101 auth =
'
+
JSON
.
stringify
(
data
));
info101
=
data
;
let
token2
=
info101
.
authextr
.
token
;
let
addfaceresult
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
info
(
'
Face_AddCred_DFX_0101 addCredential=
'
+
JSON
.
stringify
(
onresult
));
console
.
info
(
'
Face_AddCred_DFX_0101 addCredential=
'
+
onresult
.
addCredresult
);
console
.
info
(
'
Face_AddCred_DFX_0101 ResultCode.FAIL=
'
+
ResultCode
.
FAIL
);
addfaceresult
=
onresult
;
expect
(
ResultCode
.
FAIL
).
assertEqual
(
addfaceresult
.
addCredresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token2
,
function
(
data
)
{
console
.
info
(
'
Face_AddCred_DFX_0101 delUser=
'
+
JSON
.
stringify
(
data
));
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_AddCred_DFX_0101 closeSession
'
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_AddCred_DFX_0101 unRegister
'
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Face_AddCred_DFX_0101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Face_Delet_DFX_0101
'
,
0
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
let
challenge
;
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_Delet_DFX_0101 openSession challenge =
'
+
JSON
.
stringify
(
data
));
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
Face_Delet_DFX_0101 addCredential Result1 =
'
+
JSON
.
stringify
(
onresult
));
let
info101
;
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_Delet_DFX_0101 auth onResult =
'
+
JSON
.
stringify
(
data
));
info101
=
data
;
let
token
=
info101
.
authextr
.
token
;
CredentialInfoface2d
.
token
=
token
;
let
addfaceresult
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
info
(
'
Security_IAM_Face_Delet_DFX_0101 addCredential=
'
+
JSON
.
stringify
(
onresult
));
addfaceresult
=
onresult
;
let
credentialId
=
addfaceresult
.
credentialId
;
let
delcredresult
;
let
wrongtoken
=
token
+
'
wrong
'
;
publicFC
.
publicdelCred
(
UserIDM
,
credentialId
,
wrongtoken
,
function
(
data
)
{
console
.
info
(
'
testFace Face_Delet_DFX_0101 del=
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
testFace Face_Delet_DFX_0101 ResultCode.FAIL=
'
+
ResultCode
.
FAIL
);
delcredresult
=
data
;
expect
(
ResultCode
.
Authfail
).
assertEqual
(
delcredresult
.
delCredresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
'
Face_Delet_DFX_0101 delUser=
'
+
JSON
.
stringify
(
data
));
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_Delet_DFX_0101 closeSession
'
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_Delet_DFX_0101 unRegister
'
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
onacquireinfo
)
{
})
},
function
(
onacquireinfo
)
{
})
},
function
(
data
)
{
})
},
function
(
onacquireinfo
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Face_AddCred_Func_0101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
// it('testcancelauthpinwitholdcontextID101', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_SIX, Inputerdata)
// publicFC.publicOpenSession(UserIDM, function (data) {
// let challenge1 = data
// console.info("testcancelauthpinwitholdcontextID101 challenge1 = " + challenge1)
// publicFC.publicaddCredential(UserIDM, CredentialInfopinsix, function (data) {
// let addcredresult101 = data
// console.info("testcancelauthpinwitholdcontextID101 addcredresult101 = " + addcredresult101)
// let contextID1 = null
// publicFC.publicauth(UserAuth, challenge1, AuthType.PIN, AuthTurstLevel.ATL1, function (data) {
// let authinfo101 = data
// contextID1 = UserAuth.authUser(userID, challenge1, AuthType.PIN, AuthTurstLevel.ATL1,
// async function (data) {
// await sleep(5000);
// let cancelresult = publicFC.publicgecancelAuth(UserAuth, authinfo101.contextID)
// console.info("testcancelauthpinwitholdcontextID101 cancelresult = " + cancelresult)
// expect(ResultCode.FAIL).assertEqual(authinfo101.contextID);
// cancelresult = publicFC.publicgecancelAuth(UserAuth, contextID1)
// expect(ResultCode.SUCCESS).assertEqual(contextID1);
// publicFC.publicauth(UserAuth, challenge1, AuthType.PIN, AuthTurstLevel.ATL1,
// function (data) {
// let info1011 = data
// console.info("testcancelauthpinwitholdcontextID101 info1011 = " + info1011)
// let token = info1011.extraInfo.token
// console.info("testcancelauthpinwitholdcontextID101 token = " + token)
// publicFC.publicdelUser(UserIDM, token, function (data) {
// let deluserresult = data.delUserresult
// console.info("testcancelauthpinwitholdcontextID deluserresult =" + deluserresult)
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info("testcancelauthpinwitholdcontextID101 closesession = " + data)
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info("testcancelauthpinwitholdcontextID101 unRegist = " + data)
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// })
// }, function (data) {
// })
// }, function (data) {
// })
// }, function (data) {
// })
//
// })
//
// } catch (e) {
// console.log("testcancelauthwitholdchallenge101 fail " + e);
// expect(null).assertFail();
// }
// })
//
// it('testaddpincancelwitholdchallenge101', 0, async function (done) {
// console.info('testFace testaddpincancelwitholdchallenge101 start');
// try {
// publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_MIXED, Inputerdata)
// publicFC.publicOpenSession(UserIDM, function (data) {
// let challenge = data
// console.info("testaddpincancelwitholdchallenge101 challenge = " + data)
// publicFC.publicOpenSession(UserIDM, function (data) {
// let challenge1 = data
// console.info("testaddpincancelwitholdchallenge101 challenge1 = " + data)
// UserIDM.updateCredential(CredentialInfopinsix, async function (data) {
// await sleep(5000);
// let cancelresult = publicFC.publiccancel(UserIDM, challenge)
// console.info("testaddpincancelwitholdchallenge101 cancelresult = " + cancelresult)
// expect(ResultCode.FAIL).assertEqual(cancelresult);
// let cancelresult1 = publicFC.publiccancel(UserIDM, challenge1)
// console.info("testaddpincancelwitholdchallenge101 cancelresult1 = " + cancelresult1)
// expect(ResultCode.SUCCESS).assertEqual(cancelresult1);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info("testaddpincancelwitholdchallenge101 closesession = " + data)
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info("testaddpincancelwitholdchallenge101 unRegist = " + data)
// done();
// })
// })
// }, function (data) {
// })
//
// })
//
// })
//
// } catch (e) {
// console.log("testaddpincancelwitholdchallenge101 fail " + e);
// expect(null).assertFail();
// }
// })
//
// it('testaddfacecancelwitholdchallenge101', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_SIX, Inputerdata)
// publicFC.publicOpenSession(UserIDM, function (data) {
// let challenge1 = data;
// console.info("testaddfacecancelwitholdchallenge101 challenge1 = " + challenge1)
// publicFC.publicOpenSession(UserIDM, function (data) {
// let challenge2 = data;
// console.info("testaddfacecancelwitholdchallenge101 challenge2 = " + challenge2)
// publicFC.publicaddCredential(UserIDM, CredentialInfopinsix, function (data) {
// let info101 = publicFC.publicauth(UserAuth, challenge2, AuthType.PIN, AuthTurstLevel.ATL1)
// let token = info101.extraInfo.token
// CredentialInfoface2d.token = token
// console.info("testaddfacecancelwitholdchallenge101 token = " + token)
// UserIDM.addCredential(CredentialInfoface2d, async function (data) {
// let result1 = data.addCredresult
// console.info("testaddfacecancelwitholdchallenge101 result1 = " + result1)
// await sleep(3000);
// let cancelresult = publicFC.publiccancel(UserIDM, challenge1)
// console.info("testaddfacecancelwitholdchallenge101 cancelresult = " + cancelresult)
// expect(ResultCode.FAIL).assertEqual(cancelresult);
// let cancelresult2 = publicFC.publiccancel(UserIDM, challenge2)
// console.info("testaddfacecancelwitholdchallenge101 cancelresult2 = " + cancelresult2)
// expect(ResultCode.SUCCESS).assertEqual(cancelresult);
// expect(ResultCode.CANCELED).assertEqual(result1);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info("testaddfacecancelwitholdchallenge101 closesession = " + data)
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info("testaddfacecancelwitholdchallenge101 unRegist = " + data)
// done();
// })
// })
// }, function (data) {
// })
//
// }, function (data) {
// })
//
// })
//
// })
//
// } catch (e) {
// console.log("testaddfacecancel101 fail " + e);
// expect(null).assertFail();
// }
// })
//
// it('testcancelauthfacewitholdcontextID101', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_SIX, Inputerdata)
// publicFC.publicOpenSession(UserIDM, function (data) {
// let challenge = data
// console.info("testcancelauthfacewitholdcontextID101 challenge = " + challenge)
// publicFC.publicaddCredential(UserIDM, CredentialInfopinsix, function (data) {
// let info101 = publicFC.publicauth(UserAuth, challenge, AuthType.PIN, AuthTurstLevel.ATL1)
// console.info("testcancelauthfacewitholdcontextID101 info101 = " + info101)
// let token = info101.extraInfo.token
// CredentialInfoface2d.token = token
// console.info("testcancelauthfacewitholdcontextID101 token = " + token)
// publicFC.publicaddCredential(UserIDM, CredentialInfoface2d, function (data) {
// let addfaceresult = data.addCredresult
// console.info("testcancelauthfacewitholdcontextID101 addfaceresult = " + addfaceresult)
// let contextID1 = null
// publicFC.publicauth(UserAuth, challenge, AuthType.PIN, AuthTurstLevel.ATL1,function(data){
// let authinfo101 = data
// contextID1 = UserAuth.auth(challenge, AuthType.FACE, AuthTurstLevel.ATL1,
// async function(data){
// await sleep(3000);
// let authfacecancel101 = publicFC.publicgecancelAuth(UserAuth, authinfo101.contextID)
// console.info("testcancelauthfacewitholdcontextID101 cancel101=" + authfacecancel101)
// expect(ResultCode.FAIL).assertEqual(authfacecancel101);
// let authfacecancel1011 = publicFC.publicgecancelAuth(UserAuth, contextID1);
// console.info("testcancelauthfacewitholdcontextID101 cancel = " + authfacecancel1011)
// expect(ResultCode.CANCELED).assertEqual(authfacecancel1011);
// publicFC.publicdelUser(UserIDM, token, function (data) {
// let deluserresult = data.delUserresult
// console.info("testcancelauthfacewitholdcontextID101 delresult =" + deluserresult)
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info("testcancelauthfacewitholdcontextID101 closesession = " + data)
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info("testcancelauthfacewitholdcontextID101 unRegist = " + data)
// done();
// })
// })
// }, function (data) {
// })
// },function(data){})
//
// },function(data){})
//
// }, function (data) {})
// }, function (data) {})
// })
// } catch (e) {
// console.log("testauthfacecancel101 fail " + e);
// expect(null).assertFail();
// }
// })
})
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_Face_Func_CallbackJsunit.test.js
已删除
100644 → 0
浏览文件 @
d60c9f66
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
userAuth
from
'
@ohos.userAuth
'
import
userIDM
from
'
@ohos.userIDM
'
import
pinAuth
from
'
@ohos.pinAuth
'
import
*
as
publicFC
from
'
./Publicfunction-n.js
'
let
UserIDM
=
new
userIDM
.
UserIdentityManager
();
let
PinAuth
=
new
pinAuth
.
PINAuth
();
let
UserAuth
=
new
userAuth
.
UserAuth
();
let
AuthType
=
{
PIN
:
1
,
FACE
:
2
}
let
AuthSubType
=
{
PIN_SIX
:
10000
,
PIN_NUMBER
:
10001
,
PIN_MIXED
:
10002
,
FACE_2D
:
20000
,
FACE_3D
:
20001
}
let
AuthTurstLevel
=
{
ATL1
:
10000
,
ATL2
:
20000
,
ATL3
:
30000
,
ATL4
:
40000
}
let
SetPropertyType
=
{
PROCESS_ALGORITHM
:
1
,
}
let
userID
=
{
User1
:
100
,
User2
:
2
,
User3
:
3
,
User4
:
4
,
User5
:
5
}
let
ResultCode
=
{
SUCCESS
:
0
,
FAIL
:
1
,
GENERAL_ERROR
:
2
,
CANCELED
:
3
,
TIMEOUT
:
4
,
TYPE_NOT_SUPPORT
:
5
,
TRUST_LEVEL_NOT_SUPPORT
:
6
,
BUSY
:
7
,
INVALID_PARAMETERS
:
8
,
LOCKED
:
9
,
NOT_ENROLLED
:
10
,
Authfail
:
14
}
let
GetPropertyType
=
{
AUTH_SUB_TYPE
:
1
,
REMAIN_TIMES
:
2
,
FREEZING_TIME
:
3
}
let
Inputerdata
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
]);
let
GetPropertyTypearray
=
new
Array
();
GetPropertyTypearray
[
0
]
=
GetPropertyType
.
AUTH_SUB_TYPE
;
GetPropertyTypearray
[
1
]
=
GetPropertyType
.
FREEZING_TIME
;
GetPropertyTypearray
[
2
]
=
GetPropertyType
.
REMAIN_TIMES
;
let
GetPropertyRequestpin
=
{
authType
:
AuthType
.
PIN
,
keys
:
GetPropertyTypearray
}
let
GetPropertyRequestface
=
{
authType
:
AuthType
.
FACE
,
keys
:
GetPropertyTypearray
}
let
CredentialInfopinsix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_SIX
,
token
:
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
])
}
let
CredentialInfopinnum
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_NUMBER
,
token
:
null
}
let
CredentialInfopinmix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_MIXED
,
token
:
null
}
let
CredentialInfoface2d
=
{
credType
:
AuthType
.
FACE
,
credSubType
:
AuthSubType
.
FACE_2D
,
token
:
null
}
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
describe
(
'
userauthTest_two4
'
,
function
()
{
it
(
'
Security_IAM_Face_AddCred_Func_0101
'
,
0
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
let
challenge
;
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_AddCred_Func_0101 openSession challenge =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
Face_AddCred_Func_0101 addCredential Result1 =
'
+
JSON
.
stringify
(
onresult
));
let
info101
;
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_AddCred_Func_0101 auth onResult =
'
+
JSON
.
stringify
(
data
));
info101
=
data
;
let
token
=
info101
.
authextr
.
token
;
CredentialInfoface2d
.
token
=
token
;
let
addfaceresult
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
info
(
'
Face_AddCred_Func_0101 addCredential Result2=
'
+
JSON
.
stringify
(
onresult
));
addfaceresult
=
onresult
;
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
addfaceresult
.
addCredresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
FACE
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
testFace Face_AddCred_Func_0101 onResult =
'
+
JSON
.
stringify
(
data
));
let
faceauth101
=
data
;
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
faceauth101
.
authresult
);
publicFC
.
publicauthUser
(
UserAuth
,
userID
.
User1
,
challenge
,
AuthType
.
FACE
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
testFace Face_AddCred_Func_0101 onResult=
'
+
JSON
.
stringify
(
data
));
faceauth101
=
data
;
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
faceauth101
.
authresult
);
let
credentialId
=
addfaceresult
.
credentialId
;
let
delcredresult
;
publicFC
.
publicdelCred
(
UserIDM
,
credentialId
,
token
,
function
(
data
)
{
console
.
info
(
'
testFace Face_AddCred_Func_0101 del=
'
+
JSON
.
stringify
(
data
));
delcredresult
=
data
;
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
delcredresult
.
delCredresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
'
Face_AddCred_Func_0101 delUser=
'
+
JSON
.
stringify
(
data
));
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_AddCred_Func_0101 closeSession
'
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_AddCred_Func_0101 unRegister
'
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
onacquireinfo
)
{
})
},
function
(
onacquireinfo
)
{
})
},
function
(
onacquireinfo
)
{
})
},
function
(
onacquireinfo
)
{
})
},
function
(
data
)
{
})
},
function
(
onacquireinfo
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Face_AddCred_Func_0101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_Face_AddCred_Func_0103
'
,
0
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
let
challenge
;
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_AddCred_Func_0103 openSession challenge =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
Face_AddCred_Func_0103 addCredential Result1 =
'
+
JSON
.
stringify
(
onresult
));
let
info101
;
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
async
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_AddCred_Func_0103 auth onResult =
'
+
JSON
.
stringify
(
data
));
info101
=
data
;
let
token
=
info101
.
authextr
.
token
;
CredentialInfoface2d
.
token
=
token
;
let
addfaceresult
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
info
(
'
Face_AddCred_Func_0103 addCredential Result2=
'
+
JSON
.
stringify
(
onresult
));
addfaceresult
=
onresult
;
},
function
(
onacquireinfo
)
{
})
let
cancelresult
=
publicFC
.
publiccancel
(
UserIDM
,
challenge
);
await
sleep
(
2500
);
if
(
cancelresult
==
1
){
console
.
info
(
'
Face_AddCred_Func_0103 cancel1 authresult =
'
+
addfaceresult
.
addCredresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
addfaceresult
.
addCredresult
);
}
else
if
(
cancelresult
==
0
){
console
.
info
(
'
Face_AddCred_Func_0103 cancel0 authresult =
'
+
addfaceresult
.
addCredresult
);
expect
(
ResultCode
.
CANCELED
).
assertEqual
(
addfaceresult
.
addCredresult
);
}
await
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
'
Face_AddCred_Func_0103 delUser=
'
+
JSON
.
stringify
(
data
));
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_AddCred_Func_0103 closeSession
'
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_Face_AddCred_Func_0103 unRegister
'
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
onacquireinfo
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Face_AddCred_Func_0101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
// it('testaddfacecancel101', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth,AuthSubType.PIN_SIX,Inputerdata);
// let challenge;
// let result1 = null;
// let extraInfo1 = null;
// let module1 = null;
// let acquire1 = null;
// let extr1 = null;
// let token;
// publicFC.publicOpenSession(UserIDM, function (data) {
// console.info('testFace testaddfacecancel101 OpenSession challenge = ' + data);
// challenge = data;
// publicFC.publicaddCredential(UserIDM,CredentialInfopinsix, function (data) {
// console.info('testFace testaddfacecancel101 addCredential onResult = ' + JSON.stringify(data));
// let info101;
// publicFC.publicauth(UserAuth,challenge,AuthType.PIN,AuthTurstLevel.ATL1, function (data) {
// console.info('testFace testaddfacecancel101 publicauth onResult = ' + JSON.stringify(data));
// info101 = data;
// token = info101.authextr.token
// CredentialInfoface2d.token = token
// UserIDM.addCredential(CredentialInfoface2d, {
// onResult: function(result,extraInfo){
// console.log(result)
// result1 = result
// extraInfo1 = extraInfo.credentialId
// },
// onAcquireInfo:function (module,acquire,extr){
// module1 = module
// acquire1 = acquire
// extr1 = extr
// console.info(module);
// }
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
// await sleep(13000);
// let cancelresult = publicFC.publiccancel(UserIDM,challenge)
// expect(ResultCode.SUCCESS).assertEqual(cancelresult);
// await sleep(1000);
// expect(ResultCode.CANCELED).assertEqual(result1);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info('testFace testaddfacecancel101 publicCloseSession ');
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info('testFace testaddfacecancel101 publicunRegisterInputer ');
// })
// done();
// })
// } catch (e) {
// console.log("testaddfacecancel101 fail " + e);
// expect(null).assertFail();
// }
// })
//
// it('testaddfacecancel102', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth,AuthSubType.PIN_SIX,Inputerdata);
// let challenge;
// publicFC.publicOpenSession(UserIDM, function (data) {
// console.info('testFace testaddfacecancel102 OpenSession challenge = ' + data);
// challenge = data;
// publicFC.publicaddCredential(UserIDM,CredentialInfopinsix, function (data) {
// console.info('testFace testaddfacecancel102 addCredential onResult = ' + JSON.stringify(data));
// let info101;
// publicFC.publicauth(UserAuth,challenge,AuthType.PIN,AuthTurstLevel.ATL1,async function (data) {
// console.info('testFace testaddfacecancel102 publicauth onResult = ' + JSON.stringify(data));
// info101 = data;
// let token = info101.authextr.token
// CredentialInfoface2d.token = token
// let result1 = null
// let extraInfo1 = null
// let module1 = null
// let acquire1 = null
// let extr1 = null
// await UserIDM.addCredential(CredentialInfoface2d, {
// onResult: function(result,extraInfo){
// console.log(result)
// result1 = result
// extraInfo1 = extraInfo.credentialId
// },
// onAcquireInfo:function (module,acquire,extr){
// module1 = module
// acquire1 = acquire
// extr1 = extr
// console.info(module);
// }
// })
// await sleep(3000);
// let cancelresult = publicFC.publiccancel(UserIDM,challenge)
// expect(ResultCode.SUCCESS).assertEqual(cancelresult);
// expect(ResultCode.CANCELED).assertEqual(result1);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info('testFace testaddfacecancel102 publicCloseSession ');
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info('testFace testaddfacecancel102 publicunRegisterInputer ');
// })
// done();
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
// } catch (e) {
// console.log("testaddfacecancel102 fail " + e);
// expect(null).assertFail();
// }
// })
//
// it('testaddfacecancel103', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth,AuthSubType.PIN_SIX,Inputerdata);
// let challenge;
// publicFC.publicOpenSession(UserIDM, function (data) {
// console.info('testFace testaddfacecancel103 OpenSession challenge = ' + data);
// challenge = data;
// publicFC.publicaddCredential(UserIDM,CredentialInfopinsix, function (data) {
// console.info('testFace testaddfacecancel103 addCredential onResult = ' + JSON.stringify(data));
// let info101;
// publicFC.publicauth(UserAuth,challenge,AuthType.PIN,AuthTurstLevel.ATL1, async function (data) {
// console.info('testFace testaddfacecancel103 publicauth onResult = ' + JSON.stringify(data));
// info101 = data;
// let token = info101.authextr.token
// CredentialInfoface2d.token = token
// let result1 = null
// let extraInfo1 = null
// let module1 = null
// let acquire1 = null
// let extr1 = null
// await UserIDM.addCredential(CredentialInfoface2d, {
// onResult: function(result,extraInfo){
// console.log(result)
// result1 = result
// extraInfo1 = extraInfo.credentialId
// },
// onAcquireInfo:function (module,acquire,extr){
// module1 = module
// acquire1 = acquire
// extr1 = extr
// console.info(module);
// }
// })
// await sleep(3000);
// let cancelresult = publicFC.publiccancel(UserIDM,challenge)
// expect(ResultCode.SUCCESS).assertEqual(cancelresult);
// expect(ResultCode.CANCELED).assertEqual(result1);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info('testFace testaddfacecancel103 publicCloseSession ');
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info('testFace testaddfacecancel103 publicunRegisterInputer ');
// })
// done();
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
// } catch (e) {
// console.log("testaddfacecancel103 fail " + e);
// expect(null).assertFail();
// }
// })
// it('testauthfacecancel101', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth,AuthSubType.PIN_SIX,Inputerdata);
// let challenge ;
// publicFC.publicOpenSession(UserIDM, function (data) {
// console.info('testFace testauthfacecancel101 publicOpenSession challenge = ' + data);
// challenge = data;
// publicFC.publicaddCredential(UserIDM,CredentialInfopinsix, function (data) {
// console.info('testFace testauthfacecancel101 addCredential onResult=' + JSON.stringify(data));
// let info101 ;
// publicFC.publicauth(UserAuth,challenge,AuthType.PIN,AuthTurstLevel.ATL1, function (data) {
// console.info('testFace testauthfacecancel101 auth onResult = ' + JSON.stringify(data));
// info101 = data;
// let token = info101.authextr.token
// CredentialInfoface2d.token = token
// publicFC.publicaddCredential(UserIDM,CredentialInfoface2d, async function (data) {
// console.info('testFace testauthfacecancel101 addCredential = ' + JSON.stringify(data));
// let result1 = null;
// let extraInfo1 = null;
// let module1 = null;
// let acquire1 = null;
// let extr1 = null;
// let contextID1 = null;
// contextID1 = await UserAuth.auth(challenge, AuthType.FACE, AuthTurstLevel.ATL1, {
// onResult: function(result,extraInfo){
// console.log(result);
// result1 = result;
// extraInfo1 = extraInfo;
// },
// onAcquireInfo:function (module,acquire,extr){
// module1 = module;
// acquire1 = acquire;
// extr1 = extr;
// console.info(module);
// }
// });
// await sleep(3000);
// let authfacecancel101 = publicFC.publicgecancelAuth(UserAuth,contextID1)
// expect(ResultCode.SUCCESS).assertEqual(authfacecancel101);
// expect(ResultCode.CANCELED).assertEqual(result1);
// publicFC.publicdelUser(UserIDM,token, function (data) {
// console.info('testFace testauthfacecancel101 delUser = ' + JSON.stringify(data));
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info('testFace testauthfacecancel101 publicCloseSession');
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info('testFace testauthfacecancel101 publicunRegisterInputer');
// done();
// })
// })
// })
// }, function (data) {
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
//
// } catch (e) {
// console.log("testauthfacecancel101 fail " + e);
// expect(null).assertFail();
// }
// })
//
// it('testauthfacecancel102', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth,AuthSubType.PIN_SIX,Inputerdata);
// let challenge ;
// publicFC.publicOpenSession(UserIDM, function (data) {
// console.info('testFace testauthfacecancel102 publicOpenSession challenge = ' + data);
// challenge = data;
// publicFC.publicaddCredential(UserIDM,CredentialInfopinsix, function (data) {
// console.info('testFace testauthfacecancel102 addCredential onResult = ' + JSON.stringify(data));
// let info101 ;
// publicFC.publicauth(UserAuth,challenge,AuthType.PIN,AuthTurstLevel.ATL1, function (data) {
// console.info('testFace testauthfacecancel102 publicauth onResult = ' + JSON.stringify(data));
// info101 = data;
// let token = info101.authextr.token
// CredentialInfoface2d.token = token
// publicFC.publicaddCredential(UserIDM,CredentialInfoface2d, async function (data) {
// console.info('testFace testauthfacecancel102 addCredential = ' + JSON.stringify(data));
// let result1 = null;
// let extraInfo1 = null;
// let module1 = null;
// let acquire1 = null;
// let extr1 = null;
// let contextID1 = null;
// contextID1 = await UserAuth.auth(challenge, AuthType.FACE, AuthTurstLevel.ATL1, {
// onResult: function(result,extraInfo){
// console.log(result);
// result1 = result;
// extraInfo1 = extraInfo;
// },
// onAcquireInfo:function (module,acquire,extr){
// module1 = module;
// acquire1 = acquire;
// extr1 = extr;
// console.info(module);
// }
// });
// await sleep(8000);
// let authfacecancel101 = publicFC.publicgecancelAuth(UserAuth,contextID1)
// expect(ResultCode.SUCCESS).assertEqual(authfacecancel101);
// expect(ResultCode.CANCELED).assertEqual(result1);
// publicFC.publicdelUser(UserIDM,token, function (data) {
// console.info('testFace testauthfacecancel102 delUser = ' + JSON.stringify(data));
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info('testFace testauthfacecancel102 publicCloseSession');
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info('testFace testauthfacecancel102 publicunRegisterInputer');
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
//
// } catch (e) {
// console.log("testauthfacecancel102 fail " + e);
// expect(null).assertFail();
// }
// })
//
// it('testauthfacecancel103', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth,AuthSubType.PIN_SIX,Inputerdata);
// let challenge ;
// publicFC.publicOpenSession(UserIDM, function (data) {
// console.info('testFace testauthfacecancel103 publicOpenSession challenge = ' + data);
// challenge = data;
// publicFC.publicaddCredential(UserIDM,CredentialInfopinsix, function (data) {
// console.info('testFace testauthfacecancel103 addCredential= ' + JSON.stringify(data));
// let info101 ;
// publicFC.publicauth(UserAuth,challenge,AuthType.PIN,AuthTurstLevel.ATL1, function (data) {
// console.info('testFace testauthfacecancel103 publicauth = ' + JSON.stringify(data));
// info101 = data;
// let token = info101.authextr.token
// CredentialInfoface2d.token = token
// publicFC.publicaddCredential(UserIDM,CredentialInfoface2d, async function (data) {
// console.info('testFace testauthfacecancel103 addCredential= ' + JSON.stringify(data));
// let result1 = null;
// let extraInfo1 = null;
// let module1 = null;
// let acquire1 = null;
// let extr1 = null;
// let contextID1 = null;
// contextID1 = await UserAuth.auth(challenge, AuthType.FACE, AuthTurstLevel.ATL1, {
// onResult: function(result,extraInfo){
// console.log(result);
// result1 = result;
// extraInfo1 = extraInfo;
// },
// onAcquireInfo:function (module,acquire,extr){
// module1 = module;
// acquire1 = acquire;
// extr1 = extr;
// console.info(module);
// }
// });
// await sleep(10000);
// let authfacecancel101 = publicFC.publicgecancelAuth(UserAuth,contextID1)
// expect(ResultCode.SUCCESS).assertEqual(authfacecancel101);
// expect(ResultCode.CANCELED).assertEqual(result1);
// publicFC.publicdelUser(UserIDM,token, function (data) {
// console.info('testFace testauthfacecancel103 delUser = ' + JSON.stringify(data));
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info('testFace testauthfacecancel103 publicCloseSession');
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info('testFace testauthfacecancel103 publicunRegisterInputer');
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
//
// } catch (e) {
// console.log("testauthfacecancel103 fail " + e);
// expect(null).assertFail();
// }
// })
//
// it('testauthuserfacecancel101', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth,AuthSubType.PIN_SIX,Inputerdata);
// let challenge ;
// publicFC.publicOpenSession(UserIDM, function (data) {
// console.info('testFace testauthuserfacecancel101 publicOpenSession challenge = ' + data);
// challenge = data;
// publicFC.publicaddCredential(UserIDM,CredentialInfopinsix, function (data) {
// console.info('testFace testauthuserfacecancel101 addCredential= ' + JSON.stringify(data));
// let info101 ;
// publicFC.publicauth(UserAuth,challenge,AuthType.PIN,AuthTurstLevel.ATL1, function (data) {
// console.info('testFace testauthuserfacecancel101 auth onResult = ' + JSON.stringify(data));
// info101 = data;
// let token = info101.authextr.token;
// CredentialInfoface2d.token = token;
// publicFC.publicaddCredential(UserIDM,CredentialInfoface2d, async function (data) {
// console.info('testFace testauthuserfacecancel101addCredential=' + JSON.stringify(data));
// let result1 = null;
// let extraInfo1 = null;
// let module1 = null;
// let acquire1 = null;
// let extr1 = null;
// let contextID1 = null;
// contextID1 = await UserAuth.authUser(
// userID.User1, challenge, AuthType.FACE, AuthTurstLevel.ATL1, {
// onResult: function(result,extraInfo){
// console.log(result);
// result1 = result;
// extraInfo1 = extraInfo;
// },
// onAcquireInfo:function (module,acquire,extr){
// module1 = module;
// acquire1 = acquire;
// extr1 = extr;
// console.info(module);
// }
// })
// await sleep(3000);
// let authfacecancel101 = publicFC.publicgecancelAuth(UserAuth,contextID1);
// expect(ResultCode.SUCCESS).assertEqual(authfacecancel101);
// expect(ResultCode.CANCELED).assertEqual(result1);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info('testFace testauthuserfacecancel101 publicCloseSession');
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info('testFace testauthuserfacecancel101 publicunRegisterInputer');
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// });
// }, function (data) {
// })
// })
// } catch (e) {
// console.log("testauthuserfacecancel101 fail " + e);
// expect(null).assertFail();
// }
// })
//
// it('testauthuserfacecancel102', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth,AuthSubType.PIN_SIX,Inputerdata);
// let challenge ;
// publicFC.publicOpenSession(UserIDM, function (data) {
// console.info('testFace testauthuserfacecancel102 publicOpenSession challenge = ' + data);
// challenge = data;
// publicFC.publicaddCredential(UserIDM,CredentialInfopinsix, function (data) {
// console.info('testFace testauthuserfacecancel102 addCredential Result=' + JSON.stringify(data));
// let info101 ;
// publicFC.publicauth(UserAuth,challenge,AuthType.PIN,AuthTurstLevel.ATL1, function (data) {
// console.info('testFace testauthuserfacecancel102 auth onResult = ' + JSON.stringify(data));
// info101 = data;
// let token = info101.authextr.token;
// CredentialInfoface2d.token = token;
// publicFC.publicaddCredential(UserIDM,CredentialInfoface2d, async function (data) {
// console.info('testFace testauthuserfacecancel102 addCred=' + JSON.stringify(data));
// let result1 = null;
// let extraInfo1 = null;
// let module1 = null;
// let acquire1 = null;
// let extr1 = null;
// let contextID1 = null;
// contextID1 = await UserAuth.authUser(
// userID.User1, challenge, AuthType.FACE, AuthTurstLevel.ATL1, {
// onResult: function(result,extraInfo){
// console.log(result);
// result1 = result;
// extraInfo1 = extraInfo;
// },
// onAcquireInfo:function (module,acquire,extr){
// module1 = module;
// acquire1 = acquire;
// extr1 = extr;
// console.info(module);
// }
// })
// await sleep(8000);
// let authfacecancel101 = publicFC.publicgecancelAuth(UserAuth,contextID1);
// expect(ResultCode.SUCCESS).assertEqual(authfacecancel101);
// expect(ResultCode.CANCELED).assertEqual(result1);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info('testFace testauthuserfacecancel102 publicCloseSession');
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info('testFace testauthuserfacecancel102 publicunRegisterInputer');
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// });
// }, function (data) {
// })
// })
// } catch (e) {
// console.log("testauthuserfacecancel102 fail " + e);
// expect(null).assertFail();
// }
// })
//
// it('testauthuserfacecancel103', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth,AuthSubType.PIN_SIX,Inputerdata);
// let challenge ;
// publicFC.publicOpenSession(UserIDM, function (data) {
// console.info('testFace testauthuserfacecancel103 publicOpenSession challenge = ' + data);
// challenge = data;
// publicFC.publicaddCredential(UserIDM,CredentialInfopinsix, function (data) {
// console.info('testFace testauthuserfacecancel103 addCredential= ' + JSON.stringify(data));
// let info101 ;
// publicFC.publicauth(UserAuth,challenge,AuthType.PIN,AuthTurstLevel.ATL1, function (data) {
// console.info('testFace testauthuserfacecancel103 publicauth= ' + JSON.stringify(data));
// info101 = data;
// let token = info101.authextr.token;
// CredentialInfoface2d.token = token;
// publicFC.publicaddCredential(UserIDM,CredentialInfoface2d, async function (data) {
// console.info('testFace testauthuserfacecancel103 addCred=' + JSON.stringify(data));
// let result1 = null;
// let extraInfo1 = null;
// let module1 = null;
// let acquire1 = null;
// let extr1 = null;
// let contextID1 = null;
// contextID1 = await UserAuth.authUser(
// userID.User1, challenge, AuthType.FACE, AuthTurstLevel.ATL1, {
// onResult: function(result,extraInfo){
// console.log(result);
// result1 = result;
// extraInfo1 = extraInfo;
// },
// onAcquireInfo:function (module,acquire,extr){
// module1 = module;
// acquire1 = acquire;
// extr1 = extr;
// console.info(module);
// }
// })
// await sleep(11000);
// let authfacecancel101 = publicFC.publicgecancelAuth(UserAuth,contextID1);
// expect(ResultCode.SUCCESS).assertEqual(authfacecancel101);
// expect(ResultCode.CANCELED).assertEqual(result1);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info('testFace testauthuserfacecancel103 publicCloseSession');
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info('testFace testauthuserfacecancel103 publicunRegisterInputer');
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// });
// }, function (data) {
// })
// })
// } catch (e) {
// console.log("testauthuserfacecancel103 fail " + e);
// expect(null).assertFail();
// }
// })
it
(
'
Security_IAM_Face_AddCred_Func_0102
'
,
2
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
);
let
challenge
;
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
testFace Security_IAM_Face_AddCred_Func_0102 publicOpenSession challenge =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
console
.
info
(
'
testFace Face_AddCred_Func_0102 addCredential=
'
+
JSON
.
stringify
(
data
));
let
info101
;
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
testFace Face_AddCred_Func_0102 publicauth =
'
+
JSON
.
stringify
(
data
));
info101
=
data
;
let
token
=
info101
.
authextr
.
token
;
CredentialInfoface2d
.
token
=
token
;
let
addfaceresult
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
data
)
{
console
.
info
(
'
testFace Face_AddCred_Func_0102 addCredential=
'
+
JSON
.
stringify
(
data
));
addfaceresult
=
data
;
let
credentialId
=
addfaceresult
.
credentialId
;
let
token1
=
token
+
"
Wrong Word
"
;
let
delcredresult
;
publicFC
.
publicdelCred
(
UserIDM
,
credentialId
,
token1
,
function
(
data
)
{
console
.
info
(
'
testFace Face_AddCred_Func_0102 publicdelCred=
'
+
JSON
.
stringify
(
data
));
delcredresult
=
data
;
expect
(
ResultCode
.
Authfail
).
assertEqual
(
delcredresult
.
delCredresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
'
testFace Face_AddCred_Func_0102 delUser=
'
+
JSON
.
stringify
(
data
));
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
testFace Face_AddCred_Func_0102 publicCloseSession
'
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
testFace Face_AddCred_Func_0102 publicunRegister
'
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
testdelface102 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
})
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_Interface_DFX_CallbackJsunit.test.js
已删除
100644 → 0
浏览文件 @
d60c9f66
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
userAuth
from
'
@ohos.userAuth
'
import
userIDM
from
'
@ohos.userIDM
'
import
pinAuth
from
'
@ohos.pinAuth
'
import
*
as
publicFC
from
'
./Publicfunction-n
'
let
UserIDM
=
new
userIDM
.
UserIdentityManager
();
let
PinAuth
=
new
pinAuth
.
PINAuth
();
let
UserAuth
=
new
userAuth
.
UserAuth
();
let
AuthType
=
{
PIN
:
1
,
FACE
:
2
}
let
AuthSubType
=
{
PIN_SIX
:
10000
,
PIN_NUMBER
:
10001
,
PIN_MIXED
:
10002
,
FACE_2D
:
20000
,
FACE_3D
:
20001
}
let
AuthTurstLevel
=
{
ATL1
:
10000
,
ATL2
:
20000
,
ATL3
:
30000
,
ATL4
:
40000
}
let
SetPropertyType
=
{
PROCESS_ALGORITHM
:
1
,
}
let
userID
=
{
User1
:
100
,
User2
:
2
,
User3
:
3
,
User4
:
4
,
User5
:
5
}
let
ResultCode
=
{
SUCCESS
:
0
,
FAIL
:
1
,
GENERAL_ERROR
:
2
,
CANCELED
:
3
,
TIMEOUT
:
4
,
TYPE_NOT_SUPPORT
:
5
,
TRUST_LEVEL_NOT_SUPPORT
:
6
,
BUSY
:
7
,
INVALID_PARAMETERS
:
8
,
LOCKED
:
9
,
NOT_ENROLLED
:
10
,
Authfail
:
14
}
let
GetPropertyType
=
{
AUTH_SUB_TYPE
:
1
,
REMAIN_TIMES
:
2
,
FREEZING_TIME
:
3
}
let
Inputerdata
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
]);
let
Inputerdatan
=
new
Uint8Array
([
1
,
1
,
1
,
1
,
1
,
1
]);
let
Inputerdatanum
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
]);
let
Inputerdatanumn
=
new
Uint8Array
([
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
]);
let
Inputerdatamix
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
]);
let
Inputerdatamixn
=
new
Uint8Array
([
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
]);
let
GetPropertyTypearray
=
new
Array
();
GetPropertyTypearray
[
0
]
=
GetPropertyType
.
AUTH_SUB_TYPE
;
GetPropertyTypearray
[
1
]
=
GetPropertyType
.
FREEZING_TIME
;
GetPropertyTypearray
[
2
]
=
GetPropertyType
.
REMAIN_TIMES
;
let
GetPropertyRequestpin
=
{
authType
:
AuthType
.
PIN
,
keys
:
GetPropertyTypearray
}
let
GetPropertyRequestface
=
{
authType
:
AuthType
.
FACE
,
keys
:
GetPropertyTypearray
}
let
CredentialInfopinsix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_SIX
,
token
:
null
}
let
CredentialInfopinnum
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_NUMBER
,
token
:
null
}
let
CredentialInfopinmix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_MIXED
,
token
:
null
}
let
CredentialInfoface2d
=
{
credType
:
AuthType
.
FACE
,
credSubType
:
AuthSubType
.
FACE_2D
,
token
:
null
}
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
function
inputererror
(
inputer
,
done
){
try
{
let
registerresult
=
publicFC
.
publicRegisterInputer
(
PinAuth
,
inputer
,
inputer
)
expect
(
true
).
assertEqual
(
registerresult
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace inputererror publicunRegisterInputer unRegist =
"
+
data
)
})
done
();
}
catch
(
e
)
{
console
.
log
(
"
testFace inputererror fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
addCredentialerr
(
inputer
,
done
){
console
.
info
(
'
testFace addCredentialerr start
'
);
try
{
let
challenge
;
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
);
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
testFace addCredentialerr publicOpenSession data =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
inputer
,
function
(
data
)
{
console
.
info
(
'
testFace addCredentialerr callback data =
'
+
JSON
.
stringify
(
data
));
let
addcredresult101
=
data
.
addCredresult
;
console
.
info
(
"
testFace addCredentialerr addcredresult101 =
"
+
addcredresult101
);
expect
(
ResultCode
.
FAIL
).
assertEqual
(
addcredresult101
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
testFace addCredentialerr publicCloseSession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace addCredentialerr unRegister =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
addCredentialerr fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
autherror
(
inputer
,
done
){
console
.
info
(
'
testFace autherror start
'
);
try
{
let
challenge
;
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_NUMBER
,
Inputerdatanum
);
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
testFace autherror publicOpenSession data =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
console
.
info
(
'
testFace autherror callback data =
'
+
JSON
.
stringify
(
data
));
let
token
;
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
testFace autherror publicauth
'
);
token
=
data
.
authextr
.
token
;
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
data
.
authresult
);
console
.
info
(
"
testFace autherror token =
"
+
token
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
inputer
,
inputer
,
function
(
data
)
{
expect
(
ResultCode
.
TRUST_LEVEL_NOT_SUPPORT
).
assertEqual
(
data
.
authresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
"
testFace autherror publicdelUser
"
);
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
"
testFace autherror deluserresult =
"
+
deluserresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
testFace autherror publicCloseSession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace autherror unRegister =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
autherror fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
authusererror
(
inputer
,
done
){
console
.
info
(
'
testFace authusererror start
'
);
try
{
let
challenge
;
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_NUMBER
,
Inputerdatanum
);
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
testFace authusererror publicOpenSession data =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
console
.
info
(
'
testFace authusererror callback data =
'
+
JSON
.
stringify
(
data
));
let
addcredresult101
=
data
.
addCredresult
;
console
.
info
(
"
testFace authusererror addcredresult101 =
"
+
addcredresult101
);
let
token
;
console
.
info
(
'
testFace authusererror addSuccess
'
);
publicFC
.
publicauthUser
(
UserAuth
,
userID
.
User1
,
challenge
,
inputer
,
inputer
,
function
(
data
)
{
let
auth101
=
data
.
authresult
console
.
info
(
"
testFace authusererror auth101 =
"
+
auth101
);
if
(
auth101
==
ResultCode
.
FAIL
||
auth101
==
ResultCode
.
TRUST_LEVEL_NOT_SUPPORT
){
console
.
log
(
"
authusererror pass result code =
"
+
auth101
);
}
else
{
console
.
log
(
"
authusererror fail result code =
"
+
auth101
);
expect
(
null
).
assertFail
();
}
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
testFace authusererror publicauth
'
);
token
=
data
.
authextr
.
token
;
console
.
info
(
"
testFace authusererror token =
"
+
token
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
"
testFace authusererror publicdelUser
"
);
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
"
testFace authusererror deluserresult =
"
+
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
testFace authusererror publicCloseSession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace authusererror unRegister=
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
authusererror fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
delusererror
(
inputer
,
done
){
console
.
info
(
'
testFace delusererror start
'
);
try
{
let
challenge
;
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_NUMBER
,
Inputerdatanum
);
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
testFace delusererror publicOpenSession data =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
console
.
info
(
'
testFace delusererror callback data =
'
+
JSON
.
stringify
(
data
));
let
addcredresult101
=
data
.
addCredresult
;
console
.
info
(
"
testFace delusererror addcredresult101 =
"
+
addcredresult101
);
let
token
;
console
.
info
(
'
testFace delusererror addSuccess
'
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
testFace delusererror publicauth
'
);
token
=
data
.
authextr
.
token
;
console
.
info
(
"
testFace delusererror token =
"
+
token
);
publicFC
.
publicdelUser
(
UserIDM
,
inputer
,
function
(
data
)
{
console
.
info
(
"
testFace delusererror delUserresult1 =
"
+
data
.
delUserresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
"
testFace delusererror publicdelUser
"
);
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
"
testFace delusererror deluserresult2 =
"
+
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
testFace delusererror publicCloseSession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace delusererror unRegister =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
delusererror fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
updateerror
(
inputer
,
done
){
console
.
info
(
'
testFace updateerror start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
"
updateerror challenge =
"
+
challenge
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
let
addcredresult101
=
data
.
addcredresult
;
console
.
info
(
"
updateerror addcredresult101 =
"
+
addcredresult101
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth101
=
data
console
.
info
(
"
updateerror auth101 =
"
+
auth101
);
let
token
=
auth101
.
authextr
.
token
;
CredentialInfopinnum
.
token
=
null
;
CredentialInfopinnum
.
credType
=
null
;
CredentialInfopinnum
.
credSubType
=
null
;
console
.
info
(
"
updateerror token =
"
+
token
);
publicFC
.
publicupdateCred
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
let
updateresult
=
data
.
updateCredresult
;
console
.
info
(
"
updateerror updateresult =
"
+
updateresult
);
expect
(
ResultCode
.
FAIL
).
assertEqual
(
updateresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
auth101
=
data
console
.
info
(
"
updateerror auth101 =
"
+
auth101
);
let
token1
=
auth101
.
authextr
.
token
console
.
info
(
"
updateerror token1 =
"
+
token1
);
publicFC
.
publicdelUser
(
UserIDM
,
token1
,
function
(
data
)
{
console
.
info
(
"
updateerror delUser result =
"
+
data
.
delUserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
updateerror closesession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
updateerror unRegist =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
updateerror fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
delcrederror
(
inputer
,
done
){
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
let
challenge
;
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
delcrederror openSession challenge =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
delcrederror addCredential Result1 =
'
+
JSON
.
stringify
(
onresult
));
let
info101
;
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
delcrederror auth onResult =
'
+
JSON
.
stringify
(
data
));
info101
=
data
;
let
token
=
info101
.
authextr
.
token
;
CredentialInfoface2d
.
token
=
token
;
let
addfaceresult
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
info
(
'
delcrederror addCredential Result2=
'
+
JSON
.
stringify
(
onresult
));
addfaceresult
=
onresult
;
let
delcredresult
;
publicFC
.
publicdelCred
(
UserIDM
,
inputer
,
inputer
,
function
(
data
)
{
console
.
info
(
'
testFace delcrederror del=
'
+
JSON
.
stringify
(
data
));
delcredresult
=
data
;
expect
(
ResultCode
.
Authfail
).
assertEqual
(
delcredresult
.
delCredresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
'
delcrederror delUser=
'
+
JSON
.
stringify
(
data
));
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
delcrederror closeSession
'
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
delcrederror unRegister
'
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
onacquireinfo
)
{
})
},
function
(
onacquireinfo
)
{
})
},
function
(
data
)
{
})
},
function
(
onacquireinfo
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
delcrederror fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
getauthinfoerror
(
inputer
,
done
){
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
){
let
challenge
=
data
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
testFace getauthinfoerror addCredresult =
'
+
onresult
.
addCredresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
onresult
)
{
console
.
info
(
'
testFace getauthinfoerror addCred onResult =
'
+
JSON
.
stringify
(
onresult
));
let
token
=
onresult
.
authextr
.
token
CredentialInfoface2d
.
token
=
token
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
log
(
"
testFace getauthinfoerror addface=
"
+
onresult
.
addCredresult
)
publicFC
.
publicgetAuthInfo
(
UserIDM
,
inputer
,
function
(
AsyncCallback
)
{
console
.
log
(
"
testFace getauthinfoerror getAuthInfo=
"
+
JSON
.
stringify
(
AsyncCallback
))
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
onresult
){
let
delresult
=
onresult
.
delUserresult
;
console
.
log
(
"
testFace getauthinfoerror delUser=
"
+
delresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
){
console
.
log
(
"
getauthinfoerror CloseSession=
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
){
done
();
})
})
},
function
(
onacquireinfo
){
})
})
},
function
(
onAcquireInfo
)
{
})
},
function
(
onAcquireInfo
)
{
});
},
function
(
onAcquireInfo
)
{
});
})
}
catch
(
e
)
{
console
.
log
(
"
getauthinfoerror fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
getAvailabeStatuserror
(
inputer
,
done
){
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
){
let
challenge
=
data
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
testFace getAvailabeStatuserror addCredresult =
'
+
onresult
.
addCredresult
);
console
.
log
(
"
testFace faceDemo getAvailabeStatuserror authUser =
"
+
onresult
.
addCredresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
onresult
)
{
console
.
info
(
'
testFace getAvailabeStatuserror addCred =
'
+
JSON
.
stringify
(
onresult
));
let
token
=
onresult
.
authextr
.
token
CredentialInfoface2d
.
token
=
token
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
info
(
'
testFace getAvailabeStatuserror addface=
'
+
onresult
.
authresult
);
console
.
log
(
"
testFace getAvailabeStatuserror addface result=
"
+
onresult
.
addCredresult
)
let
AvailabeStatus
=
publicFC
.
publicgetAvailabeStatus
(
UserAuth
,
inputer
,
inputer
)
console
.
info
(
'
testFace getAvailabeStatuserror addCAvailabeStatusred =
'
+
JSON
.
stringify
(
AvailabeStatus
));
expect
(
ResultCode
.
INVALID_PARAMETERS
).
assertEqual
(
AvailabeStatus
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
onresult
){
console
.
log
(
"
testFace getAvailabeStatuserror delUser=
"
+
onresult
.
delUserresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
){
console
.
log
(
"
testFace getAvailabeStatuserror CloseSession =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
){
done
();
})
})
},
function
(
onacquireinfo
){
})
},
function
(
onAcquireInfo
)
{
})
},
function
(
onAcquireInfo
)
{
}
);
},
function
(
onAcquireInfo
)
{
});
})
}
catch
(
e
)
{
console
.
log
(
"
getAvailabeStatuserror fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
function
getPropertyerror
(
inputer
,
done
){
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
){
let
challenge
=
data
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0110 addCredresult =
'
+
onresult
.
addCredresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
onresult
)
{
console
.
info
(
'
testFace Coauth_Func_0110 addCred onResult =
'
+
JSON
.
stringify
(
onresult
));
let
token
=
onresult
.
authextr
.
token
CredentialInfoface2d
.
token
=
token
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
log
(
"
testFace Coauth_Func_0110 ddCredentialface =
"
+
onresult
.
addCredresult
)
GetPropertyRequestface
.
authType
=
inputer
;
GetPropertyRequestface
.
keys
=
inputer
;
publicFC
.
publicgetProperty
(
UserAuth
,
GetPropertyRequestface
,
function
(
onresult
)
{
console
.
log
(
"
testFace Coauth_Func_0110 GetPropertyface =
"
+
JSON
.
stringify
(
onresult
))
expect
(
ResultCode
.
FAIL
).
assertEqual
(
onresult
.
result
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
onresult
){
console
.
log
(
"
testFace Coauth_Func_0110 delUser=
"
+
onresult
.
delUserresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
){
console
.
log
(
"
testFace Coauth_Func_0110 CloseSession callback =
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
){
done
();
})
})
},
function
(
onacquireinfo
){
})
})
},
function
(
onAcquireInfo
)
{
})
},
function
(
onAcquireInfo
)
{
})
},
function
(
onAcquireInfo
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Coauth_Func_0110 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
}
describe
(
'
userauthTest_two9
'
,
function
()
{
it
(
'
Security_IAM_PIN_Interface_DFX_0101
'
,
0
,
async
function
(
done
)
{
inputererror
(
null
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0102
'
,
1
,
async
function
(
done
)
{
inputererror
(
'
Errortest
'
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0103
'
,
1
,
async
function
(
done
)
{
addCredentialerr
(
null
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0104
'
,
1
,
async
function
(
done
)
{
addCredentialerr
(
'
Errortest
'
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0105
'
,
1
,
async
function
(
done
)
{
autherror
(
null
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0106
'
,
0
,
async
function
(
done
)
{
autherror
(
'
Errortest
'
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0107
'
,
0
,
async
function
(
done
)
{
authusererror
(
null
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0108
'
,
0
,
async
function
(
done
)
{
authusererror
(
'
Errortest
'
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0109
'
,
0
,
async
function
(
done
)
{
getPropertyerror
(
null
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0110
'
,
0
,
async
function
(
done
)
{
getPropertyerror
(
'
Errortest
'
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0111
'
,
0
,
async
function
(
done
)
{
updateerror
(
null
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0112
'
,
0
,
async
function
(
done
)
{
updateerror
(
'
Errortest
'
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0113
'
,
0
,
async
function
(
done
)
{
delusererror
(
null
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0114
'
,
0
,
async
function
(
done
)
{
delusererror
(
'
Errortest
'
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0115
'
,
0
,
async
function
(
done
)
{
delcrederror
(
null
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0116
'
,
0
,
async
function
(
done
)
{
delcrederror
(
'
Errortest
'
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0117
'
,
0
,
async
function
(
done
)
{
getauthinfoerror
(
null
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0118
'
,
0
,
async
function
(
done
)
{
getauthinfoerror
(
'
Errortest
'
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0119
'
,
0
,
async
function
(
done
)
{
getAvailabeStatuserror
(
null
,
done
);
})
it
(
'
Security_IAM_PIN_Interface_DFX_0120
'
,
0
,
async
function
(
done
)
{
getAvailabeStatuserror
(
'
Errortest
'
,
done
);
})
})
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_Interface_Func_CallbackJsunit.test.js
已删除
100644 → 0
浏览文件 @
d60c9f66
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
userAuth
from
'
@ohos.userAuth
'
import
userIDM
from
'
@ohos.userIDM
'
import
pinAuth
from
'
@ohos.pinAuth
'
import
*
as
publicFC
from
'
./Publicfunction-n.js
'
describe
(
'
userauthTest_two5
'
,
function
()
{
it
(
'
Security_IAM_Face_Interface_check_IDMAuthSubType_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_IDMAuthSubType_0101 start
'
);
expect
(
10000
).
assertEqual
(
userIDM
.
AuthSubType
.
PIN_SIX
);
expect
(
10001
).
assertEqual
(
userIDM
.
AuthSubType
.
PIN_NUMBER
);
expect
(
10002
).
assertEqual
(
userIDM
.
AuthSubType
.
PIN_MIXED
);
expect
(
20000
).
assertEqual
(
userIDM
.
AuthSubType
.
FACE_2D
);
expect
(
20001
).
assertEqual
(
userIDM
.
AuthSubType
.
FACE_3D
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_IDMAuthSubType_0101 end
'
);
done
();
})
it
(
'
Security_IAM_Face_Interface_check_IDMAuthType_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_IDMAuthSubType_0101 start
'
);
expect
(
1
).
assertEqual
(
userIDM
.
AuthType
.
PIN
);
expect
(
2
).
assertEqual
(
userIDM
.
AuthType
.
FACE
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_IDMAuthSubType_0101 end
'
);
done
();
})
it
(
'
Security_IAM_Face_Interface_check_pinauthAuthSubType_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_pinauthAuthSubType_0101 start
'
);
expect
(
10000
).
assertEqual
(
pinAuth
.
AuthSubType
.
PIN_SIX
);
expect
(
10001
).
assertEqual
(
pinAuth
.
AuthSubType
.
PIN_NUMBER
);
expect
(
10002
).
assertEqual
(
pinAuth
.
AuthSubType
.
PIN_MIXED
);
expect
(
20000
).
assertEqual
(
pinAuth
.
AuthSubType
.
FACE_2D
);
expect
(
20001
).
assertEqual
(
pinAuth
.
AuthSubType
.
FACE_3D
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_pinauthAuthSubType_0101 end
'
);
done
();
})
it
(
'
Security_IAM_Face_Interface_check_userauthAuthSubType_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthAuthSubType_0101 start
'
);
expect
(
10000
).
assertEqual
(
userAuth
.
AuthSubType
.
PIN_SIX
);
expect
(
10001
).
assertEqual
(
userAuth
.
AuthSubType
.
PIN_NUMBER
);
expect
(
10002
).
assertEqual
(
userAuth
.
AuthSubType
.
PIN_MIXED
);
expect
(
20000
).
assertEqual
(
userAuth
.
AuthSubType
.
FACE_2D
);
expect
(
20001
).
assertEqual
(
userAuth
.
AuthSubType
.
FACE_3D
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthAuthSubType_0101 end
'
);
done
();
})
it
(
'
Security_IAM_Face_Interface_check_userauthAuthTrustLevel_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthAuthTrustLevel_0101 start
'
);
expect
(
10000
).
assertEqual
(
userAuth
.
AuthTrustLevel
.
ATL1
);
expect
(
20000
).
assertEqual
(
userAuth
.
AuthTrustLevel
.
ATL2
);
expect
(
30000
).
assertEqual
(
userAuth
.
AuthTrustLevel
.
ATL3
);
expect
(
40000
).
assertEqual
(
userAuth
.
AuthTrustLevel
.
ATL4
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthAuthTrustLevel_0101 end
'
);
done
();
})
it
(
'
Security_IAM_Face_Interface_check_userauthAuthType_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthAuthType_0101 start
'
);
expect
(
1
).
assertEqual
(
userAuth
.
AuthType
.
PIN
);
expect
(
2
).
assertEqual
(
userAuth
.
AuthType
.
FACE
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthAuthType_0101 end
'
);
done
();
})
it
(
'
Security_IAM_Face_Interface_check_userauthGetPropertyType_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthGetPropertyType_0101 start
'
);
expect
(
1
).
assertEqual
(
userAuth
.
GetPropertyType
.
AUTH_SUB_TYPE
);
expect
(
2
).
assertEqual
(
userAuth
.
GetPropertyType
.
REMAIN_TIMES
);
expect
(
3
).
assertEqual
(
userAuth
.
GetPropertyType
.
FREEZING_TIME
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthGetPropertyType_0101 end
'
);
done
();
})
it
(
'
Security_IAM_Face_Interface_check_userauthAuthMethod_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthAuthMethod_0101 start
'
);
expect
(
0xF
).
assertEqual
(
userAuth
.
AuthMethod
.
PIN_ONLY
);
expect
(
0xF0
).
assertEqual
(
userAuth
.
AuthMethod
.
FACE_ONLY
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthAuthMethod_0101 end
'
);
done
();
})
it
(
'
Security_IAM_Face_Interface_check_userauthSetPropertyType_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthSetPropertyType_0101 start
'
);
expect
(
1
).
assertEqual
(
userAuth
.
SetPropertyType
.
INIT_ALGORITHM
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthSetPropertyType_0101 end
'
);
done
();
})
it
(
'
Security_IAM_Face_Interface_check_userauthModule_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthModule_0101 start
'
);
expect
(
1
).
assertEqual
(
userAuth
.
Module
.
FACE_AUTH
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthModule_0101 end
'
);
done
();
})
it
(
'
Security_IAM_Face_Interface_check_userauthResultCode_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthResultCode_0101 start
'
);
expect
(
0
).
assertEqual
(
userAuth
.
ResultCode
.
SUCCESS
);
expect
(
1
).
assertEqual
(
userAuth
.
ResultCode
.
FAIL
);
expect
(
2
).
assertEqual
(
userAuth
.
ResultCode
.
GENERAL_ERROR
);
expect
(
3
).
assertEqual
(
userAuth
.
ResultCode
.
CANCELED
);
expect
(
4
).
assertEqual
(
userAuth
.
ResultCode
.
TIMEOUT
);
expect
(
5
).
assertEqual
(
userAuth
.
ResultCode
.
TYPE_NOT_SUPPORT
);
expect
(
6
).
assertEqual
(
userAuth
.
ResultCode
.
TRUST_LEVEL_NOT_SUPPORT
);
expect
(
7
).
assertEqual
(
userAuth
.
ResultCode
.
BUSY
);
expect
(
8
).
assertEqual
(
userAuth
.
ResultCode
.
INVALID_PARAMETERS
);
expect
(
9
).
assertEqual
(
userAuth
.
ResultCode
.
LOCKED
);
expect
(
10
).
assertEqual
(
userAuth
.
ResultCode
.
NOT_ENROLLED
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthResultCode_0101 end
'
);
done
();
})
it
(
'
Security_IAM_Face_Interface_check_userauthFaceTipsCode_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthFaceTipsCode_0101 start
'
);
expect
(
1
).
assertEqual
(
userAuth
.
FaceTipsCode
.
FACE_AUTH_TIP_TOO_BRIGHT
);
expect
(
2
).
assertEqual
(
userAuth
.
FaceTipsCode
.
FACE_AUTH_TIP_TOO_DARK
);
expect
(
3
).
assertEqual
(
userAuth
.
FaceTipsCode
.
FACE_AUTH_TIP_TOO_CLOSE
);
expect
(
4
).
assertEqual
(
userAuth
.
FaceTipsCode
.
FACE_AUTH_TIP_TOO_FAR
);
expect
(
5
).
assertEqual
(
userAuth
.
FaceTipsCode
.
FACE_AUTH_TIP_TOO_HIGH
);
expect
(
6
).
assertEqual
(
userAuth
.
FaceTipsCode
.
FACE_AUTH_TIP_TOO_LOW
);
expect
(
7
).
assertEqual
(
userAuth
.
FaceTipsCode
.
FACE_AUTH_TIP_TOO_RIGHT
);
expect
(
8
).
assertEqual
(
userAuth
.
FaceTipsCode
.
FACE_AUTH_TIP_TOO_LEFT
);
expect
(
9
).
assertEqual
(
userAuth
.
FaceTipsCode
.
FACE_AUTH_TIP_TOO_MUCH_MOTION
);
expect
(
10
).
assertEqual
(
userAuth
.
FaceTipsCode
.
FACE_AUTH_TIP_POOR_GAZE
);
expect
(
11
).
assertEqual
(
userAuth
.
FaceTipsCode
.
FACE_AUTH_TIP_NOT_DETECTED
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthFaceTipsCode_0101 end
'
);
done
();
})
it
(
'
Security_IAM_Face_Interface_check_userauthFingerprintTips_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthFingerprintTips_0101 start
'
);
expect
(
0
).
assertEqual
(
userAuth
.
FingerprintTips
.
FINGERPRINT_TIP_GOOD
);
expect
(
1
).
assertEqual
(
userAuth
.
FingerprintTips
.
FINGERPRINT_TIP_IMAGER_DIRTY
);
expect
(
2
).
assertEqual
(
userAuth
.
FingerprintTips
.
FINGERPRINT_TIP_INSUFFICIENT
);
expect
(
3
).
assertEqual
(
userAuth
.
FingerprintTips
.
FINGERPRINT_TIP_PARTIAL
);
expect
(
4
).
assertEqual
(
userAuth
.
FingerprintTips
.
FINGERPRINT_TIP_TOO_FAST
);
expect
(
5
).
assertEqual
(
userAuth
.
FingerprintTips
.
FINGERPRINT_TIP_TOO_SLOW
);
console
.
info
(
'
testFace Security_IAM_Face_Interface_check_userauthFingerprintTips_0101 end
'
);
done
();
})
})
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_PIN_DFX_CallbackJsunit.test.js
已删除
100644 → 0
浏览文件 @
d60c9f66
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
userAuth
from
'
@ohos.userAuth
'
import
userIDM
from
'
@ohos.userIDM
'
import
pinAuth
from
'
@ohos.pinAuth
'
import
*
as
publicFC
from
'
./Publicfunction-n
'
let
UserIDM
=
new
userIDM
.
UserIdentityManager
();
let
PinAuth
=
new
pinAuth
.
PINAuth
();
let
UserAuth
=
new
userAuth
.
UserAuth
();
let
AuthType
=
{
PIN
:
1
,
FACE
:
2
}
let
AuthSubType
=
{
PIN_SIX
:
10000
,
PIN_NUMBER
:
10001
,
PIN_MIXED
:
10002
,
FACE_2D
:
20000
,
FACE_3D
:
20001
}
let
AuthTurstLevel
=
{
ATL1
:
10000
,
ATL2
:
20000
,
ATL3
:
30000
,
ATL4
:
40000
}
let
SetPropertyType
=
{
PROCESS_ALGORITHM
:
1
,
}
let
userID
=
{
User1
:
1000
,
User2
:
2
,
User3
:
3
,
User4
:
4
,
User5
:
5
}
let
ResultCode
=
{
SUCCESS
:
0
,
FAIL
:
1
,
GENERAL_ERROR
:
2
,
CANCELED
:
3
,
TIMEOUT
:
4
,
TYPE_NOT_SUPPORT
:
5
,
TRUST_LEVEL_NOT_SUPPORT
:
6
,
BUSY
:
7
,
INVALID_PARAMETERS
:
8
,
LOCKED
:
9
,
NOT_ENROLLED
:
10
,
Authfail
:
14
}
let
GetPropertyType
=
{
AUTH_SUB_TYPE
:
1
,
REMAIN_TIMES
:
2
,
FREEZING_TIME
:
3
}
let
Inputerdata
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
]);
let
GetPropertyTypearray
=
new
Array
();
GetPropertyTypearray
[
0
]
=
GetPropertyType
.
AUTH_SUB_TYPE
;
GetPropertyTypearray
[
1
]
=
GetPropertyType
.
FREEZING_TIME
;
GetPropertyTypearray
[
2
]
=
GetPropertyType
.
REMAIN_TIMES
;
let
GetPropertyRequestpin
=
{
authType
:
AuthType
.
PIN
,
keys
:
GetPropertyTypearray
}
let
GetPropertyRequestface
=
{
authType
:
AuthType
.
FACE
,
keys
:
GetPropertyTypearray
}
let
CredentialInfopinsix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_SIX
,
token
:
null
}
let
CredentialInfopinnum
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_NUMBER
,
token
:
null
}
let
CredentialInfopinmix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_MIXED
,
token
:
null
}
let
CredentialInfoface2d
=
{
credType
:
AuthType
.
FACE
,
credSubType
:
AuthSubType
.
FACE_2D
,
token
:
null
}
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
describe
(
'
userauthTest_two6
'
,
function
()
{
it
(
'
Security_IAM_PIN_AddCred_DFX_0102
'
,
3
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0102 publicOpenSession challenge =
'
+
challenge
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
let
addcredresult101
=
data
.
addCredresult
;
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0102 addcredresult101 =
'
+
addcredresult101
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
addcredresult101
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
let
addcredresult102
=
data
.
addCredresult
;
expect
(
ResultCode
.
FAIL
).
assertEqual
(
addcredresult102
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
info101
=
data
;
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0102 publicauth=
'
+
JSON
.
stringify
(
info101
));
let
token
=
info101
.
authextr
.
token
;
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0102 publicdelUser =
'
+
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0102 publicCloseSession=
'
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0102 unRegisterInputer=
'
+
data
);
done
();
})
})
})
},
function
(
data
)
{
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0102 publicauth data =
'
+
data
);
})
})
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_AddCred_DFX_0102 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_AddCred_DFX_0103
'
,
3
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0103 publicOpenSession challenge =
'
+
challenge
);
let
CredentialInfopinsix2
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_SIX
,
}
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix2
,
function
(
data
)
{
let
addcredresult101
=
data
.
addCredresult
;
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
addcredresult101
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
info101
=
data
;
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0103 publicauth=
'
+
JSON
.
stringify
(
info101
));
let
token
=
info101
.
authextr
.
token
;
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0103 publicdelUser =
'
+
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0103 publicCloseSession data =
'
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0103 unRegisterInputer data=
'
+
data
);
done
();
})
})
})
},
function
(
data
)
{
console
.
info
(
'
Security_IAM_PIN_AddCred_DFX_0103 publicauth data =
'
+
data
);
})
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_AddCred_DFX_0103 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_Update_DFX_0101
'
,
3
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0101 publicOpenSession challenge =
'
+
challenge
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
let
addcredresult102
=
data
.
addCredresult
;
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0101 publicaddCredential=
'
+
addcredresult102
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
addcredresult102
=
data
;
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0101 auth=
'
+
JSON
.
stringify
(
addcredresult102
));
let
token
=
addcredresult102
.
authextr
.
token
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0101 publicdelUser=
'
+
deluserresult
);
publicFC
.
publicupdateCred
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
let
updateresult
=
data
.
updateCredresult
;
expect
(
ResultCode
.
FAIL
).
assertEqual
(
updateresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0101 publicCloseSession=
'
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0101 unRegisterInputer=
'
+
data
);
done
();
})
})
})
})
},
function
(
data
)
{
})
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_Update_DFX_0101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_Update_DFX_0103
'
,
3
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0103 publicOpenSession challenge =
'
+
challenge
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
let
addcredresult102
=
data
.
addCredresult
;
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0103 publicaddCredential =
'
+
addcredresult102
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth101
=
data
;
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0103 publicauth =
'
+
JSON
.
stringify
(
auth101
));
let
token
=
auth101
.
authextr
.
token
;
CredentialInfopinsix
.
token
=
token
;
publicFC
.
publicupdateCred
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
let
updateresult
=
data
.
updateCredresult
;
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
updateresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
auth101
=
data
;
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0103 auth=
'
+
JSON
.
stringify
(
auth101
));
let
token1
=
auth101
.
authextr
.
token
publicFC
.
publicdelUser
(
UserIDM
,
token1
,
function
(
data
)
{
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0103 publicdelUser=
'
+
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0103 CloseSession =
'
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_PIN_Update_DFX_0103 unRegisterInputer=
'
+
data
);
done
();
})
})
})
})
})
},
function
(
data
)
{
})
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_Update_DFX_0103 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_Delet_DFX_0101
'
,
3
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
'
Security_IAM_PIN_Delet_DFX_0101 publicOpenSession challenge =
'
+
challenge
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
let
addcredresult101
=
data
.
addCredresult
;
console
.
info
(
'
Security_IAM_PIN_Delet_DFX_0101 publicaddCredential=
'
+
addcredresult101
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
addcredresult101
=
data
;
console
.
info
(
'
Security_IAM_PIN_Delet_DFX_0101 auth=
'
+
JSON
.
stringify
(
addcredresult101
));
let
token
=
addcredresult101
.
authextr
.
token
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
'
Security_IAM_PIN_Delet_DFX_0101 publicdelUser=
'
+
deluserresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
deluserresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
deluserresult
=
data
.
delUserresult
;
expect
(
ResultCode
.
Authfail
).
assertEqual
(
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_PIN_Delet_DFX_0101 publicCloseSession data =
'
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
Security_IAM_PIN_Delet_DFX_0101 unRegisterInputer =
'
+
data
);
done
();
})
})
})
})
},
function
(
data
)
{
})
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_Delet_DFX_0101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
})
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_PIN_Func_CallbackJsunit.test.js
已删除
100644 → 0
浏览文件 @
d60c9f66
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
userAuth
from
'
@ohos.userAuth
'
import
userIDM
from
'
@ohos.userIDM
'
import
pinAuth
from
'
@ohos.pinAuth
'
import
*
as
publicFC
from
'
./Publicfunction-n
'
let
UserIDM
=
new
userIDM
.
UserIdentityManager
();
let
PinAuth
=
new
pinAuth
.
PINAuth
();
let
UserAuth
=
new
userAuth
.
UserAuth
();
let
AuthType
=
{
PIN
:
1
,
FACE
:
2
}
let
AuthSubType
=
{
PIN_SIX
:
10000
,
PIN_NUMBER
:
10001
,
PIN_MIXED
:
10002
,
FACE_2D
:
20000
,
FACE_3D
:
20001
}
let
AuthTurstLevel
=
{
ATL1
:
10000
,
ATL2
:
20000
,
ATL3
:
30000
,
ATL4
:
40000
}
let
SetPropertyType
=
{
PROCESS_ALGORITHM
:
1
,
}
let
userID
=
{
User1
:
100
,
User2
:
2
,
User3
:
3
,
User4
:
4
,
User5
:
5
}
let
ResultCode
=
{
SUCCESS
:
0
,
FAIL
:
1
,
GENERAL_ERROR
:
2
,
CANCELED
:
3
,
TIMEOUT
:
4
,
TYPE_NOT_SUPPORT
:
5
,
TRUST_LEVEL_NOT_SUPPORT
:
6
,
BUSY
:
7
,
INVALID_PARAMETERS
:
8
,
LOCKED
:
9
,
NOT_ENROLLED
:
10
,
Authfail
:
14
}
let
GetPropertyType
=
{
AUTH_SUB_TYPE
:
1
,
REMAIN_TIMES
:
2
,
FREEZING_TIME
:
3
}
let
Inputerdata
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
]);
let
Inputerdatan
=
new
Uint8Array
([
1
,
1
,
1
,
1
,
1
,
1
]);
let
Inputerdatanum
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
]);
let
Inputerdatanumn
=
new
Uint8Array
([
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
]);
let
Inputerdatamix
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
]);
let
Inputerdatamixn
=
new
Uint8Array
([
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
]);
let
GetPropertyTypearray
=
new
Array
();
GetPropertyTypearray
[
0
]
=
GetPropertyType
.
AUTH_SUB_TYPE
;
GetPropertyTypearray
[
1
]
=
GetPropertyType
.
FREEZING_TIME
;
GetPropertyTypearray
[
2
]
=
GetPropertyType
.
REMAIN_TIMES
;
let
GetPropertyRequestpin
=
{
authType
:
AuthType
.
PIN
,
keys
:
GetPropertyTypearray
}
let
GetPropertyRequestface
=
{
authType
:
AuthType
.
FACE
,
keys
:
GetPropertyTypearray
}
let
CredentialInfopinsix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_SIX
,
token
:
null
}
let
CredentialInfopinnum
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_NUMBER
,
token
:
null
}
let
CredentialInfopinmix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_MIXED
,
token
:
null
}
let
CredentialInfoface2d
=
{
credType
:
AuthType
.
FACE
,
credSubType
:
AuthSubType
.
FACE_2D
,
token
:
null
}
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
describe
(
'
userauthTest_two7
'
,
function
()
{
it
(
'
Security_IAM_PIN_AddCred_Func_0101
'
,
0
,
async
function
(
done
)
{
try
{
let
registerresult
=
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
expect
(
true
).
assertEqual
(
registerresult
);
registerresult
=
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
expect
(
false
).
assertEqual
(
registerresult
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0101 publicunRegisterInputer unRegist =
"
+
data
)
})
done
();
}
catch
(
e
)
{
console
.
log
(
"
testFace Security_IAM_PIN_AddCred_Func_0101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_AddCred_Func_0102
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0102 start
'
);
try
{
let
challenge
;
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
);
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0102 publicOpenSession data =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
console
.
info
(
'
testFace PIN_AddCred_Func_0102 callback data =
'
+
JSON
.
stringify
(
data
));
let
addcredresult101
=
data
.
addCredresult
;
console
.
info
(
"
testFace PIN_AddCred_Func_0102 addcredresult101 =
"
+
addcredresult101
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
addcredresult101
);
let
token
;
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0102 addSuccess
'
);
publicFC
.
publicauthUser
(
UserAuth
,
userID
.
User1
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth101
=
data
.
authresult
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0102 auth101 =
"
+
auth101
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
auth101
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0102 publicauth
'
);
token
=
data
.
authextr
.
token
;
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
data
.
authresult
);
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0102 token =
"
+
token
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
"
testFace PIN_AddCred_Func_0102 publicdelUser callback success
"
);
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
"
testFace PIN_AddCred_Func_0102 deluserresult =
"
+
deluserresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
testFace PIN_AddCred_Func_0102 CloseSession success data =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace PIN_AddCred_Func_0102 unRegisterInputer =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
testaddCredential101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_AddCred_Func_0103
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0103 start
'
);
try
{
let
challenge
;
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_NUMBER
,
Inputerdatanum
);
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0103 publicOpenSession data =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
console
.
info
(
'
testFace PIN_AddCred_Func_0103 callback data =
'
+
JSON
.
stringify
(
data
));
let
addcredresult101
=
data
.
addCredresult
;
console
.
info
(
"
testFace PIN_AddCred_Func_0103 addcredresult101 =
"
+
addcredresult101
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
addcredresult101
);
let
token
;
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0103 addSuccess
'
);
publicFC
.
publicauthUser
(
UserAuth
,
userID
.
User1
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth101
=
data
.
authresult
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0103 auth101 =
"
+
auth101
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
auth101
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0103 publicauth
'
);
token
=
data
.
authextr
.
token
;
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
data
.
authresult
);
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0103 token =
"
+
token
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0103 publicdelUser
"
);
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
"
testFace PIN_AddCred_Func_0103 deluserresult =
"
+
deluserresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
testFace PIN_AddCred_Func_0103 publicCloseSession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace PIN_AddCred_Func_0103 unRegister success =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
testaddCredential101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_AddCred_Func_0104
'
,
1
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0104 start
'
);
try
{
let
challenge
;
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_MIXED
,
Inputerdatamix
);
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0104 publicOpenSession data =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinmix
,
function
(
data
)
{
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0104 callback =
'
+
JSON
.
stringify
(
data
));
let
addcredresult101
=
data
.
addCredresult
;
console
.
info
(
"
testFace PIN_AddCred_Func_0104 addcredresult101 =
"
+
addcredresult101
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
addcredresult101
);
let
token
;
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0104 addSuccess
'
);
publicFC
.
publicauthUser
(
UserAuth
,
userID
.
User1
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth101
=
data
.
authresult
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0104 auth101 =
"
+
auth101
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
auth101
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0104 publicauth
'
);
token
=
data
.
authextr
.
token
;
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
data
.
authresult
);
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0104 token =
"
+
token
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0104 publicdelUser callback
"
);
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
"
testFace PIN_AddCred_Func_0104 publicdeluserresult =
"
+
deluserresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
testFace PIN_AddCred_Func_0104 publicCloseSession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace PIN_AddCred_Func_0104 unRegister success =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
testaddCredential101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
j
})
it
(
'
Security_IAM_PIN_AddCred_Func_0105
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_AddCred_Func_0105 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_MIXED
,
Inputerdata
);
let
challenge
;
let
cancelresult
;
let
token
;
// cancelresult = publicFC.publiccancel(UserIDM, challenge);
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0105 cancelresult
"
+
cancelresult
);
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
challenge
=
data
;
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0105 challenge
"
+
challenge
);
let
result1
=
null
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinmix
,
async
function
(
data
)
{
result1
=
data
.
addCredresult
;
cancelresult
=
publicFC
.
publiccancel
(
UserIDM
,
challenge
);
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0105 result1
"
+
result1
);
if
(
cancelresult
==
0
){
expect
(
ResultCode
.
CANCELED
).
assertEqual
(
result1
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0105 closesession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0105 unRegist =
"
+
data
);
done
();
})
})
}
else
if
(
cancelresult
==
1
){
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
result1
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
testFace PIN_AddCred_Func_0105 publicauth
'
+
JSON
.
stringify
(
data
));
token
=
data
.
authextr
.
token
;
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0105 token =
"
+
token
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0105 publicdelUser
"
);
let
deluserresult
=
data
.
delUserresult
;
console
.
info
(
"
testFace PIN_AddCred_Func_0105 deluserresult=
"
+
deluserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
testFace PIN_AddCred_Func_0105 CloseSession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
testFace PIN_AddCred_Func_0105 unRegister=
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
}
},
function
(
data
)
{
});
console
.
info
(
"
testFace Security_IAM_PIN_AddCred_Func_0105 publiccancel =
"
+
cancelresult
);
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_AddCred_Func_0105 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
// it('Security_IAM_PIN_AddCred_Func_0106', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_MIXED, Inputerdata)
// let challenge;
// publicFC.publicOpenSession(UserIDM, function (data) {
// challenge = data;
// console.info("testFace Security_IAM_PIN_AddCred_Func_0106 challenge" + challenge);
// let result2 = null;
// publicFC.publicaddCredential(UserIDM, CredentialInfopinmix, async function (data) {
// result2 = data.addCredresult;
// console.info("testFace Security_IAM_PIN_AddCred_Func_0106 result2" + result2);
// await sleep(8000);
// let cancelresult = publicFC.publiccancel(UserIDM, challenge);
// expect(ResultCode.SUCCESS).assertEqual(cancelresult);
// expect(ResultCode.CANCELED).assertEqual(result2);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info("testFace Security_IAM_PIN_AddCred_Func_0106 closesession = " + data);
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info("testFace Security_IAM_PIN_AddCred_Func_0106 unRegist = " + data);
// done();
// })
// })
// }, function (data) {
// })
// })
// } catch (e) {
// console.log("testFace Security_IAM_PIN_AddCred_Func_0106 fail " + e);
// expect(null).assertFail();
// }
// })
// it('Security_IAM_PIN_AddCred_Func_0107', 0, async function (done) {
// console.info('testFace testaddCredentialcancel101 start');
// try {
//
// publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_MIXED, Inputerdata)
// let challenge
// publicFC.publicOpenSession(UserIDM, function (data) {
// challenge = data;
// console.info("Security_IAM_PIN_AddCred_Func_0107 challenge" + challenge);
// let result3 = null;
// publicFC.publicaddCredential(UserIDM, CredentialInfopinmix,async function (data) {
// result3 = data.addCredresult;
// console.info("Security_IAM_PIN_AddCred_Func_0107 result3" + result3);
// await sleep(11000);
// let cancelresult = publicFC.publiccancel(UserIDM, challenge);
// expect(ResultCode.SUCCESS).assertEqual(cancelresult);
// expect(ResultCode.CANCELED).assertEqual(result3);
// publicFC.publicauth(UserAuth, challenge, AuthType.PIN, AuthTurstLevel.ATL1,function (data) {
// let token = data.authextr.token;
// console.info("Security_IAM_PIN_AddCred_Func_0107 token" + token);
// publicFC.publicdelUser(UserIDM, token, function (data) {
// let deluserresult = data.delUserresult;
// console.info("Security_IAM_PIN_AddCred_Func_0107 deluserresult" + deluserresult);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info("Security_IAM_PIN_AddCred_Func_0107 closesession = " + data);
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info("Security_IAM_PIN_AddCred_Func_0107 unRegist = " + data);
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
// } catch (e) {
// console.log("Security_IAM_PIN_AddCred_Func_0107 fail " + e);
// expect(null).assertFail();
// }
// })
it
(
'
Security_IAM_PIN_Auth_Func_0101
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Auth_Func_0101 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge1
=
data
;
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0101 challenge1 =
"
+
challenge1
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
let
addcredresult101
=
data
.
addcredresult
;
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth101
=
data
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0101 auth1 =
"
+
auth101
.
authresult
);
let
token
=
auth101
.
authextr
.
token
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0101 token =
"
+
token
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0101 unRegist =
"
+
data
);
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdatan
),
500
)
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0101 challenge2 =
"
+
challenge1
);
await
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
authresult
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult
);
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
delresult
=
data
.
delUserresult
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0101 delresult =
"
+
delresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0101 closesession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0101 unRegist =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_Auth_Func_0101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_Auth_Func_0102
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Auth_Func_0102 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_MIXED
,
Inputerdatamix
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge1
=
data
;
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0102 challenge1 =
"
+
challenge1
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
let
addcredresult102
=
data
.
addcredresult
;
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth102
=
data
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0102 auth102 =
"
+
auth102
);
let
token
=
auth102
.
authextr
.
token
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0102 token =
"
+
token
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0102 unRegist =
"
+
data
);
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_MIXED
,
Inputerdatamixn
),
500
)
await
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
authresult
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult
);
let
deluserresult
=
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
delresult
=
data
.
delUserresult
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0102 delresult =
"
+
delresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0102 closesession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0102 unRegist =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_Auth_Func_0102 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_Auth_Func_0103
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Auth_Func_0103 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_NUMBER
,
Inputerdatanum
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge1
=
data
;
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0103 challenge1 =
"
+
challenge1
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
let
addcredresult103
=
data
.
addcredresult
;
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth103
=
data
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0103 auth103 =
"
+
auth103
);
let
token
=
auth103
.
authextr
.
token
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0103 token =
"
+
token
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0103 unRegist =
"
+
data
);
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_NUMBER
,
Inputerdatanumn
),
500
)
await
publicFC
.
publicauth
(
UserAuth
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
authresult
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult
);
let
deluserresult
=
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
delresult
=
data
.
delUserresult
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0103 delresult =
"
+
delresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0103 closesession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0103 unRegist =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_Auth_Func_0103 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_Auth_Func_0104
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Auth_Func_0104 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge1
=
data
;
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0104 challenge1 =
"
+
challenge1
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
let
addcredresult101
=
data
.
addcredresult
;
publicFC
.
publicauthUser
(
UserAuth
,
userID
.
User1
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth101
=
data
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0104 auth1 =
"
+
auth101
.
authresult
);
let
token
=
auth101
.
authextr
.
token
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0104 token =
"
+
token
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0104 unRegist =
"
+
data
);
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdatan
),
500
)
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0104 challenge2 =
"
+
challenge1
);
await
publicFC
.
publicauthUser
(
UserAuth
,
userID
.
User1
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
authresult
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult
);
let
deluserresult
=
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
delresult
=
data
.
delUserresult
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0104 delresult =
"
+
delresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0104 closesession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0104 unRegist =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_Auth_Func_0104 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_Auth_Func_0105
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Auth_Func_0105 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_MIXED
,
Inputerdatamix
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge1
=
data
;
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0105 challenge1 =
"
+
challenge1
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
let
addcredresult102
=
data
.
addcredresult
;
publicFC
.
publicauthUser
(
UserAuth
,
userID
.
User1
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth102
=
data
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0105 auth102 =
"
+
auth102
);
let
token
=
auth102
.
authextr
.
token
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0105 token =
"
+
token
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0105 unRegist =
"
+
data
);
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_MIXED
,
Inputerdatamixn
),
500
)
await
publicFC
.
publicauthUser
(
UserAuth
,
userID
.
User1
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
authresult
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult
);
let
deluserresult
=
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
delresult
=
data
.
delUserresult
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0105 delresult =
"
+
delresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0105 closesession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0105 unRegist =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_Auth_Func_0105 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_Auth_Func_0106
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Auth_Func_0106 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_NUMBER
,
Inputerdatanum
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge1
=
data
;
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0106 challenge1 =
"
+
challenge1
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
let
addcredresult103
=
data
.
addcredresult
;
publicFC
.
publicauthUser
(
UserAuth
,
userID
.
User1
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth103
=
data
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0106 auth103 =
"
+
auth103
);
let
token
=
auth103
.
authextr
.
token
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0106 token =
"
+
token
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0106 unRegist =
"
+
data
);
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_NUMBER
,
Inputerdatanumn
),
500
)
await
publicFC
.
publicauthUser
(
UserAuth
,
userID
.
User1
,
challenge1
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
authresult
=
data
.
authresult
expect
(
ResultCode
.
FAIL
).
assertEqual
(
authresult
);
let
deluserresult
=
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
let
delresult
=
data
.
delUserresult
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0106 delresult =
"
+
delresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0106 closesession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Auth_Func_0106 unRegist =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_Auth_Func_0103 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
// it('Security_IAM_PIN_Auth_Func_0107', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_SIX, Inputerdata)
// publicFC.publicOpenSession(UserIDM, function (data) {
// let challenge = data;
// console.info("Security_IAM_PIN_Auth_Func_0107 challenge = " + challenge);
// publicFC.publicaddCredential(UserIDM, CredentialInfopinsix, function (data) {
// let addcredresult101 = data.addCredresult;
// console.info("Security_IAM_PIN_Auth_Func_0107 addcredresult101 = " + addcredresult101);
// let result1 = null;
// let contextID1 = null;
// contextID1 = publicFC.publicauth(challenge, AuthType.PIN, AuthTurstLevel.ATL1,
// async function (data) {
// console.info("Security_IAM_PIN_Auth_Func_0107 contextID1 = " + contextID1);
// result1 = data.authresult;
// console.info("Security_IAM_PIN_Auth_Func_0107 result1 = " + result1);
// await sleep(3000);
// let cancelAuthresult = publicFC.publicgecancelAuth(UserAuth, contextID1)
// console.info("Security_IAM_PIN_Auth_Func_0107 cancelAuthresult = " + cancelAuthresult);
// expect(ResultCode.SUCCESS).assertEqual(cancelAuthresult);
// expect(ResultCode.CANCELED).assertEqual(result1);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info("Security_IAM_PIN_Auth_Func_0107 closesession = " + data);
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info("Security_IAM_PIN_Auth_Func_0107 unRegist = " + data);
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
// } catch (e) {
// console.log("Security_IAM_PIN_Auth_Func_0107 fail " + e);
// expect(null).assertFail();
// }
// })
// it('Security_IAM_PIN_Auth_Func_0108', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_SIX, Inputerdata)
// publicFC.publicOpenSession(UserIDM, function (data) {
// let challenge = data;
// console.info("Security_IAM_PIN_Auth_Func_0108 challenge = " + challenge);
// publicFC.publicaddCredential(UserIDM, CredentialInfopinsix, function (data) {
// let addcredresult102 = data.addCredresult;
// console.info("Security_IAM_PIN_Auth_Func_0108 addcredresult102 = " + addcredresult102);
// let result2 = null;
// let contextID2 = null;
// contextID2 = publicFC.publicauth(challenge, AuthType.PIN, AuthTurstLevel.ATL1,
// async function (data) {
// console.info("Security_IAM_PIN_Auth_Func_0108 contextID2 = " + contextID2);
// result2 = data.authresult;
// console.info("Security_IAM_PIN_Auth_Func_0108 result2 = " + result2);
// await sleep(8000);
// let cancelAuthresult = publicFC.publicgecancelAuth(UserAuth, contextID2)
// console.info("Security_IAM_PIN_Auth_Func_0108 cancelAuthresult = " + cancelAuthresult);
// expect(ResultCode.SUCCESS).assertEqual(cancelAuthresult);
// expect(ResultCode.CANCELED).assertEqual(result2);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info("Security_IAM_PIN_Auth_Func_0108 closesession = " + data);
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info("Security_IAM_PIN_Auth_Func_0108 unRegist = " + data);
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
// } catch (e) {
// console.log("Security_IAM_PIN_Auth_Func_0108 fail " + e);
// expect(null).assertFail();
// }
// })
// it('Security_IAM_PIN_Auth_Func_0109', 0, async function (done) {
// try {
//
// publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_SIX, Inputerdata)
// publicFC.publicOpenSession(UserIDM, function (data) {
// let challenge = data;
// console.info("Security_IAM_PIN_Auth_Func_0109 challenge = " + challenge);
// publicFC.publicaddCredential(UserIDM, CredentialInfopinsix, function (data) {
// let addcredresult103 = data.addCredresult;
// console.info("Security_IAM_PIN_Auth_Func_0109 addcredresult103 = " + addcredresult103);
// let result3 = null;
// let contextID3 = null;
// contextID3 = publicFC.publicauth(challenge, AuthType.PIN, AuthTurstLevel.ATL1,
// async function (data) {
// console.info("Security_IAM_PIN_Auth_Func_0109 contextID3 = " + contextID3);
// result3 = data.authresult;
// console.info("Security_IAM_PIN_Auth_Func_0109 result3 = " + result3);
// let token = data.authextr.token;
// await sleep(11000);
// let cancelAuthresult = publicFC.publicgecancelAuth(UserAuth, contextID3)
// console.info("Security_IAM_PIN_Auth_Func_0109 cancelAuthresult = " + cancelAuthresult);
// expect(ResultCode.SUCCESS).assertEqual(cancelAuthresult);
// expect(ResultCode.CANCELED).assertEqual(result3);
// publicFC.publicdelUser(UserIDM, token, function (data) {
// let deluserresult = data.delUserresult
// console.info("Security_IAM_PIN_Auth_Func_0109 deluserresult = " + deluserresult);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info("Security_IAM_PIN_Auth_Func_0109 closesession = " + data);
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info("Security_IAM_PIN_Auth_Func_0109 unRegist = " + data);
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
//
// } catch (e) {
// console.log("testcancelauth103 fail " + e);
// expect(null).assertFail();
// }
// })
// it('Security_IAM_PIN_Auth_Func_0110', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_SIX, Inputerdata)
// publicFC.publicOpenSession(UserIDM, function (data) {
// let challenge = data;
// console.info("testFace Security_IAM_PIN_Auth_Func_0110 challenge = " + challenge);
// publicFC.publicaddCredential(UserIDM, CredentialInfopinsix, function (data) {
// let addcredresult101 = data.addCredresult;
// console.info("testFace PIN_Auth_Func_0110 addcredresult101 = " + addcredresult101);
// let result1 = null;
// let contextID1 = null;
// contextID1 = publicFC.publicauthUser(challenge, AuthType.PIN, AuthTurstLevel.ATL1,
// async function (data) {
// console.info("testFace Security_IAM_PIN_Auth_Func_0110 contextID1 = " + contextID1);
// result1 = data.authresult;
// console.info("testFace Security_IAM_PIN_Auth_Func_0110 result2 = " + result1);
// await sleep(3000);
// let cancelAuthresult = publicFC.publicgecancelAuth(UserAuth, contextID1)
// console.info("testFace PIN_Auth_Func_0110 cancelAuthresult = " + cancelAuthresult);
// expect(ResultCode.SUCCESS).assertEqual(cancelAuthresult);
// expect(ResultCode.CANCELED).assertEqual(result1);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info("testFace Security_IAM_PIN_Auth_Func_0110 closesession = " + data);
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info("testFace Security_IAM_PIN_Auth_Func_0110 unRegist = " + data);
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
// } catch (e) {
// console.log("testFace Security_IAM_PIN_Auth_Func_0110 fail " + e);
// expect(null).assertFail();
// }
// })
// it('Security_IAM_PIN_Auth_Func_0111', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_SIX, Inputerdata)
// publicFC.publicOpenSession(UserIDM, function (data) {
// let challenge = data;
// console.info("testFace Security_IAM_PIN_Auth_Func_0111 challenge = " + challenge);
// publicFC.publicaddCredential(UserIDM, CredentialInfopinsix, function (data) {
// let addcredresult102 = data.addCredresult;
// console.info("testFace PIN_Auth_Func_0111 addcredresult102 = " + addcredresult102);
// let result2 = null;
// let contextID2 = null;
// contextID2 = publicFC.publicauthUser(challenge, AuthType.PIN, AuthTurstLevel.ATL1,
// async function (data) {
// console.info("testFace Security_IAM_PIN_Auth_Func_0111 contextID2 = " + contextID2);
// result2 = data.authresult;
// console.info("testFace Security_IAM_PIN_Auth_Func_0111 result2 = " + result2);
// await sleep(8000);
// let cancelAuthresult = publicFC.publicgecancelAuth(UserAuth, contextID2)
// console.info("testFace PIN_Auth_Func_0111 cancelAuthresult = " + cancelAuthresult);
// expect(ResultCode.SUCCESS).assertEqual(cancelAuthresult);
// expect(ResultCode.CANCELED).assertEqual(result2);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info("testFace Security_IAM_PIN_Auth_Func_0111 closesession = " + data);
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info("testFace Security_IAM_PIN_Auth_Func_0111 unRegist = " + data);
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
// } catch (e) {
// console.log("testFace Security_IAM_PIN_Auth_Func_0111 fail " + e);
// expect(null).assertFail();
// }
// })
// it('Security_IAM_PIN_Auth_Func_0112', 0, async function (done) {
// try {
// publicFC.publicRegisterInputer(PinAuth, AuthSubType.PIN_SIX, Inputerdata)
// publicFC.publicOpenSession(UserIDM, function (data) {
// let challenge = data;
// console.info("testFace Security_IAM_PIN_Auth_Func_0112 challenge = " + challenge);
// publicFC.publicaddCredential(UserIDM, CredentialInfopinsix, function (data) {
// let addcredresult103 = data.addCredresult;
// console.info("testFace PIN_Auth_Func_0112 addcredresult103 = " + addcredresult103);
// let result3 = null;
// let contextID3 = null;
// contextID3 = publicFC.publicauthUser(challenge, AuthType.PIN, AuthTurstLevel.ATL1,
// async function (data) {
// console.info("testFace Security_IAM_PIN_Auth_Func_0112 contextID3 = " + contextID3);
// result3 = data.authresult;
// console.info("testFace Security_IAM_PIN_Auth_Func_0112 result3 = " + result3);
// let token = data.authextr.token;
// await sleep(11000);
// let cancelAuthresult = publicFC.publicgecancelAuth(UserAuth, contextID3)
// console.info("testFace PIN_Auth_Func_0112 cancelAuthresult = " + cancelAuthresult);
// expect(ResultCode.SUCCESS).assertEqual(cancelAuthresult);
// expect(ResultCode.CANCELED).assertEqual(result3);
// publicFC.publicdelUser(UserIDM, token, function (data) {
// let deluserresult = data.delUserresult
// console.info("testFace PIN_Auth_Func_0112 deluserresult = " + deluserresult);
// publicFC.publicCloseSession(UserIDM, function (data) {
// console.info("testFace Security_IAM_PIN_Auth_Func_0112 closesession = " + data);
// publicFC.publicunRegisterInputer(PinAuth, function (data) {
// console.info("testFace Security_IAM_PIN_Auth_Func_0112 unRegist = " + data);
// done();
// })
// })
// }, function (data) {
// })
// }, function (data) {
// })
// }, function (data) {
// })
// })
// } catch (e) {
// console.log("testFace Security_IAM_PIN_Auth_Func_0112 fail " + e);
// expect(null).assertFail();
// }
// })
it
(
'
Security_IAM_PIN_Update_Func_0101
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Update_Func_0101 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
"
Security_IAM_PIN_Update_Func_0101 challenge =
"
+
challenge
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
let
addcredresult101
=
data
.
addcredresult
;
console
.
info
(
"
Security_IAM_PIN_Update_Func_0101 addcredresult101 =
"
+
addcredresult101
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth101
=
data
console
.
info
(
"
Security_IAM_PIN_Update_Func_0101 auth101 =
"
+
auth101
);
let
token
=
auth101
.
authextr
.
token
console
.
info
(
"
Security_IAM_PIN_Update_Func_0101 token =
"
+
token
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Update_Func_0101 unRegist =
"
+
data
);
await
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_NUMBER
,
Inputerdatanum
),
500
)
CredentialInfopinnum
.
token
=
token
console
.
info
(
"
PIN_Update_Func_0101 Infopinnum.token =
"
+
CredentialInfopinnum
.
token
);
await
publicFC
.
publicupdateCred
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
let
updateresult
=
data
.
updateCredresult
;
console
.
info
(
"
Security_IAM_PIN_Update_Func_0101 updateresult =
"
+
updateresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
updateresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
auth101
=
data
console
.
info
(
"
Security_IAM_PIN_Update_Func_0101 auth101 =
"
+
auth101
);
let
token1
=
auth101
.
authextr
.
token
console
.
info
(
"
Security_IAM_PIN_Update_Func_0101 token1 =
"
+
token1
);
publicFC
.
publicdelUser
(
UserIDM
,
token1
,
function
(
data
)
{
console
.
info
(
"
PIN_Update_Func_0101 delUser result =
"
+
data
.
delUserresult
);
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Update_Func_0101 closesession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Update_Func_0101 unRegist =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
testupdateCredential101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_Update_Func_0102
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Update_Func_0102 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_NUMBER
,
Inputerdatanum
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
"
Security_IAM_PIN_Update_Func_0102 challenge =
"
+
challenge
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinnum
,
function
(
data
)
{
let
addcredresult102
=
data
.
addcredresult
;
console
.
info
(
"
Security_IAM_PIN_Update_Func_0102 addcredresult102 =
"
+
addcredresult102
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth102
=
data
console
.
info
(
"
Security_IAM_PIN_Update_Func_0102 auth102 =
"
+
auth102
);
let
token
=
auth102
.
authextr
.
token
console
.
info
(
"
Security_IAM_PIN_Update_Func_0102 token =
"
+
token
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Update_Func_0102 unRegist =
"
+
data
);
await
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_MIXED
,
Inputerdatamix
),
500
)
console
.
info
(
"
Security_IAM_PIN_Update_Func_0102 challenge =
"
+
challenge
);
CredentialInfopinmix
.
token
=
token
console
.
info
(
"
PIN_Update_Func_0102 Infopinnum.token =
"
+
CredentialInfopinmix
.
token
);
await
publicFC
.
publicupdateCred
(
UserIDM
,
CredentialInfopinmix
,
function
(
data
)
{
let
updateresult
=
data
.
updateCredresult
;
console
.
info
(
"
Security_IAM_PIN_Update_Func_0102 updateresult =
"
+
updateresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
updateresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
auth102
=
data
console
.
info
(
"
Security_IAM_PIN_Update_Func_0102 auth102 =
"
+
auth102
);
let
token2
=
auth102
.
authextr
.
token
console
.
info
(
"
Security_IAM_PIN_Update_Func_0102 token2 =
"
+
token2
);
let
deluserresult
=
publicFC
.
publicdelUser
(
UserIDM
,
token2
,
function
(
data
)
{
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Update_Func_0102 closesession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Update_Func_0102 unRegist =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_PIN_Update_Func_0102 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_Update_Func_0103
'
,
3
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Update_Func_0103 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_MIXED
,
Inputerdatamix
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
let
challenge
=
data
;
console
.
info
(
"
Security_IAM_PIN_Update_Func_0103 challenge =
"
+
challenge
);
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinmix
,
function
(
data
)
{
let
addcredresult103
=
data
.
addcredresult
;
console
.
info
(
"
Security_IAM_PIN_Update_Func_0103 addcredresult103 =
"
+
addcredresult103
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
let
auth103
=
data
console
.
info
(
"
Security_IAM_PIN_Update_Func_0103 auth103 =
"
+
auth103
);
let
token
=
auth103
.
authextr
.
token
console
.
info
(
"
Security_IAM_PIN_Update_Func_0103 token =
"
+
token
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
async
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Update_Func_0103 unRegist =
"
+
data
);
await
setTimeout
(
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
),
500
)
console
.
info
(
"
Security_IAM_PIN_Update_Func_0103 challenge =
"
+
challenge
);
CredentialInfopinsix
.
token
=
token
console
.
info
(
"
PIN_Update_Func_0103 Infopinnum.token =
"
+
CredentialInfopinsix
.
token
);
await
publicFC
.
publicupdateCred
(
UserIDM
,
CredentialInfopinsix
,
function
(
data
)
{
let
updateresult
=
data
.
updateCredresult
;
console
.
info
(
"
Security_IAM_PIN_Update_Func_0103 updateresult =
"
+
updateresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
updateresult
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
auth103
=
data
console
.
info
(
"
Security_IAM_PIN_Update_Func_0103 auth103 =
"
+
auth103
);
let
token3
=
auth103
.
authextr
.
token
console
.
info
(
"
Security_IAM_PIN_Update_Func_0103 token3 =
"
+
token3
);
publicFC
.
publicdelUser
(
UserIDM
,
token3
,
function
(
data
)
{
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Update_Func_0103 closesession =
"
+
data
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
"
Security_IAM_PIN_Update_Func_0103 unRegist =
"
+
data
);
done
();
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
},
function
(
data
)
{
})
},
function
(
data
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
testupdateCredential103 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
})
useriam/face_auth/js_api_test/function_test/userauthpart2/entry/src/main/js/test/Security_IAM_PIN_Kit_CallbackJsunit.test.js
浏览文件 @
0d7b9091
...
...
@@ -13,123 +13,21 @@
* limitations under the License.
*/
import
{
describe
,
it
,
expect
}
from
'
deccjsunit/index
'
import
userAuth
from
'
@ohos.userAuth
'
import
userIDM
from
'
@ohos.userIDM
'
import
pinAuth
from
'
@ohos.pinAuth
'
import
userAuthNorth
from
'
@ohos.userIAM.userAuth
'
import
*
as
publicFC
from
'
./Publicfunction-n
'
let
UserIDM
=
new
userIDM
.
UserIdentityManager
();
let
PinAuth
=
new
pinAuth
.
PINAuth
();
let
UserAuth
=
new
userAuth
.
UserAuth
();
let
UserAuthKit
=
new
userAuthNorth
.
UserAuth
()
let
AuthType
=
{
PIN
:
1
,
FACE
:
2
}
let
AuthSubType
=
{
PIN_SIX
:
10000
,
PIN_NUMBER
:
10001
,
PIN_MIXED
:
10002
,
FACE_2D
:
20000
,
FACE_3D
:
20001
}
let
AuthTurstLevel
=
{
ATL1
:
10000
,
ATL2
:
20000
,
ATL3
:
30000
,
ATL4
:
40000
}
let
SetPropertyType
=
{
PROCESS_ALGORITHM
:
1
,
}
let
userID
=
{
User1
:
100
,
User2
:
2
,
User3
:
3
,
User4
:
4
,
User5
:
5
}
let
ResultCode
=
{
SUCCESS
:
0
,
FAIL
:
1
,
GENERAL_ERROR
:
2
,
CANCELED
:
3
,
TIMEOUT
:
4
,
TYPE_NOT_SUPPORT
:
5
,
TRUST_LEVEL_NOT_SUPPORT
:
6
,
BUSY
:
7
,
INVALID_PARAMETERS
:
8
,
LOCKED
:
9
,
NOT_ENROLLED
:
10
,
Authfail
:
14
}
let
GetPropertyType
=
{
AUTH_SUB_TYPE
:
1
,
REMAIN_TIMES
:
2
,
FREEZING_TIME
:
3
}
let
Inputerdata
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
]);
let
Inputerdatan
=
new
Uint8Array
([
1
,
1
,
1
,
1
,
1
,
1
]);
let
Inputerdatanum
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
]);
let
Inputerdatanumn
=
new
Uint8Array
([
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
]);
let
Inputerdatamix
=
new
Uint8Array
([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
]);
let
Inputerdatamixn
=
new
Uint8Array
([
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
,
1
]);
let
GetPropertyTypearray
=
new
Array
();
GetPropertyTypearray
[
0
]
=
GetPropertyType
.
AUTH_SUB_TYPE
;
GetPropertyTypearray
[
1
]
=
GetPropertyType
.
FREEZING_TIME
;
GetPropertyTypearray
[
2
]
=
GetPropertyType
.
REMAIN_TIMES
;
let
GetPropertyRequestpin
=
{
authType
:
AuthType
.
PIN
,
keys
:
GetPropertyTypearray
}
let
GetPropertyRequestface
=
{
authType
:
AuthType
.
FACE
,
keys
:
GetPropertyTypearray
}
let
CredentialInfopinsix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_SIX
,
token
:
null
}
let
CredentialInfopinnum
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_NUMBER
,
token
:
null
}
let
CredentialInfopinmix
=
{
credType
:
AuthType
.
PIN
,
credSubType
:
AuthSubType
.
PIN_MIXED
,
token
:
null
}
let
CredentialInfoface2d
=
{
credType
:
AuthType
.
FACE
,
credSubType
:
AuthSubType
.
FACE_2D
,
token
:
null
}
function
sleep
(
ms
)
{
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
describe
(
'
userauthTest_two8
'
,
function
()
{
describe
(
'
userauthTest
'
,
function
()
{
/*
* @tc.number : Security_IAM_PIN_Kit_Func_0101
* @tc.name : Kit interface get version
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
Security_IAM_PIN_Kit_Func_0101
'
,
0
,
async
function
(
done
)
{
try
{
let
getversionresult
=
null
;
...
...
@@ -143,130 +41,79 @@ describe('userauthTest_two8', function () {
}
})
it
(
'
Security_IAM_PIN_Kit_Func_0102
'
,
1
,
async
function
(
done
)
{
/*
* @tc.number : Security_IAM_PIN_Kit_Func_0102
* @tc.name : Kit interface get AvailabeStatus
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
Security_IAM_PIN_Kit_Func_0102
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace GetAvailabeStatusTest0101 start
'
);
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
){
let
challenge
=
data
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
testFace GetAvailabeStatusTest0101 addCredresult=
'
+
onresult
.
addCredresult
);
console
.
log
(
"
testFace GetAvailabeStatusTest0101 authUser result =
"
+
onresult
.
addCredresult
);
let
Available
;
Available
=
publicFC
.
publicgetAvailabeStatus
(
UserAuthKit
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
)
console
.
info
(
'
testFace GetAvailabeStatusTest0101 AvailabeStatus1 =
'
+
Available
);
console
.
info
(
'
testFace GetAvailabeStatusTest0101 ResultCode.SUCCESS =
'
+
ResultCode
.
SUCCESS
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
Available
);
Available
=
publicFC
.
publicgetAvailabeStatus
(
UserAuthKit
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL2
)
console
.
info
(
'
testFace GetAvailabeStatusTest0101 AvailabeStatus2 =
'
+
Available
);
console
.
info
(
'
testFace GetAvailabeStatusTest0101 ResultCode.SUCCESS =
'
+
ResultCode
.
SUCCESS
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
Available
);
Available
=
publicFC
.
publicgetAvailabeStatus
(
UserAuthKit
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL3
)
console
.
info
(
'
testFace GetAvailabeStatusTest0101 AvailabeStatus3 =
'
+
Available
);
console
.
info
(
'
testFace GetAvailabeStatusTest0101 ResultCode.SUCCESS =
'
+
ResultCode
.
SUCCESS
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
Available
);
Available
=
publicFC
.
publicgetAvailabeStatus
(
UserAuthKit
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL4
)
console
.
info
(
'
testFace GetAvailabeStatusTest0101 AvailabeStatus4 =
'
+
Available
);
console
.
info
(
'
testFace GetAvailabeStatusTest0101 ResultCode.SUCCESS =
'
+
ResultCode
.
SUCCESS
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
Available
);
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
onresult
)
{
console
.
info
(
'
testFace GetAvailabeStatusTest0101 publicauth =
'
+
onresult
.
authresult
);
let
token
=
onresult
.
authextr
.
token
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
onresult
){
console
.
log
(
"
testFace GetAvailabeStatusTest0101 delUser=
"
+
onresult
.
delUserresult
)
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
){
console
.
log
(
"
testFace GetAvailabeStatusTest0101 CloseSession=
"
+
data
)
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
){
done
();
})
})
},
function
(
onacquireinfo
){
})
},
function
(
onAcquireInfo
)
{
}
);
},
function
(
onAcquireInfo
)
{
});
})
let
AvailabeStatus
=
null
AvailabeStatus
=
UserAuthKit
.
getAvailableStatus
(
userAuthNorth
.
UserAuthType
.
FACE
,
userAuthNorth
.
AuthTrustLevel
.
ATL1
);
console
.
info
(
'
testFace publicgetAvailableStatus result =
'
+
JSON
.
stringify
(
AvailabeStatus
));
expect
(
6
).
assertEqual
(
AvailabeStatus
);
done
();
}
catch
(
e
)
{
console
.
log
(
"
GetAvailabeStatusTest0101 fail
"
+
e
);
expect
(
null
).
assertFail
();
}
})
it
(
'
Security_IAM_PIN_Kit_Func_0103
'
,
0
,
async
function
(
done
)
{
try
{
publicFC
.
publicRegisterInputer
(
PinAuth
,
AuthSubType
.
PIN_SIX
,
Inputerdata
)
let
challenge
;
publicFC
.
publicOpenSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
AuthTest_0101 openSession challenge =
'
+
data
);
challenge
=
data
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfopinsix
,
function
(
onresult
)
{
console
.
info
(
'
AuthTest_0101 addCredential Result1 =
'
+
JSON
.
stringify
(
onresult
));
let
info101
;
publicFC
.
publicauth
(
UserAuth
,
challenge
,
AuthType
.
PIN
,
AuthTurstLevel
.
ATL1
,
function
(
data
)
{
console
.
info
(
'
AuthTest_0101 auth onResult =
'
+
JSON
.
stringify
(
data
));
info101
=
data
;
let
token
=
info101
.
authextr
.
token
;
CredentialInfoface2d
.
token
=
token
;
let
addfaceresult
;
publicFC
.
publicaddCredential
(
UserIDM
,
CredentialInfoface2d
,
function
(
onresult
)
{
console
.
info
(
'
AuthTest_0101 addCredential Result2=
'
+
JSON
.
stringify
(
onresult
));
addfaceresult
=
onresult
;
console
.
info
(
'
AuthTest_0101 publicaddCredential =
'
+
addfaceresult
.
addCredresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
addfaceresult
.
addCredresult
);
publicFC
.
publicauth
(
UserAuthKit
,
challenge
,
AuthType
.
FACE
,
10000
,
async
function
(
data
)
{
// console.info('testFace AuthTest_0101 onResult = ' + JSON.stringify(data));
let
faceauth101
=
data
;
console
.
info
(
'
AuthTest_0101 publicauth =
'
+
faceauth101
.
authresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
faceauth101
.
authresult
);
let
authresult
;
let
contextID
=
await
publicFC
.
publicauth
(
UserAuthKit
,
challenge
,
AuthType
.
FACE
,
10000
,
function
(
data
)
{
console
.
info
(
'
AuthTest_0101 addCredential Result2=
'
+
JSON
.
stringify
(
data
.
authresult
));
authresult
=
data
.
authresult
;
},
function
(
onacquireinfo
)
{
})
let
cancelresult
=
publicFC
.
publicgecancelAuth
(
UserAuthKit
,
contextID
);
await
sleep
(
2000
);
if
(
cancelresult
==
1
){
console
.
info
(
'
AuthTest_0101 cancel = 1 authresult =
'
+
authresult
);
expect
(
ResultCode
.
SUCCESS
).
assertEqual
(
authresult
);
}
else
if
(
cancelresult
==
0
){
console
.
info
(
'
AuthTest_0101 cancel = 0 authresult =
'
+
authresult
);
console
.
info
(
'
AuthTest_0101 cancel = 0 ResultCode.FAIL =
'
+
ResultCode
.
FAIL
);
expect
(
ResultCode
.
CANCELED
).
assertEqual
(
authresult
);
}
console
.
info
(
'
testFace AuthTest_0101 onResult =
'
+
JSON
.
stringify
(
data
));
await
publicFC
.
publicdelUser
(
UserIDM
,
token
,
function
(
data
)
{
console
.
info
(
'
AuthTest_0101 delUser =
'
+
JSON
.
stringify
(
data
));
publicFC
.
publicCloseSession
(
UserIDM
,
function
(
data
)
{
console
.
info
(
'
AuthTest_0101 closeSession
'
);
publicFC
.
publicunRegisterInputer
(
PinAuth
,
function
(
data
)
{
console
.
info
(
'
AuthTest_0101 unRegister
'
);
done
();
})
})
},
function
(
onacquireinfo
)
{
})
},
function
(
onacquireinfo
)
{
})
},
function
(
onacquireinfo
)
{
})
},
function
(
data
)
{
})
},
function
(
onacquireinfo
)
{
})
})
}
catch
(
e
)
{
console
.
log
(
"
AuthTest_0101 fail
"
+
e
);
expect
(
null
).
assertFail
();
/*
* @tc.number : Security_IAM_PIN_Kit_Func_0103
* @tc.name : Kit interface auth & cancel auth
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
Security_IAM_PIN_Kit_Func_0103
'
,
0
,
async
function
(
done
)
{
let
contextID1
=
null
let
challenge
=
[
253
,
19
,
58
,
160
,
67
,
200
,
247
,
37
]
let
onresult
=
{
authresult
:
null
,
authextr
:
null
,
}
let
onacquireinfo
=
{
authmodule
:
null
,
authacquire
:
null
,
authextr
:
null
}
contextID1
=
UserAuthKit
.
auth
(
challenge
,
userAuthNorth
.
UserAuthType
.
FACE
,
userAuthNorth
.
AuthTrustLevel
.
ATL1
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
testFace faceDemo auth result =
"
+
result
);
onresult
.
authresult
=
result
;
console
.
log
(
"
testFace faceDemo auth extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
onresult
.
authextr
=
extraInfo
;
console
.
info
(
'
testFace publicauth auth onResult =
'
+
JSON
.
stringify
(
onresult
));
expect
(
1
).
assertEqual
(
result
);
console
.
info
(
'
testFace publicauth auth contextID1 =
'
+
contextID1
);
let
cancelResult
=
UserAuthKit
.
cancelAuth
(
contextID1
);
console
.
info
(
'
testFace publicauth cancelResult =
'
+
cancelResult
);
done
();
},
onAcquireInfo
:
function
(
modulea
,
acquire
,
extr
){
console
.
info
(
'
faceTest publicauth auth onAcquireInfo in
'
);
onacquireinfo
.
authmodule
=
modulea
;
onacquireinfo
.
authacquire
=
acquire
;
onacquireinfo
.
authextr
=
extr
;
console
.
log
(
"
testFace faceDemo auth module =
"
+
JSON
.
stringify
(
modulea
));
console
.
info
(
'
testFace publicauth auth onAcquireInfo =
'
+
JSON
.
stringify
(
onacquireinfo
));
}
});
})
/*
* @tc.number : Security_IAM_PIN_Kit_Func_0104
* @tc.name : Kit interface enum AuthTrustLevel
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
Security_IAM_PIN_Kit_Func_0104
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Kit_Func_0104 start
'
);
expect
(
10000
).
assertEqual
(
userAuthNorth
.
AuthTrustLevel
.
ATL1
);
...
...
@@ -277,6 +124,13 @@ it('Security_IAM_PIN_Kit_Func_0103', 0, async function (done) {
done
();
})
/*
* @tc.number : Security_IAM_PIN_Kit_Func_0105
* @tc.name : Kit interface enum FaceTips
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
Security_IAM_PIN_Kit_Func_0105
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Kit_Func_0105 start
'
);
expect
(
1
).
assertEqual
(
userAuthNorth
.
FaceTips
.
FACE_AUTH_TIP_TOO_BRIGHT
);
...
...
@@ -294,6 +148,13 @@ it('Security_IAM_PIN_Kit_Func_0103', 0, async function (done) {
done
();
})
/*
* @tc.number : Security_IAM_PIN_Kit_Func_0106
* @tc.name : Kit interface enum UserAuthType
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
Security_IAM_PIN_Kit_Func_0106
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Kit_Func_0106 start
'
);
expect
(
2
).
assertEqual
(
userAuthNorth
.
UserAuthType
.
FACE
);
...
...
@@ -302,6 +163,13 @@ it('Security_IAM_PIN_Kit_Func_0103', 0, async function (done) {
done
();
})
/*
* @tc.number : Security_IAM_PIN_Kit_Func_0107
* @tc.name : Kit interface enum ResultCode
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
Security_IAM_PIN_Kit_Func_0107
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Kit_Func_0107 start
'
);
expect
(
0
).
assertEqual
(
userAuthNorth
.
ResultCode
.
SUCCESS
);
...
...
@@ -319,6 +187,13 @@ it('Security_IAM_PIN_Kit_Func_0103', 0, async function (done) {
done
();
})
/*
* @tc.number : Security_IAM_PIN_Kit_Func_0108
* @tc.name : Kit interface enum FingerprintTips
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
Security_IAM_PIN_Kit_Func_0108
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Kit_Func_0108 start
'
);
expect
(
0
).
assertEqual
(
userAuthNorth
.
FingerprintTips
.
FINGERPRINT_AUTH_TIP_GOOD
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录