Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ea3298c5
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ea3298c5
编写于
4月 15, 2023
作者:
O
openharmony_ci
提交者:
Gitee
4月 15, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8438 【master】【4.0.6.2】【security】add useriam_fingerprint code
Merge pull request !8438 from yuanyuhang/master0413_1
上级
b64f0635
fe32377b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
220 addition
and
209 deletion
+220
-209
useriam/face_auth/js_api_test/function_test/userauthnopermission/src/main/js/test/nopermisson.js
...test/userauthnopermission/src/main/js/test/nopermisson.js
+128
-118
useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/Security_IAM_FUNC_Jsunit.test.js
...thpart2/src/main/js/test/Security_IAM_FUNC_Jsunit.test.js
+74
-77
useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/Security_IAM_PIN_Kit_CallbackJsunit.test.js
.../main/js/test/Security_IAM_PIN_Kit_CallbackJsunit.test.js
+18
-14
未找到文件。
useriam/face_auth/js_api_test/function_test/userauthnopermission/src/main/js/test/nopermisson.js
浏览文件 @
ea3298c5
...
...
@@ -77,50 +77,53 @@ describe('userAuthTestExecute', function () {
console
.
log
(
"
JSAPI_Function_Nopermission_1800 end
"
);
})
/*
* @tc.number : Security_IAM_Nopermission_API8_Func_0101
* @tc.name : Kit interface get version
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
/*
* @tc.number : Security_IAM_Nopermission_API8_Func_0101
* @tc.name : Kit interface get version
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
Security_IAM_Nopermission_API8_Func_0101
'
,
0
,
async
function
(
done
)
{
try
{
let
getversionresult
=
null
;
getversionresult
=
UserAuthKit
.
getVersion
();
console
.
info
(
'
Security_IAM_Nopermission_API8_Func_0101 getversionresult =
'
+
getversionresult
);
//mini version 0
expect
(
getversionresult
).
assertEqual
(
0
);
done
();
}
catch
(
e
)
{
console
.
log
(
"
testFace Security_IAM_Nopermission_API8_Func_0101 fail
"
+
e
.
code
);
expect
(
null
).
assertFail
();
done
();
}
})
/*
* @tc.number : Security_IAM_Nopermission_API8_Func_0112
* @tc.name : Kit interface get AvailabeStatus
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
Security_IAM_Nopermission_API8_Func_0101
'
,
0
,
async
function
(
done
)
{
it
(
'
Security_IAM_Nopermission_API8_Func_0112
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Nopermission_API8_Func_0112 start
'
);
let
authType
=
[
2
,
4
]
for
(
let
idx0
=
0
;
idx0
<
authType
.
length
;
idx0
++
){
try
{
let
getversionresult
=
null
;
getversionresult
=
UserAuthKit
.
getVersion
(
);
console
.
info
(
'
Security_IAM_Nopermission_API8_Func_0101 getversionresult =
'
+
getversionresult
);
//
mini version 0
expect
(
getversionresult
).
assertEqual
(
0
);
done
()
;
let
AvailabeStatus
=
null
AvailabeStatus
=
UserAuthKit
.
getAvailableStatus
(
authType
[
idx0
],
10000
);
console
.
info
(
'
testFace Security_IAM_Nopermission_API8_Func_0112,2,10000 result =
'
+
JSON
.
stringify
(
AvailabeStatus
)
);
//
201
expect
(
201
).
assertEqual
(
AvailabeStatus
);
done
()
}
catch
(
e
)
{
console
.
log
(
"
testFace Security_IAM_Nopermission_API8_Func_0101
fail
"
+
e
.
code
);
expect
(
null
).
assertFail
(
);
done
()
;
console
.
log
(
"
Security_IAM_Nopermission_API8_Func_0112
fail
"
+
e
.
code
);
expect
(
201
).
assertEqual
(
e
.
code
);
done
()
}
})
/*
* @tc.number : Security_IAM_Nopermission_API8_Func_0112
* @tc.name : Kit interface get AvailabeStatus
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
Security_IAM_Nopermission_API8_Func_0112
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Nopermission_API8_Func_0112 start
'
);
try
{
let
AvailabeStatus
=
null
AvailabeStatus
=
UserAuthKit
.
getAvailableStatus
(
2
,
10000
);
console
.
info
(
'
testFace Security_IAM_Nopermission_API8_Func_0112,2,10000 result =
'
+
JSON
.
stringify
(
AvailabeStatus
));
//201
expect
(
201
).
assertEqual
(
AvailabeStatus
);
done
()
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Nopermission_API8_Func_0112 fail
"
+
e
.
code
);
expect
(
201
).
assertEqual
(
e
.
code
);
done
()
}
})
}
})
/*
* @tc.number : Security_IAM_Nopermission_API8_Func_0103
...
...
@@ -141,49 +144,53 @@ describe('userAuthTestExecute', function () {
authacquire
:
null
,
authextr
:
null
}
console
.
log
(
"
Security_IAM_Nopermission_API8_Func_0103 2,10000
"
);
contextID1
=
UserAuthKit
.
auth
(
challenge
,
userAuth
.
UserAuthType
.
FACE
,
userAuth
.
AuthTrustLevel
.
ATL1
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
Security_IAM_Nopermission_API8_Func_0103 auth result =
"
+
result
);
onresult
.
authresult
=
result
;
//201
expect
(
201
).
assertEqual
(
result
);
console
.
info
(
'
Security_IAM_Nopermission_API8_Func_0103 contextID1 =
'
+
contextID1
);
let
cancelResult
=
UserAuthKit
.
cancelAuth
(
contextID1
);
console
.
info
(
'
Security_IAM_Nopermission_API8_Func_0103 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
));
}
});
done
();
let
authType
=
[
userAuth
.
UserAuthType
.
FACE
,
userAuth
.
UserAuthType
.
FINGERPRINT
]
for
(
let
idx0
=
0
;
idx0
<
authType
.
length
;
idx0
++
)
{
console
.
log
(
"
Security_IAM_Nopermission_API8_Func_0103 authtype:
"
+
authType
[
idx0
]
+
"
trustlevel:10000
"
);
contextID1
=
UserAuthKit
.
auth
(
challenge
,
authType
[
idx0
],
userAuth
.
AuthTrustLevel
.
ATL1
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
Security_IAM_Nopermission_API8_Func_0103 auth result =
"
+
result
);
onresult
.
authresult
=
result
;
//201
expect
(
201
).
assertEqual
(
result
);
console
.
info
(
'
Security_IAM_Nopermission_API8_Func_0103 contextID1 =
'
+
contextID1
);
let
cancelResult
=
UserAuthKit
.
cancelAuth
(
contextID1
);
console
.
info
(
'
Security_IAM_Nopermission_API8_Func_0103 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
));
}
});
done
();
}
})
/*
* @tc.number : Security_IAM_Nopermiss
on
_Func_0104
* @tc.number : Security_IAM_Nopermiss
ion_API9
_Func_0104
* @tc.name : getAvailabeStatus invalid parameters
* @tc.size : MediumTest
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
Security_IAM_Nopermisson_API9_Func_0104
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Nopermisson_API9_Func_0104 start
'
);
try
{
userAuth
.
getAvailableStatus
(
userAuth
.
UserAuthType
.
FACE
,
userAuth
.
AuthTrustLevel
.
ATL1
);
console
.
log
(
"
Security_IAM_Nopermisson_API9_Func_0104 success
"
);
done
()
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Nopermisson_API9_Func_0104 fail
"
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
201
);
done
()
it
(
'
Security_IAM_Nopermission_API9_Func_0104
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_Nopermission_API9_Func_0104 start
'
);
let
authType
=
[
userAuth
.
UserAuthType
.
FACE
,
userAuth
.
UserAuthType
.
FINGERPRINT
];
for
(
let
idx0
=
0
;
idx0
<
authType
.
length
;
idx0
++
)
{
try
{
userAuth
.
getAvailableStatus
(
authType
[
idx0
],
userAuth
.
AuthTrustLevel
.
ATL1
);
console
.
log
(
"
Security_IAM_Nopermission_API9_Func_0104 success
"
);
done
()
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Nopermission_API9_Func_0104 fail
"
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
201
);
done
()
}
}
})
...
...
@@ -197,17 +204,18 @@ describe('userAuthTestExecute', function () {
*/
it
(
'
Security_IAM_Nopermission_API9_Func_0110
'
,
0
,
async
function
(
done
)
{
let
challenge
=
new
Uint8Array
([
253
,
19
,
58
,
160
,
67
,
200
,
247
,
37
])
let
authType
=
userAuth
.
UserAuthType
.
FACE
;
let
authType
=
[
userAuth
.
UserAuthType
.
FACE
,
userAuth
.
UserAuthType
.
FINGERPRINT
]
;
let
authTrustLevel
=
userAuth
.
AuthTrustLevel
.
ATL1
;
try
{
var
authInstance
=
userAuth
.
getAuthInstance
(
challenge
,
authType
,
authTrustLevel
);
console
.
log
(
"
Security_IAM_Nopermission_API9_Func_0110 FACE ATL1 success
"
);
done
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Nopermission_API9_Func_0110 FACE ATL1 fail
"
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
201
);
done
();
for
(
let
idx0
=
0
;
idx0
<
authType
.
length
;
idx0
++
)
{
try
{
var
authInstance
=
userAuth
.
getAuthInstance
(
challenge
,
authType
[
idx0
],
authTrustLevel
);
console
.
log
(
"
Security_IAM_Nopermission_API9_Func_0110 FACE ATL1 success
"
);
done
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Nopermission_API9_Func_0110 FACE ATL1 fail
"
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
201
);
done
();
}
}
})
...
...
@@ -220,44 +228,46 @@ describe('userAuthTestExecute', function () {
*/
it
(
'
Security_IAM_Nopermission_API9_Func_0103
'
,
0
,
async
function
(
done
)
{
let
challenge
=
new
Uint8Array
([
253
,
19
,
58
,
160
,
67
,
200
,
247
,
37
])
let
authType
=
userAuth
.
UserAuthType
.
FACE
;
let
authType
=
[
userAuth
.
UserAuthType
.
FACE
,
userAuth
.
UserAuthType
.
FINGERPRINT
]
;
let
authTrustLevel
=
userAuth
.
AuthTrustLevel
.
ATL1
;
try
{
var
authInstance
=
userAuth
.
getAuthInstance
(
challenge
,
authType
,
authTrustLevel
);
// register result and tip
authInstance
.
on
(
"
result
"
,
{
callback
:
(
result
)
=>
{
console
.
log
(
"
authV9 result
"
+
result
.
result
);
console
.
log
(
"
authV9 token
"
+
result
.
token
);
console
.
log
(
"
authV9 remainAttempts
"
+
result
.
remainAttempts
);
console
.
log
(
"
authV9 lockoutDuration
"
+
result
.
lockoutDuration
);
expect
(
result
.
result
).
assertEqual
(
userAuth
.
UserAuthResultCode
.
NOT_ENROLLED
);
}
});
for
(
let
idx0
=
0
;
idx0
<
authType
.
length
;
idx0
++
)
{
try
{
var
authInstance
=
userAuth
.
getAuthInstance
(
challenge
,
authType
[
idx0
],
authTrustLevel
);
// register result and tip
authInstance
.
on
(
"
result
"
,
{
callback
:
(
result
)
=>
{
console
.
log
(
"
authV9 result
"
+
result
.
result
);
console
.
log
(
"
authV9 token
"
+
result
.
token
);
console
.
log
(
"
authV9 remainAttempts
"
+
result
.
remainAttempts
);
console
.
log
(
"
authV9 lockoutDuration
"
+
result
.
lockoutDuration
);
expect
(
result
.
result
).
assertEqual
(
userAuth
.
UserAuthResultCode
.
NOT_ENROLLED
);
}
});
authInstance
.
on
(
"
tip
"
,
{
callback
:
(
result
)
=>
{
console
.
log
(
"
authV9 module
"
+
result
.
module
);
console
.
log
(
"
authV9 tip
"
+
result
.
tip
);
}
});
authInstance
.
on
(
"
tip
"
,
{
callback
:
(
result
)
=>
{
console
.
log
(
"
authV9 module
"
+
result
.
module
);
console
.
log
(
"
authV9 tip
"
+
result
.
tip
);
}
});
//start auth
authInstance
.
start
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Nopermission_API9_Func_0103 fail
"
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
201
);
}
//start auth
authInstance
.
start
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Nopermission_API9_Func_0103 fail
"
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
201
);
}
// unregister result and tip
try
{
authInstance
.
off
(
"
result
"
);
authInstance
.
off
(
"
tip
"
);
done
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Nopermission_API9_Func_0103 fail
"
+
e
.
code
);
done
();
// unregister result and tip
try
{
authInstance
.
off
(
"
result
"
);
authInstance
.
off
(
"
tip
"
);
done
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Nopermission_API9_Func_0103 fail
"
+
e
.
code
);
done
();
}
}
})
})
...
...
useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/Security_IAM_FUNC_Jsunit.test.js
浏览文件 @
ea3298c5
...
...
@@ -28,17 +28,18 @@ export default function userauthTest() {
*/
it
(
'
Security_IAM_Func_0102
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace GetAvailabeStatusTest0102 start
'
);
let
authType
=
userAuthNorth
.
UserAuthType
.
FACE
let
authType
=
[
userAuthNorth
.
UserAuthType
.
FACE
,
userAuthNorth
.
UserAuthType
.
FINGERPRINT
]
let
level
=
[
userAuthNorth
.
AuthTrustLevel
.
ATL1
,
userAuthNorth
.
AuthTrustLevel
.
ATL2
,
userAuthNorth
.
AuthTrustLevel
.
ATL3
,
userAuthNorth
.
AuthTrustLevel
.
ATL4
]
for
(
let
idx1
=
0
;
idx1
<
level
.
length
;
idx1
++
)
{
try
{
console
.
info
(
'
GetAvailabeStatusTest0102 authtype:
'
+
authType
+
'
trustlevel:
'
+
level
[
idx1
])
userAuthNorth
.
getAvailableStatus
(
authType
,
level
[
idx1
]);
}
catch
(
e
)
{
console
.
log
(
"
GetAvailabeStatusTest0102 fail
"
+
'
authType:
'
+
authType
+
'
trustlevel:
'
+
level
[
idx1
]
+
'
e.code:
'
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
NOT_ENROLLED
);
done
();
for
(
let
idx0
=
0
;
idx0
<
authType
.
length
;
idx0
++
)
{
for
(
let
idx1
=
0
;
idx1
<
level
.
length
;
idx1
++
)
{
try
{
console
.
info
(
'
GetAvailabeStatusTest0102 authtype:
'
+
authType
[
idx0
]
+
'
trustlevel:
'
+
level
[
idx1
])
userAuthNorth
.
getAvailableStatus
(
authType
[
idx0
],
level
[
idx1
]);
}
catch
(
e
)
{
console
.
log
(
"
GetAvailabeStatusTest0102 fail
"
+
'
authType:
'
+
authType
[
idx0
]
+
'
trustlevel:
'
+
level
[
idx1
]
+
'
e.code:
'
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
NOT_ENROLLED
);
done
();
}
}
}
})
...
...
@@ -121,25 +122,27 @@ export default function userauthTest() {
it
(
'
Security_IAM_Func_0111
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace getAuthInstance start
'
);
let
challenge
=
new
Uint8Array
([
253
,
19
,
58
,
160
,
67
,
200
,
247
,
37
])
let
authType
=
userAuthNorth
.
UserAuthType
.
FACE
let
authType
=
[
userAuthNorth
.
UserAuthType
.
FACE
,
userAuthNorth
.
UserAuthType
.
FINGERPRINT
]
let
level
=
[
userAuthNorth
.
AuthTrustLevel
.
ATL1
,
userAuthNorth
.
AuthTrustLevel
.
ATL2
,
userAuthNorth
.
AuthTrustLevel
.
ATL3
,
userAuthNorth
.
AuthTrustLevel
.
ATL4
]
var
authInstance
for
(
let
idx2
=
0
;
idx2
<
level
.
length
;
idx2
++
)
{
try
{
console
.
info
(
'
getAuthInstance authtype:
'
+
authType
+
'
trustlevel:
'
+
level
[
idx2
])
authInstance
=
userAuthNorth
.
getAuthInstance
(
challenge
,
authType
,
level
[
idx2
]);
authInstance
.
on
(
"
result
"
,
{
callback
:
(
result
)
=>
{
console
.
log
(
"
authV9 result
"
+
result
.
result
);
expect
(
result
.
result
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
NOT_ENROLLED
);
}
});
//start auth
authInstance
.
start
();
}
catch
(
e
)
{
console
.
log
(
"
getAuthInstance/start fail
"
+
e
.
code
+
'
authType:
'
+
authType
+
'
trustlevel:
'
+
level
[
idx2
]
+
'
e.code:
'
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
NOT_ENROLLED
);
for
(
let
idx1
=
0
;
idx1
<
authType
.
length
;
idx1
++
)
{
for
(
let
idx2
=
0
;
idx2
<
level
.
length
;
idx2
++
)
{
try
{
console
.
info
(
'
getAuthInstance authtype:
'
+
authType
[
idx1
]
+
'
trustlevel:
'
+
level
[
idx2
])
authInstance
=
userAuthNorth
.
getAuthInstance
(
challenge
,
authType
[
idx1
],
level
[
idx2
]);
authInstance
.
on
(
"
result
"
,
{
callback
:
(
result
)
=>
{
console
.
log
(
"
authV9 result
"
+
result
.
result
);
expect
(
result
.
result
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
NOT_ENROLLED
);
}
});
//start auth
authInstance
.
start
();
}
catch
(
e
)
{
console
.
log
(
"
getAuthInstance/start fail
"
+
e
.
code
+
'
authType:
'
+
authType
[
idx1
]
+
'
trustlevel:
'
+
level
[
idx2
]
+
'
e.code:
'
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
NOT_ENROLLED
);
}
}
}
done
()
...
...
@@ -355,52 +358,45 @@ export default function userauthTest() {
*/
it
(
'
Security_IAM_Func_0103
'
,
0
,
async
function
(
done
)
{
let
challenge
=
new
Uint8Array
([
253
,
19
,
58
,
160
,
67
,
200
,
247
,
37
])
let
authType
=
userAuthNorth
.
UserAuthType
.
FACE
;
let
authType
=
[
userAuthNorth
.
UserAuthType
.
FACE
,
userAuthNorth
.
UserAuthType
.
FINGERPRINT
]
;
let
authTrustLevel
=
userAuthNorth
.
AuthTrustLevel
.
ATL1
;
for
(
let
idx0
=
0
;
idx0
<
authType
.
length
;
idx0
++
)
{
try
{
var
authInstance
=
userAuthNorth
.
getAuthInstance
(
challenge
,
authType
[
idx0
],
authTrustLevel
);
// register result and tip
authInstance
.
on
(
"
result
"
,
{
callback
:
(
result
)
=>
{
console
.
log
(
"
authV9 result
"
+
result
.
result
);
console
.
log
(
"
authV9 token
"
+
result
.
token
);
console
.
log
(
"
authV9 remainAttempts
"
+
result
.
remainAttempts
);
console
.
log
(
"
authV9 lockoutDuration
"
+
result
.
lockoutDuration
);
expect
(
result
.
result
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
NOT_ENROLLED
);
}
});
try
{
var
authInstance
=
userAuthNorth
.
getAuthInstance
(
challenge
,
authType
,
authTrustLevel
);
// register result and tip
authInstance
.
on
(
"
result
"
,
{
callback
:
(
result
)
=>
{
console
.
log
(
"
authV9 result
"
+
result
.
result
);
console
.
log
(
"
authV9 token
"
+
result
.
token
);
console
.
log
(
"
authV9 remainAttempts
"
+
result
.
remainAttempts
);
console
.
log
(
"
authV9 lockoutDuration
"
+
result
.
lockoutDuration
);
expect
(
result
.
result
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
NOT_ENROLLED
);
}
});
authInstance
.
on
(
"
tip
"
,
{
callback
:
(
result
)
=>
{
console
.
log
(
"
authV9 module
"
+
result
.
module
);
console
.
log
(
"
authV9 tip
"
+
result
.
tip
);
}
});
//start auth
authInstance
.
start
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Func_0103 fail
"
+
e
);
}
authInstance
.
on
(
"
tip
"
,
{
callback
:
(
result
)
=>
{
console
.
log
(
"
authV9 module
"
+
result
.
module
);
console
.
log
(
"
authV9 tip
"
+
result
.
tip
);
}
});
// cancel auth
try
{
authInstance
.
cancel
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Func_0103 cancel fail
"
+
e
);
expect
(
e
.
code
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
GENERAL_ERROR
);
}
//start auth
authInstance
.
start
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Func_0103 fail
"
+
e
);
}
// unregister result and tip
try
{
authInstance
.
off
(
"
result
"
);
authInstance
.
off
(
"
tip
"
);
done
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Func_0103 fail
"
+
e
);
expect
(
e
.
code
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
GENERAL_ERROR
);
done
();
// unregister result and tip
try
{
authInstance
.
off
(
"
result
"
);
authInstance
.
off
(
"
tip
"
);
done
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Func_0103 fail
"
+
e
);
expect
(
e
.
code
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
GENERAL_ERROR
);
done
();
}
}
})
...
...
@@ -436,16 +432,17 @@ export default function userauthTest() {
*/
it
(
'
Security_IAM_Func_0109
'
,
0
,
async
function
(
done
)
{
let
challenge
=
new
Uint8Array
([
253
,
19
,
58
,
160
,
67
,
200
,
247
,
37
])
let
authType
=
userAuthNorth
.
UserAuthType
.
FACE
;
let
authType
=
[
userAuthNorth
.
UserAuthType
.
FACE
,
userAuthNorth
.
UserAuthType
.
FINGERPRINT
]
;
let
authTrustLevel
=
userAuthNorth
.
AuthTrustLevel
.
ATL1
;
try
{
var
authInstance
=
userAuthNorth
.
getAuthInstance
(
challenge
,
authType
,
authTrustLevel
);
authInstance
.
cancel
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Func_0109 fail
"
+
e
);
expect
(
e
.
code
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
GENERAL_ERROR
);
done
();
for
(
let
idx0
=
0
;
idx0
<
authType
.
length
;
idx0
++
)
{
try
{
var
authInstance
=
userAuthNorth
.
getAuthInstance
(
challenge
,
authType
[
idx0
],
authTrustLevel
);
authInstance
.
cancel
();
}
catch
(
e
)
{
console
.
log
(
"
Security_IAM_Func_0109 fail
"
+
e
);
expect
(
e
.
code
).
assertEqual
(
userAuthNorth
.
UserAuthResultCode
.
GENERAL_ERROR
);
done
();
}
}
})
...
...
useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/js/test/Security_IAM_PIN_Kit_CallbackJsunit.test.js
浏览文件 @
ea3298c5
...
...
@@ -50,23 +50,23 @@ export default function userauthTest() {
*/
it
(
'
Security_IAM_PIN_Kit_Func_0102
'
,
0
,
async
function
(
done
)
{
console
.
info
(
'
testFace Security_IAM_PIN_Kit_Func_0102 start
'
);
// let authType = [userAuthNorth.UserAuthType.FACE, userAuthNorth.UserAuthType.FINGERPRINT]
let
authType
=
userAuthNorth
.
UserAuthType
.
FACE
;
let
authType
=
[
userAuthNorth
.
UserAuthType
.
FACE
,
userAuthNorth
.
UserAuthType
.
FINGERPRINT
];
let
level
=
[
userAuthNorth
.
AuthTrustLevel
.
ATL1
,
userAuthNorth
.
AuthTrustLevel
.
ATL2
,
userAuthNorth
.
AuthTrustLevel
.
ATL3
,
userAuthNorth
.
AuthTrustLevel
.
ATL4
];
let
availabeStatus
;
for
(
let
idx1
=
0
;
idx1
<
level
.
length
;
idx1
++
)
{
try
{
console
.
info
(
'
Security_IAM_PIN_Kit_Func_0102 authtype:
'
+
authType
+
'
trustlevel:
'
+
level
[
idx1
])
availabeStatus
=
UserAuthKit
.
getAvailableStatus
(
authType
,
level
[
idx1
]);
console
.
info
(
`Security_IAM_PIN_Kit_Func_0102
${
availabeStatus
}
`
)
expect
(
availabeStatus
).
assertEqual
(
userAuthNorth
.
ResultCode
.
NOT_ENROLLED
);
}
catch
(
e
)
{
console
.
info
(
`Security_IAM_PIN_Kit_Func_0102 e
${
JSON
.
stringify
(
e
)}
`
)
console
.
log
(
"
Security_IAM_PIN_Kit_Func_0102 throw fail
"
+
'
authType:
'
+
authType
+
'
trustlevel:
'
+
level
[
idx1
]
+
'
e.code:
'
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
userAuthNorth
.
ResultCode
.
NOT_ENROLLED
);
for
(
let
idx0
=
0
;
idx0
<
authType
.
length
;
idx0
++
)
{
for
(
let
idx1
=
0
;
idx1
<
level
.
length
;
idx1
++
)
{
try
{
console
.
info
(
'
Security_IAM_PIN_Kit_Func_0102 authtype:
'
+
authType
[
idx0
]
+
'
trustlevel:
'
+
level
[
idx1
])
availabeStatus
=
UserAuthKit
.
getAvailableStatus
(
authType
[
idx0
],
level
[
idx1
]);
console
.
info
(
`Security_IAM_PIN_Kit_Func_0102
${
availabeStatus
}
`
)
expect
(
availabeStatus
).
assertEqual
(
userAuthNorth
.
ResultCode
.
NOT_ENROLLED
);
}
catch
(
e
)
{
console
.
info
(
`Security_IAM_PIN_Kit_Func_0102 e
${
JSON
.
stringify
(
e
)}
`
)
console
.
log
(
"
Security_IAM_PIN_Kit_Func_0102 throw fail
"
+
'
authType:
'
+
authType
[
idx0
]
+
'
trustlevel:
'
+
level
[
idx1
]
+
'
e.code:
'
+
e
.
code
);
expect
(
e
.
code
).
assertEqual
(
userAuthNorth
.
ResultCode
.
NOT_ENROLLED
);
}
done
();
}
done
();
}
})
...
...
@@ -200,6 +200,10 @@ export default function userauthTest() {
await
authPromise
(
challenge
,
2
,
20000
,
10
)
await
authPromise
(
challenge
,
2
,
30000
,
10
)
await
authPromise
(
challenge
,
2
,
40000
,
10
)
await
authPromise
(
challenge
,
4
,
10000
,
10
)
await
authPromise
(
challenge
,
4
,
20000
,
10
)
await
authPromise
(
challenge
,
4
,
30000
,
10
)
await
authPromise
(
challenge
,
4
,
40000
,
10
)
done
()
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录