Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
f68ad8d2
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
f68ad8d2
编写于
8月 27, 2022
作者:
O
openharmony_ci
提交者:
Gitee
8月 27, 2022
浏览文件
操作
浏览文件
下载
差异文件
!8767 modify account demo code
Merge pull request !8767 from jidong/dev_0826_docs
上级
7d0bc1a7
70fcbee4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
297 addition
and
401 deletion
+297
-401
zh-cn/application-dev/reference/apis/js-apis-appAccount.md
zh-cn/application-dev/reference/apis/js-apis-appAccount.md
+15
-13
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
+282
-388
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-appAccount.md
浏览文件 @
f68ad8d2
...
...
@@ -899,7 +899,7 @@ getAllAccounts(owner: string, callback: AsyncCallback<Array<AppAccountInfo
**示例:**
```
js
const
appAccountManager
=
account
.
createAppAccountManager
();
const
appAccountManager
=
account
_appAccount
.
createAppAccountManager
();
const
selfBundle
=
"
com.example.actsgetallaaccounts
"
;
appAccountManager
.
getAllAccounts
(
selfBundle
,
(
err
,
data
)
=>
{
console
.
debug
(
"
getAllAccounts err:
"
+
JSON
.
stringify
(
err
));
...
...
@@ -960,7 +960,7 @@ on(type: 'change', owners: Array<string>, callback: Callback<Array<A
**示例:**
```
js
const
appAccountManager
=
account
.
createAppAccountManager
();
const
appAccountManager
=
account
_appAccount
.
createAppAccountManager
();
function
changeOnCallback
(
data
){
console
.
debug
(
"
receive change data:
"
+
JSON
.
stringify
(
data
));
}
...
...
@@ -990,7 +990,7 @@ off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void
**示例:**
```
js
const
appAccountManager
=
account
.
createAppAccountManager
();
const
appAccountManager
=
account
_appAccount
.
createAppAccountManager
();
function
changeOnCallback
(
data
){
console
.
debug
(
"
receive change data:
"
+
JSON
.
stringify
(
data
));
appAccountManager
.
off
(
'
change
'
,
function
(){
...
...
@@ -1400,7 +1400,7 @@ getAllOAuthTokens(name: string, owner: string): Promise<Array<OAuthTokenIn
```
js
const
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
appAccountManager
.
getAllOAuthTokens
(
"
LiSi
"
,
"
com.example.ohos.accountjsdemo
"
).
then
((
data
)
=>
{
console
.
log
(
'
getAllOAuthTokens data:
'
+
JSON
.
stringify
(
data
));
console
.
log
(
'
getAllOAuthTokens data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
log
(
"
getAllOAuthTokens err:
"
+
JSON
.
stringify
(
err
));
});
...
...
@@ -1495,7 +1495,7 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<Authentic
[
account_appAccount
.
Constants
.
KEY_OWNER
]:
"
com.example.ohos.accountjsdemo
"
,
[
account_appAccount
.
Constants
.
KEY_AUTH_TYPE
]:
"
getSocialData
"
,
[
account_appAccount
.
Constants
.
KEY_TOKEN
]:
"
xxxxxx
"
};
callback
.
O
nResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
callback
.
o
nResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
});
});
```
...
...
@@ -1531,7 +1531,7 @@ getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback>
[
account_appAccount
.
Constants
.
KEY_OWNER
]:
"
com.example.ohos.accountjsdemo
"
,
[
account_appAccount
.
Constants
.
KEY_AUTH_TYPE
]:
"
getSocialData
"
,
[
account_appAccount
.
Constants
.
KEY_TOKEN
]:
"
xxxxxx
"
};
callback
.
O
nResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
callback
.
o
nResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
}).
catch
((
err
)
=>
{
console
.
log
(
"
getAuthenticatorCallback err:
"
+
JSON
.
stringify
(
err
));
});
...
...
@@ -1733,7 +1733,8 @@ checkAccountLabels(name: string, owner: string, labels: Array<string>, cal
```
js
const
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
appAccountManager
.
checkAccountLabels
(
"
zhangsan
"
,
"
com.example.ohos.accountjsdemo
"
,
(
err
,
data
)
=>
{
var
labels
=
[
"
student
"
];
appAccountManager
.
checkAccountLabels
(
"
zhangsan
"
,
"
com.example.ohos.accountjsdemo
"
,
labels
,
(
err
,
data
)
=>
{
console
.
log
(
'
checkAccountLabels:
'
+
JSON
.
stringify
(
data
));
console
.
log
(
"
checkAccountLabels err:
"
+
JSON
.
stringify
(
err
));
});
...
...
@@ -1765,7 +1766,8 @@ checkAccountLabels(name: string, owner: string, labels: Array<string>): Pr
```
js
const
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
appAccountManager
.
checkAccountLabels
(
"
zhangsan
"
,
"
com.example.ohos.accountjsdemo
"
).
then
((
data
)
=>
{
var
labels
=
[
"
student
"
];
appAccountManager
.
checkAccountLabels
(
"
zhangsan
"
,
"
com.example.ohos.accountjsdemo
"
,
labels
).
then
((
data
)
=>
{
console
.
log
(
'
checkAccountLabels:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
log
(
"
checkAccountLabels err:
"
+
JSON
.
stringify
(
err
));
...
...
@@ -2115,7 +2117,7 @@ onResult: (code: number, result: {[key: string]: any}) => void
[
account_appAccount
.
Constants
.
KEY_OWNER
]:
"
com.example.ohos.accountjsdemo
"
,
[
account_appAccount
.
Constants
.
KEY_AUTH_TYPE
]:
"
getSocialData
"
,
[
account_appAccount
.
Constants
.
KEY_TOKEN
]:
"
xxxxxx
"
};
callback
.
O
nResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
callback
.
o
nResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
}).
catch
((
err
)
=>
{
console
.
log
(
"
getAuthenticatorCallback err:
"
+
JSON
.
stringify
(
err
));
});
...
...
@@ -2168,7 +2170,7 @@ onRequestContinued?: () => void
const
appAccountManager
=
account_appAccount
.
createAppAccountManager
();
var
sessionId
=
"
1234
"
;
appAccountManager
.
getAuthenticatorCallback
(
sessionId
).
then
((
callback
)
=>
{
callback
.
O
nRequestContinued
();
callback
.
o
nRequestContinued
();
}).
catch
((
err
)
=>
{
console
.
log
(
"
getAuthenticatorCallback err:
"
+
JSON
.
stringify
(
err
));
});
...
...
@@ -2295,7 +2297,7 @@ getRemoteObject(): rpc.RemoteObject;
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
}
verifyCredential
(
name
:
string
,
options
:
VerifyCredentialOptions
,
callback
:
AuthenticatorC
allback
)
{
verifyCredential
(
name
,
options
,
c
allback
)
{
callback
.
onRequestRedirected
({
bundleName
:
"
com.example.ohos.accountjsdemo
"
,
abilityName
:
"
com.example.ohos.accountjsdemo.VerifyAbility
"
,
...
...
@@ -2305,11 +2307,11 @@ getRemoteObject(): rpc.RemoteObject;
});
}
setProperties
(
options
:
SetPropertiesOptions
,
callback
:
AuthenticatorC
allback
)
{
setProperties
(
options
,
c
allback
)
{
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
{});
}
checkAccountLabels
(
name
:
string
,
labels
:
Array
<
string
>
,
callback
:
AuthenticatorC
allback
)
{
checkAccountLabels
(
name
,
labels
,
c
allback
)
{
var
result
=
{[
account_appAccount
.
Constants
.
KEY_BOOLEAN_RESULT
]:
false
};
callback
.
onResult
(
account_appAccount
.
ResultCode
.
SUCCESS
,
result
);
}
...
...
zh-cn/application-dev/reference/apis/js-apis-osAccount.md
浏览文件 @
f68ad8d2
...
...
@@ -440,12 +440,10 @@ removeOsAccount(localId: number, callback: AsyncCallback<void>): void
```
js
const
accountManager
=
account_osAccount
.
getAccountManager
();
var
createIocalId
;
osAccountManager
.
createOsAccount
(
"
testAccountName
"
,
osaccount
.
OsAccountType
.
NORMAL
,
(
err
,
osAccountInfo
)
=>
{
createIocalId
=
osAccountInfo
.
localId
;
});
accountManager
.
removeOsAccount
(
createIocalId
,
(
err
)
=>
{
console
.
log
(
"
removeOsAccount err:
"
+
JSON
.
stringify
(
err
));
accountManager
.
createOsAccount
(
"
testAccountName
"
,
account_osAccount
.
OsAccountType
.
NORMAL
,
(
err
,
osAccountInfo
)
=>
{
accountManager
.
removeOsAccount
(
osAccountInfo
.
localId
,
(
err
)
=>
{
console
.
log
(
"
removeOsAccount err:
"
+
JSON
.
stringify
(
err
));
});
});
```
...
...
@@ -477,15 +475,12 @@ removeOsAccount(localId: number): Promise<void>
```
js
const
accountManager
=
account_osAccount
.
getAccountManager
();
var
createIocalId
;
osAccountManager
.
createOsAccount
(
"
testAccountName
"
,
osaccount
.
OsAccountType
.
NORMAL
,
(
err
,
osAccountInfo
)
=>
{
createIocalId
=
osAccountInfo
.
localId
;
});
createIocalId
=
osAccount
.
localId
;
accountManager
.
removeOsAccount
(
createIocalId
).
then
(()
=>
{
console
.
log
(
'
removeOsAccount Success
'
);
}).
catch
(()
=>
{
console
.
log
(
"
removeOsAccount err:
"
+
JSON
.
stringify
(
err
));
accountManager
.
createOsAccount
(
"
testAccountName
"
,
account_osAccount
.
OsAccountType
.
NORMAL
,
(
err
,
osAccountInfo
)
=>
{
accountManager
.
removeOsAccount
(
osAccountInfo
.
localId
).
then
(()
=>
{
console
.
log
(
'
removeOsAccount Success
'
);
}).
catch
(()
=>
{
console
.
log
(
"
removeOsAccount err:
"
+
JSON
.
stringify
(
err
));
});
});
```
...
...
@@ -1097,7 +1092,7 @@ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback&
```
js
const
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
createOsAccount
(
"
testName
"
,
osa
ccount
.
OsAccountType
.
NORMAL
,
(
err
,
osAccountInfo
)
=>
{
accountManager
.
createOsAccount
(
"
testName
"
,
account_osA
ccount
.
OsAccountType
.
NORMAL
,
(
err
,
osAccountInfo
)
=>
{
console
.
log
(
"
createOsAccount err:
"
+
JSON
.
stringify
(
err
));
console
.
log
(
"
createOsAccount osAccountInfo:
"
+
JSON
.
stringify
(
osAccountInfo
));
});
...
...
@@ -1132,7 +1127,7 @@ createOsAccount(localName: string, type: OsAccountType): Promise<OsAccountInf
```
js
const
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
createOsAccount
(
"
testAccountName
"
,
osa
ccount
.
OsAccountType
.
NORMAL
).
then
((
accountInfo
)
=>
{
accountManager
.
createOsAccount
(
"
testAccountName
"
,
account_osA
ccount
.
OsAccountType
.
NORMAL
).
then
((
accountInfo
)
=>
{
console
.
log
(
"
createOsAccount, accountInfo:
"
+
JSON
.
stringify
(
accountInfo
));
}).
catch
((
err
)
=>
{
console
.
log
(
"
createOsAccount err:
"
+
JSON
.
stringify
(
err
));
...
...
@@ -1164,7 +1159,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal
```
js
const
accountManager
=
account_osAccount
.
getAccountManager
();
var
domainInfo
=
{
domain
:
"
testDomain
"
,
accountName
:
"
testAccountName
"
};
accountManager
.
createOsAccountForDomain
(
osa
ccount
.
OsAccountType
.
NORMAL
,
domainInfo
,
(
err
,
osAccountInfo
)
=>
{
accountManager
.
createOsAccountForDomain
(
account_osA
ccount
.
OsAccountType
.
NORMAL
,
domainInfo
,
(
err
,
osAccountInfo
)
=>
{
console
.
log
(
"
createOsAccountForDomain err:
"
+
JSON
.
stringify
(
err
));
console
.
log
(
"
createOsAccountForDomain osAccountInfo:
"
+
JSON
.
stringify
(
osAccountInfo
));
});
...
...
@@ -1200,7 +1195,7 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Pr
```
js
const
accountManager
=
account_osAccount
.
getAccountManager
();
var
domainInfo
=
{
domain
:
"
testDomain
"
,
accountName
:
"
testAccountName
"
};
accountManager
.
createOsAccountForDomain
(
osa
ccount
.
OsAccountType
.
NORMAL
,
domainInfo
).
then
((
accountInfo
)
=>
{
accountManager
.
createOsAccountForDomain
(
account_osA
ccount
.
OsAccountType
.
NORMAL
,
domainInfo
).
then
((
accountInfo
)
=>
{
console
.
log
(
"
createOsAccountForDomain, account info:
"
+
JSON
.
stringify
(
accountInfo
));
}).
catch
((
err
)
=>
{
console
.
log
(
"
createOsAccountForDomain err:
"
+
JSON
.
stringify
(
err
));
...
...
@@ -1523,7 +1518,7 @@ setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback
"
Cxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAACwSURBVDhPvZLBDYMwDEV/ugsXRjAT0EHCOuFIBwkbdIRewi6unbiAyoGgSn1SFH85+Y
"
+
"
q/4ljARW62X+LHS8uIzjm4dXUYF+utzBikB52Jo5e5iEPKqpACk7R9NM2RvWm5tIkD2czLCUFNKLD6IjdMHFHDzws285MgGrT0xCtp3WOKHo
"
+
"
+7q0mP0DZW9pNmoEFUzrQjp5cCnaen2kSJXLFD8ghbXyZCMQf/8e8Ns1XVAG/XAgqKzVnJFAAAAABJRU5ErkJggg==
"
osA
ccountManager
.
setOsAccountProfilePhoto
(
localId
,
photo
,
(
err
)
=>
{
a
ccountManager
.
setOsAccountProfilePhoto
(
localId
,
photo
,
(
err
)
=>
{
console
.
log
(
"
setOsAccountProfilePhoto err:
"
+
JSON
.
stringify
(
err
));
});
```
...
...
@@ -1765,8 +1760,9 @@ getBundleIdFromUid(uid: number, callback: AsyncCallback<number>): void;
**示例:**
```
js
const
accountManager
=
account_osAccount
.
getAccountManager
();
var
testUid
=
1000000
;
osAccountManager
.
getBundleIdFromUid
(
testUid
,(
err
,
bundleId
)
=>
{
accountManager
.
getBundleIdFromUid
(
testUid
,
(
err
,
bundleId
)
=>
{
console
.
info
(
"
getBundleIdFromUid errInfo:
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
getBundleIdFromUid bundleId:
"
+
JSON
.
stringify
(
bundleId
));
});
...
...
@@ -1796,10 +1792,13 @@ getBundleIdFromUid(uid: number): Promise<number>;
**示例:**
```
js
const
accountManager
=
account_osAccount
.
getAccountManager
();
var
testUid
=
1000000
;
var
bundleIdInfo
=
await
osAccountManager
.
getBundleIdFromUid
(
testUid
).
catch
((
err
)
=>
{
console
.
info
(
"
getBundleIdFromUid errInfo:
"
+
JSON
.
stringify
(
err
));})
console
.
info
(
"
getBundleIdFromUid bundleId:
"
+
JSON
.
stringify
(
bundleIdInfo
));
accountManager
.
getBundleIdFromUid
(
testUid
).
then
((
result
)
=>
{
console
.
info
(
"
getBundleIdFromUid bundleId:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
err
)
=>
{
console
.
info
(
"
getBundleIdFromUid errInfo:
"
+
JSON
.
stringify
(
err
));
});
```
### isMainOsAccount<sup>9+</sup>
...
...
@@ -1823,7 +1822,8 @@ isMainOsAccount(callback: AsyncCallback<boolean>): void;
**示例:**
```
js
osAccountManager
.
isMainOsAccount
((
err
,
result
)
=>
{
const
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
isMainOsAccount
((
err
,
result
)
=>
{
console
.
info
(
"
isMainOsAccount errInfo:
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
isMainOsAccount result:
"
+
JSON
.
stringify
(
result
));
});
...
...
@@ -1849,10 +1849,12 @@ isMainOsAccount(): Promise<boolean>;
**示例:**
```
js
var
result
=
await
osAccountManager
.
isMainOsAccount
().
catch
((
err
)
=>
{
const
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
isMainOsAccount
().
then
((
result
)
=>
{
console
.
info
(
"
isMainOsAccount result:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
err
)
=>
{
console
.
info
(
"
isMainOsAccount errInfo:
"
+
JSON
.
stringify
(
err
));
});
console
.
info
(
"
isMainOsAccount result:
"
+
JSON
.
stringify
(
result
));
```
### queryOsAccountConstraintSourceTypes<sup>9+</sup>
...
...
@@ -1877,7 +1879,8 @@ queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callbac
**示例:**
```
js
osAccountManager
.
queryOsAccountConstraintSourceTypes
(
100
,
"
constraint.wifi
"
,(
err
,
sourceTypeInfos
)
=>
{
const
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
queryOsAccountConstraintSourceTypes
(
100
,
"
constraint.wifi
"
,(
err
,
sourceTypeInfos
)
=>
{
console
.
info
(
"
queryOsAccountConstraintSourceType errInfo:
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
queryOsAccountConstraintSourceType sourceTypeInfos:
"
+
JSON
.
stringify
(
sourceTypeInfos
));
});
...
...
@@ -1911,9 +1914,12 @@ queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promis
**示例:**
```
js
var
sourceTypeInfos
=
await
osAccountManager
.
queryOsAccountConstraintSourceTypes
(
100
,
"
constraint.wifi
"
).
catch
((
err
)
=>
{
console
.
info
(
"
queryOsAccountConstraintSourceType errInfo:
"
+
JSON
.
stringify
(
err
));})
console
.
info
(
"
queryOsAccountConstraintSourceType sourceTypeInfos:
"
+
JSON
.
stringify
(
sourceTypeInfos
));
const
accountManager
=
account_osAccount
.
getAccountManager
();
accountManager
.
queryOsAccountConstraintSourceTypes
(
100
,
"
constraint.wifi
"
).
then
((
result
)
=>
{
console
.
info
(
"
queryOsAccountConstraintSourceType sourceTypeInfos:
"
+
JSON
.
stringify
(
result
));
}).
catch
((
err
)
=>
{
console
.
info
(
"
queryOsAccountConstraintSourceType errInfo:
"
+
JSON
.
stringify
(
err
));
});
```
## UserAuth<sup>8+</sup>
...
...
@@ -1934,8 +1940,7 @@ constructor()
**示例:**
```
js
let
userAuth
=
new
osAccount
.
UserAuth
();
console
.
info
(
'
====>test for examples constructor success
'
);
let
userAuth
=
new
account_osAccount
.
UserAuth
();
```
...
...
@@ -1957,10 +1962,9 @@ getVersion(): number;
**示例:**
```
js
let
userAuth
=
new
osAccount
.
UserAuth
();
console
.
info
(
'
====>test for examples constructor success
'
);
var
version
=
userAuth
.
getVersion
();
console
.
info
(
'
====>test for examples version is :
'
+
JSON
.
stringify
(
version
));
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
version
=
userAuth
.
getVersion
();
console
.
log
(
"
getVersion version =
"
+
version
);
```
### getAvailableStatus<sup>8+</sup>
...
...
@@ -1990,12 +1994,11 @@ getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number;
**示例:**
```
js
let
userAuth
=
new
osAccount
.
UserAuth
();
let
authType
=
osAccount
.
AuthType
.
PIN
;
let
authTrustLevel
=
osAccount
.
AuthTrustLevel
.
ATL1
;
console
.
info
(
'
====>test for examples constructor success
'
);
let
availableStatus
=
userAuth
.
getAvailableStatus
(
authType
,
authTrustLevel
);
console
.
info
(
'
====>test for examples AvailabeStatus is :
'
+
JSON
.
stringify
(
availableStatus
));
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
authType
=
account_osAccount
.
AuthType
.
PIN
;
let
authTrustLevel
=
account_osAccount
.
AuthTrustLevel
.
ATL1
;
let
status
=
userAuth
.
getAvailableStatus
(
authType
,
authTrustLevel
);
console
.
log
(
"
getAvailableStatus status =
"
+
status
);
```
### getProperty<sup>8+</sup>
...
...
@@ -2019,16 +2022,20 @@ getProperty(request: GetPropertyRequest, callback: AsyncCallback<ExecutorProp
**示例:**
```
js
let
userAuth
=
new
osAccount
.
UserAuth
();
let
authType
=
osAccount
.
AuthType
.
PIN
;
let
keys
=
new
Array
();
keys
[
0
]
=
osAccount
.
GetPropertyType
.
AUTH_SUB_TYPE
;
keys
[
1
]
=
osAccount
.
GetPropertyType
.
REMAIN_TIMES
;
keys
[
2
]
=
osAccount
.
GetPropertyType
.
FREEZING_TIME
;
let
getPropertyRequest
=
{
authType
,
keys
};
userAuth
.
getProperty
(
getPropertyRequest
,
function
(
propReq
)
{
console
.
log
(
"
====>test for examples getallAuthInfo AsyncCallback =
"
+
JSON
.
stringify
(
propReq
));
})
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
keys
=
[
account_osAccount
.
GetPropertyType
.
AUTH_SUB_TYPE
,
account_osAccount
.
GetPropertyType
.
REMAIN_TIMES
,
account_osAccount
.
GetPropertyType
.
FREEZING_TIME
];
let
request
=
{
authType
:
account_osAccount
.
AuthType
.
PIN
,
keys
:
keys
};
userAuth
.
getProperty
(
request
,
(
err
,
result
)
=>
{
console
.
log
(
"
getProperty err =
"
+
JSON
.
stringify
(
err
));
console
.
log
(
"
getProperty result =
"
+
JSON
.
stringify
(
result
));
});
```
### getProperty<sup>8+</sup>
...
...
@@ -2057,15 +2064,20 @@ getProperty(request: GetPropertyRequest): Promise<ExecutorProperty>;
**示例:**
```
js
let
userAuth
=
new
osAccount
.
UserAuth
();
let
authType
=
osAccount
.
AuthType
.
PIN
;
let
keys
=
new
Array
();
keys
[
0
]
=
osAccount
.
GetPropertyType
.
AUTH_SUB_TYPE
;
keys
[
1
]
=
osAccount
.
GetPropertyType
.
REMAIN_TIMES
;
keys
[
2
]
=
osAccount
.
GetPropertyType
.
FREEZING_TIME
;
let
getPropertyRequest
=
{
authType
,
keys
};
userAuth
.
getProperty
(
getPropertyRequest
).
then
((
propReq
)
=>
{
console
.
log
(
"
====>test for examples getallAuthInfo AsyncCallback =
"
+
JSON
.
stringify
(
propReq
));
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
keys
=
[
account_osAccount
.
GetPropertyType
.
AUTH_SUB_TYPE
,
account_osAccount
.
GetPropertyType
.
REMAIN_TIMES
,
account_osAccount
.
GetPropertyType
.
FREEZING_TIME
];
let
request
=
{
authType
:
account_osAccount
.
AuthType
.
PIN
,
keys
:
keys
};
userAuth
.
getProperty
(
request
).
then
((
result
)
=>
{
console
.
log
(
"
getProperty result =
"
+
JSON
.
stringify
(
result
));
}).
catch
((
err
)
=>
{
console
.
log
(
"
getProperty error =
"
+
JSON
.
stringify
(
err
));
});
```
...
...
@@ -2090,13 +2102,15 @@ setProperty(request: SetPropertyRequest, callback: AsyncCallback<number>):
**示例:**
```
js
let
userAuth
=
new
osAccount
.
UserAuth
();
let
authType
=
osAccount
.
AuthType
.
PIN
;
let
key
=
osAccount
.
SetPropertyType
.
INIT_ALGORITHM
;
let
setInfo
=
new
Uint8Array
();
let
setPropertyRequest
=
{
authType
,
key
,
setInfo
};
userAuth
.
setProperty
(
setPropertyRequest
,
function
(
setProp
)
{
console
.
log
(
"
====>test for examples setProperty AsyncCallback =
"
+
JSON
.
stringify
(
setProp
));
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
request
=
{
authType
:
account_osAccount
.
AuthType
.
PIN
,
key
:
account_osAccount
.
SetPropertyType
.
INIT_ALGORITHM
,
setInfo
:
new
Uint8Array
([
0
])
};
userAuth
.
setProperty
(
request
,
(
err
,
result
)
=>
{
console
.
log
(
"
setProperty error =
"
+
JSON
.
stringify
(
err
));
console
.
log
(
"
setProperty result =
"
+
JSON
.
stringify
(
result
));
});
```
...
...
@@ -2126,13 +2140,16 @@ setProperty(request: SetPropertyRequest): Promise<number>;
**示例:**
```
js
let
userAuth
=
new
osAccount
.
UserAuth
();
let
authType
=
osAccount
.
AuthType
.
PIN
;
let
key
=
osAccount
.
SetPropertyType
.
INIT_ALGORITHM
;
let
setInfo
=
new
Uint8Array
();
let
setPropertyRequest
=
{
authType
,
key
,
setInfo
};
userAuth
.
setProperty
(
setPropertyRequest
).
then
((
setProp
)
=>
{
console
.
log
(
"
====>test for examples setProperty AsyncCallback =
"
+
JSON
.
stringify
(
setProp
));
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
request
=
{
authType
:
account_osAccount
.
AuthType
.
PIN
,
key
:
account_osAccount
.
SetPropertyType
.
INIT_ALGORITHM
,
setInfo
:
new
Uint8Array
([
0
])
};
userAuth
.
setProperty
(
request
).
then
((
result
)
=>
{
console
.
log
(
"
setProperty result =
"
+
JSON
.
stringify
(
result
));
}).
catch
((
err
)
=>
{
console
.
log
(
"
setProperty error =
"
+
JSON
.
stringify
(
err
));
});
```
...
...
@@ -2166,22 +2183,15 @@ auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel,
**示例:**
```
js
let
userAuth
=
new
osAccount
.
UserAuth
();
let
authType
=
osAccount
.
AuthType
.
PIN
;
let
challenge
=
1
;
let
authTrustLevel
=
osAccount
.
AuthTrustLevel
.
ATL1
;
let
onresult
=
{
authresult
:
null
,
authextr
:
null
,
}
userAuth
.
auth
(
challenge
,
authType
,
authTrustLevel
,{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
====>test for examples auth result =
"
+
result
);
onresult
.
authresult
=
result
;
console
.
log
(
"
====>test for examples auth extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
onresult
.
authextr
=
extraInfo
;
console
.
info
(
'
====>test for examples auth onResult =
'
+
JSON
.
stringify
(
onresult
));
}
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
challenge
=
new
Uint8Array
([
0
]);
let
authType
=
account_osAccount
.
AuthType
.
PIN
;
let
authTrustLevel
=
account_osAccount
.
AuthTrustLevel
.
ATL1
;
userAuth
.
auth
(
challenge
,
authType
,
authTrustLevel
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
auth result =
"
+
result
);
console
.
log
(
"
auth extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
}
});
```
...
...
@@ -2216,23 +2226,16 @@ authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLev
**示例:**
```
js
let
userAuth
=
new
osAccount
.
UserAuth
();
let
authType
=
osAccount
.
AuthType
.
PIN
;
let
challenge
=
1
;
let
authTrustLevel
=
osAccount
.
AuthTrustLevel
.
ATL1
;
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
userID
=
100
;
let
onresult
=
{
authresult
:
null
,
authextr
:
null
,
}
let
challenge
=
new
Uint8Array
([
0
]);
let
authType
=
account_osAccount
.
AuthType
.
PIN
;
let
authTrustLevel
=
account_osAccount
.
AuthTrustLevel
.
ATL1
;
userAuth
.
authUser
(
userID
,
challenge
,
authType
,
authTrustLevel
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
====>test for examples authUser result =
"
+
result
);
onresult
.
authresult
=
result
;
console
.
log
(
"
====>test for examples authUser extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
onresult
.
authextr
=
extraInfo
;
console
.
info
(
'
====>test for examples authUser onResult =
'
+
JSON
.
stringify
(
onresult
));
}
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
authUser result =
"
+
result
);
console
.
log
(
"
authUser extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
}
});
```
...
...
@@ -2262,11 +2265,17 @@ cancelAuth(contextID: Uint8Array): number;
**示例:**
```
js
let
userAuth
=
new
osAccount
.
UserAuth
();
let
contextID
=
null
;
let
cancelAuthresult
=
null
;
cancelAuthresult
=
userAuth
.
cancelAuth
(
contextID
);
console
.
log
(
"
====>test for examples cancelAuthresult result =
"
+
JSON
.
stringify
(
cancelAuthresult
));
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
pinAuth
=
new
account_osAccount
.
PINAuth
();
let
challenge
=
new
Uint8Array
([
0
]);
let
contextID
=
userAuth
.
auth
(
challenge
,
account_osAccount
.
AuthType
.
PIN
,
account_osAccount
.
AuthTrustLevel
.
ATL1
,
{
onResult
:
(
result
,
extraInfo
)
=>
{
console
.
log
(
"
auth result =
"
+
result
);
console
.
log
(
"
auth extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
}
});
let
result
=
userAuth
.
cancelAuth
(
contextID
);
console
.
log
(
"
cancelAuth result =
"
+
result
);
```
## PINAuth<sup>8+</sup>
...
...
@@ -2287,8 +2296,7 @@ constructor()
**示例:**
```
js
var
pinAuth
=
new
osAccount
.
PINAuth
();
console
.
info
(
'
====>test for examples constructor success
'
);
let
pinAuth
=
new
account_osAccount
.
PINAuth
();
```
### registerInputer
...
...
@@ -2317,20 +2325,14 @@ registerInputer(inputer: IInputer): boolean;
**示例:**
```
js
var
pinAuth
=
new
osAccount
.
PINAuth
();
var
GetAuthSubType
=
0
;
var
AuthSubType
=
osAccount
.
AuthSubType
.
PIN_SIX
;
var
Inputerdata
=
[
0
,
1
,
3
];
var
registerresult
=
pinAuth
.
registerInputer
({
onGetData
:
(
GetAuthSubType
,
IInputData
)
=>
{
if
(
GetAuthSubType
==
0
)
{
IInputData
.
onSetData
(
AuthSubType
,
Inputerdata
)
}
else
{
IInputData
.
onSetData
(
GetAuthSubType
,
Inputerdata
);
}
let
pinAuth
=
new
account_osAccount
.
PINAuth
();
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
];
let
result
=
pinAuth
.
registerInputer
({
onGetData
:
(
pinSubType
,
callback
)
=>
{
callback
.
onSetData
(
pinSubType
,
password
);
}
})
console
.
log
(
"
====>test for examples RegisterInputer result is:
"
+
register
result
);
})
;
console
.
log
(
"
registerInputer result =
"
+
result
);
```
### unregisterInputer
...
...
@@ -2347,7 +2349,7 @@ unregisterInputer(): void;
**示例:**
```
js
var
pinAuth
=
new
osAccount
.
Pin
Auth
();
let
pinAuth
=
new
account_osAccount
.
PIN
Auth
();
pinAuth
.
unregisterInputer
();
```
...
...
@@ -2369,8 +2371,7 @@ constructor()
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
console
.
info
(
'
====>test for examples constructor success
'
);
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
```
### openSession<sup>8+</sup>
...
...
@@ -2393,19 +2394,10 @@ openSession(callback: AsyncCallback<Uint8Array>): void;
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
var
challenge
;
userIDM
.
openSession
(
function
(
err
,
data
){
try
{
console
.
log
(
"
====>test for examples before get challenge
"
);
console
.
log
(
"
====>test for examples +
"
+
data
);
challenge
=
data
;
console
.
log
(
"
====>test for examples end
"
);
console
.
log
(
"
====>test for examples after get challenge
"
);
}
catch
(
e
)
{
console
.
info
(
'
====>test for examples openSession error =
'
+
JSON
.
stringify
(
e
));
}
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
userIDM
.
openSession
((
err
,
challenge
)
=>
{
console
.
log
(
"
openSession error =
"
+
JSON
.
stringify
(
err
));
console
.
log
(
"
openSession challenge =
"
+
JSON
.
stringify
(
challenge
));
});
```
...
...
@@ -2429,23 +2421,12 @@ openSession(): Promise<Uint8Array>;
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
var
challenge
;
userIDM
.
openSession
().
then
((
data
)
=>
{
try
{
console
.
log
(
"
====>test for examples before get challenge
"
);
console
.
log
(
"
====>test for examples +
"
+
data
);
challenge
=
data
;
console
.
log
(
"
====>test for examples end
"
);
console
.
log
(
"
====>test for examples after get challenge
"
);
}
catch
(
err
)
{
console
.
info
(
'
====>test for examples faceDemo openSession error1 =
'
+
JSON
.
stringify
(
err
));
}
})
.
catch
((
err
)
=>
{
console
.
info
(
'
====>test for examples faceDemo openSession error2 =
'
+
JSON
.
stringify
(
err
));
})
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
userIDM
.
openSession
().
then
((
challenge
)
=>
{
console
.
info
(
"
openSession challenge =
"
+
JSON
.
stringify
(
challenge
));
}).
catch
((
err
)
=>
{
console
.
info
(
"
openSession error =
"
+
JSON
.
stringify
(
err
));
});
```
### addCredential<sup>8+</sup>
...
...
@@ -2469,26 +2450,27 @@ addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
(
);
let
CredentialInfo
=
null
;
let
onresult
=
{
addCredresult
:
null
,
c
redentialId
:
null
,
}
userIDM
.
addCredential
(
CredentialInfo
,
{
onResult
:
function
(
result
,
extraInfo
)
{
console
.
info
(
'
====>test for examples aaaaaaaaaaaaa
'
);
console
.
info
(
"
====>test for examples addCredential result =
"
+
result
);
console
.
info
(
"
====>test for examples addCredential extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
console
.
log
(
result
)
onresult
.
addCredresult
=
result
;
if
(
extraInfo
!=
undefined
)
{
onresult
.
credentialId
=
extraInfo
.
credentialId
}
else
{
onresult
.
credentialId
=
null
;
}
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]
);
let
pinAuth
=
new
account_osAccount
.
PINAuth
()
;
pinAuth
.
registerInputer
(
{
onGetData
:
(
pinSubType
,
callback
)
=>
{
c
allback
.
onSetData
(
pinSubType
,
password
);
}
});
let
credentialInfo
=
{
credType
:
account_osAccount
.
AuthType
.
PIN
,
credSubType
:
account_osAccount
.
AuthSubType
.
PIN_SIX
,
token
:
null
};
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
()
;
userIDM
.
openSession
((
err
,
challenge
)
=>
{
userIDM
.
addCredential
(
credentialInfo
,
{
onResult
:
(
result
,
extraInfo
)
=>
{
console
.
log
(
"
updateCredential result =
"
+
result
)
;
console
.
log
(
"
updateCredential extraInfo =
"
+
extraInfo
);
}
})
});
});
```
### updateCredential<sup>8+</sup>
...
...
@@ -2512,25 +2494,36 @@ updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
let
CredentialInfo
=
null
;
let
onresult
=
{
addCredresult
:
null
,
credentialId
:
null
,
}
userIDM
.
updateCredential
(
CredentialInfo
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
====>test for examples faceDemo updateCredential result =
"
+
result
)
onresult
.
updateCredresult
=
result
console
.
log
(
"
====>test for examples faceDemo updateCredential credentialId =
"
+
extraInfo
.
credentialId
)
if
(
extraInfo
!=
undefined
)
{
onresult
.
CredentialId
=
extraInfo
.
credentialId
}
else
{
onresult
.
CredentialId
=
null
;
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
let
userAuth
=
new
account_osAccount
.
UserAuth
();
let
pinAuth
=
new
account_osAccount
.
PINAuth
();
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
credentialInfo
=
{
credType
:
account_osAccount
.
AuthType
.
PIN
,
credSubType
:
account_osAccount
.
AuthSubType
.
PIN_SIX
,
token
:
null
};
pinAuth
.
registerInputer
({
onGetData
:
(
pinSubType
,
callback
)
=>
{
callback
.
onSetData
(
pinSubType
,
password
);
}
});
userIDM
.
openSession
((
err
,
challenge
)
=>
{
userAuth
.
auth
(
challenge
,
credentialInfo
.
credType
,
account_osAccount
.
AuthTrustLevel
.
ATL_1
,
{
onResult
:
(
result
,
extraInfo
)
=>
{
if
(
result
!=
account_osAccount
.
ResultCode
.
SUCCESS
)
{
return
;
}
credentialInfo
.
token
=
extraInfo
.
token
;
userIDM
.
updateCredential
(
credentialInfo
,
{
onResult
:
(
result
,
extraInfo
)
=>
{
console
.
log
(
"
updateCredential result =
"
+
result
);
console
.
log
(
"
updateCredential extraInfo =
"
+
extraInfo
);
}
console
.
info
(
'
====>test for examples publicupdateCred updateCredential onResult =
'
+
JSON
.
stringify
(
onresult
)
);
}
);
}
})
});
});
```
### closeSession<sup>8+</sup>
...
...
@@ -2547,7 +2540,7 @@ closeSession(): void;
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
let
userIDM
=
new
account_
osAccount
.
UserIdentityManager
();
userIDM
.
closeSession
();
```
...
...
@@ -2577,7 +2570,7 @@ cancel(challenge: Uint8Array): number;
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
let
userIDM
=
new
account_
osAccount
.
UserIdentityManager
();
let
challenge
=
1
;
let
cancelresult
=
userIDM
.
cancel
(
challenge
);
```
...
...
@@ -2603,24 +2596,14 @@ delUser(token: Uint8Array, callback: IIdmCallback): void;
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
let
onresult
=
{
delUserresult
:
null
,
CredentialId
:
null
,
}
let
token
=
null
;
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
let
token
=
new
Uint8Array
([
0
]);
userIDM
.
delUser
(
token
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
====>test for examples delUser result =
"
+
result
)
onresult
.
delUserresult
=
result
if
(
extraInfo
!=
undefined
)
{
onresult
.
CredentialId
=
extraInfo
.
credentialId
}
else
{
onresult
.
CredentialId
=
null
;
}
console
.
info
(
'
====>test for examples publicdelUser delUser =
'
+
JSON
.
stringify
(
onresult
));
}
})
onResult
:
(
result
,
extraInfo
)
=>
{
console
.
log
(
"
delUser result =
"
+
result
);
console
.
log
(
"
delUser extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
}
});
```
### delCred<sup>8+</sup>
...
...
@@ -2645,26 +2628,15 @@ delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): vo
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
let
onresult
=
{
delUserresult
:
null
,
CredentialId
:
null
,
}
let
credentialId
=
1
;
let
token
=
null
;
userIDM
.
delCred
(
credentialId
,
token
,{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
====>test for examples delCred result =
"
+
result
)
onresult
.
delCredresult
=
result
console
.
log
(
"
====>test for examples delCred extraInfo =
"
+
extraInfo
)
if
(
extraInfo
!=
undefined
)
{
onresult
.
CredentialId
=
extraInfo
.
credentialId
}
else
{
onresult
.
CredentialId
=
null
;
}
console
.
log
(
"
====>test for examples delCred onresult =
"
+
JSON
.
stringify
(
onresult
));
}
})
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
let
credentialId
=
new
Uint8Array
([
0
]);
let
token
=
new
Uint8Array
([
0
]);
userIDM
.
delCred
(
credentialId
,
token
,
{
onResult
:
(
result
,
extraInfo
)
=>
{
console
.
log
(
"
delCred result =
"
+
result
);
console
.
log
(
"
delCred extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
}
});
```
### getAuthInfo<sup>8+</sup>
...
...
@@ -2688,11 +2660,11 @@ getAuthInfo(callback: AsyncCallback<Array<EnrolledCredInfo>>): void;
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
var
authType
=
osAccount
.
AuthType
.
PIN
;
userIDM
.
getAuthInfo
(
function
(
authInfo
)
{
console
.
log
(
"
====>test for examples getAuthInfo AsyncCallback =
"
+
JSON
.
stringify
(
authInfo
))
})
let
userIDM
=
new
account_
osAccount
.
UserIdentityManager
();
userIDM
.
getAuthInfo
((
err
,
result
)
=>
{
console
.
log
(
"
getAuthInfo err =
"
+
JSON
.
stringify
(
err
));
console
.
log
(
"
getAuthInfo result =
"
+
JSON
.
stringify
(
result
));
})
;
```
### getAuthInfo<sup>8+</sup>
...
...
@@ -2716,11 +2688,11 @@ getAuthInfo(authType: AuthType, callback: AsyncCallback<Array<EnrolledCred
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
var
authType
=
osAccount
.
AuthType
.
PIN
;
userIDM
.
getAuthInfo
(
authType
,
function
(
authInfo
)
{
console
.
log
(
"
====>test for examples getAuthInfo AsyncCallback =
"
+
JSON
.
stringify
(
authInfo
))
})
let
userIDM
=
new
account_
osAccount
.
UserIdentityManager
();
userIDM
.
getAuthInfo
(
account_osAccount
.
AuthType
.
PIN
,
(
err
,
result
)
=>
{
console
.
log
(
"
getAuthInfo err =
"
+
JSON
.
stringify
(
err
));
console
.
log
(
"
getAuthInfo result =
"
+
JSON
.
stringify
(
result
));
})
;
```
### getAuthInfo<sup>8+</sup>
...
...
@@ -2749,11 +2721,12 @@ getAuthInfo(authType?: AuthType): Promise<Array<EnrolledCredInfo>>;
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
var
authType
=
osAccount
.
AuthType
.
PIN
;
userIDM
.
getAuthInfo
(
authType
).
then
((
authInfo
)
=>
{
console
.
log
(
"
====>test for examples getAuthInfo AsyncCallback =
"
+
JSON
.
stringify
(
authInfo
))
})
let
userIDM
=
new
account_osAccount
.
UserIdentityManager
();
userIDM
.
getAuthInfo
(
account_osAccount
.
AuthType
.
PIN
).
then
((
result
)
=>
{
console
.
log
(
"
getAuthInfo result =
"
+
JSON
.
stringify
(
result
))
}).
catch
((
err
)
=>
{
console
.
log
(
"
getAuthInfo error =
"
+
JSON
.
stringify
(
err
));
});
```
## IInputData<sup>8+</sup>
...
...
@@ -2781,26 +2754,17 @@ onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void;
**示例:**
```
js
console
.
log
(
"
====>test for examples onCreate start
"
);
var
pinAuth
=
new
osAccount
.
PINAuth
();
var
GetAuthSubType
=
0
;
var
AuthSubType
=
osAccount
.
AuthSubType
.
PIN_SIX
;
console
.
log
(
"
====>test for examples GetAuthSubType
"
+
GetAuthSubType
);
console
.
log
(
"
====>test for examples AuthSubType
"
+
AuthSubType
);
var
Inputerdata
=
[
0
,
1
,
3
];
var
registerresult
=
pinAuth
.
registerInputer
({
onGetData
:
(
GetAuthSubType
,
IInputData
)
=>
{
console
.
log
(
"
====>test for examples by GetAuthSubType
"
+
GetAuthSubType
);
if
(
GetAuthSubType
==
0
)
{
console
.
log
(
"
====>test for examples GetAuthSubType == 0
"
);
IInputData
.
onSetData
(
AuthSubType
,
Inputerdata
)
}
else
{
console
.
log
(
"
====>test for examples GetAuthSubType == 1
"
);
IInputData
.
onSetData
(
GetAuthSubType
,
Inputerdata
);
}
}
})
console
.
log
(
"
====>test for examples RegisterInputer result is:
"
+
registerresult
);
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
passwordNumber
=
new
Uint8Array
([
1
,
2
,
3
,
4
]);
let
inputer
=
{
onGetData
:
(
pinSubType
,
callback
)
=>
{
if
(
pinSubType
==
account_osAccount
.
AuthSubType
.
PIN_NUMBER
)
{
callback
.
onSetData
(
pinSubType
,
passwordNumber
);
}
else
{
callback
.
onSetData
(
pinSubType
,
password
);
}
}
};
```
## IInputer<sup>8+</sup>
...
...
@@ -2827,26 +2791,20 @@ onGetData: (pinSubType: AuthSubType, callback: IInputData) => void;
**示例:**
```
js
console
.
log
(
"
====>test for examples onCreate start
"
);
var
pinAuth
=
new
osAccount
.
PINAuth
();
var
GetAuthSubType
=
0
;
var
AuthSubType
=
osAccount
.
AuthSubType
.
PIN_SIX
;
console
.
log
(
"
====>test for examples GetAuthSubType
"
+
GetAuthSubType
);
console
.
log
(
"
====>test for examples AuthSubType
"
+
AuthSubType
);
var
Inputerdata
=
[
0
,
1
,
3
];
var
registerresult
=
pinAuth
.
registerInputer
({
onGetData
:
(
GetAuthSubType
,
IInputData
)
=>
{
console
.
log
(
"
====>test for examples by GetAuthSubType
"
+
GetAuthSubType
);
if
(
GetAuthSubType
==
0
)
{
console
.
log
(
"
====>test for examples GetAuthSubType == 0
"
);
IInputData
.
onSetData
(
AuthSubType
,
Inputerdata
)
}
else
{
console
.
log
(
"
====>test for examples GetAuthSubType == 1
"
);
IInputData
.
onSetData
(
GetAuthSubType
,
Inputerdata
);
}
}
})
console
.
log
(
"
====>test for examples RegisterInputer result is:
"
+
registerresult
);
let
password
=
new
Uint8Array
([
0
,
0
,
0
,
0
,
0
,
0
]);
let
passwordNumber
=
new
Uint8Array
([
1
,
2
,
3
,
4
]);
let
inputer
=
{
onGetData
:
(
pinSubType
,
callback
)
=>
{
if
(
pinSubType
==
account_osAccount
.
AuthSubType
.
PIN_NUMBER
)
{
callback
.
onSetData
(
pinSubType
,
passwordNumber
);
}
else
{
callback
.
onSetData
(
pinSubType
,
password
);
}
}
};
let
pinAuth
=
new
account_osAccount
.
PINAuth
();
let
result
=
pinAuth
.
registerInputer
(
inputer
);
console
.
log
(
"
registerInputer result:
"
+
result
);
```
## IUserAuthCallback<sup>8+</sup>
...
...
@@ -2874,23 +2832,12 @@ onResult: (result: number, extraInfo: AuthResult) => void;
**示例:**
```
js
let
userAuth
=
new
osAccount
.
UserAuth
();
let
authType
=
osAccount
.
AuthType
.
PIN
;
let
challenge
=
1
;
let
authTrustLevel
=
osAccount
.
AuthTrustLevel
.
ATL1
;
let
onresult
=
{
authresult
:
null
,
authextr
:
null
,
}
userAuth
.
auth
(
challenge
,
authType
,
authTrustLevel
,{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
====>test for examples auth result =
"
+
result
);
onresult
.
authresult
=
result
;
console
.
log
(
"
====>test for examples auth extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
onresult
.
authextr
=
extraInfo
;
console
.
info
(
'
====>test for examples auth onResult =
'
+
JSON
.
stringify
(
onresult
));
}
});
let
authCallback
=
{
onResult
:
(
result
,
extraInfo
)
=>
{
console
.
log
(
"
auth result =
"
+
result
);
console
.
log
(
"
auth extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
}
};
```
### onAcquireInfo?<sup>8+</sup>
...
...
@@ -2913,36 +2860,17 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
**示例:**
```
js
let
userAuth
=
new
osAccount
.
UserAuth
();
let
authType
=
osAccount
.
AuthType
.
PIN
;
let
challenge
=
1
;
let
authTrustLevel
=
osAccount
.
AuthTrustLevel
.
ATL1
;
let
onresult
=
{
authresult
:
null
,
authextr
:
null
,
}
let
onacquireinfo
=
{
authmodule
:
null
,
authacquire
:
null
,
authextr
:
null
}
userAuth
.
auth
(
challenge
,
authType
,
authTrustLevel
,{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
====>test for examples auth result =
"
+
result
)
onresult
.
authresult
=
result
console
.
log
(
"
====>test for examples auth extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
onresult
.
authextr
=
extraInfo
;
console
.
info
(
'
====>test for examples auth onResult =
'
+
JSON
.
stringify
(
onresult
));
},
onAcquireInfo
:
function
(
modulea
,
acquire
,
extr
){
console
.
info
(
'
====>test for examples publicauth auth onAcquireInfo in
'
);
onacquireinfo
.
authmodule
=
modulea
;
onacquireinfo
.
authacquire
=
acquire
;
onacquireinfo
.
authextr
=
extr
;
console
.
log
(
"
====>test for examples auth module =
"
+
JSON
.
stringify
(
modulea
));
console
.
info
(
'
====>test for examples publicauth auth onAcquireInfo =
'
+
JSON
.
stringify
(
onacquireinfo
));
}
});
let
authCallback
=
{
onResult
:
(
result
,
extraInfo
)
=>
{
console
.
log
(
"
auth result =
"
+
result
)
console
.
log
(
"
auth extraInfo =
"
+
JSON
.
stringify
(
extraInfo
));
},
onAcquireInfo
:
(
module
,
acquire
,
extraInfo
)
=>
{
console
.
log
(
"
auth module =
"
+
module
);
console
.
log
(
"
auth acquire =
"
+
acquire
);
console
.
info
(
'
auth extraInfo =
'
+
JSON
.
stringify
(
extraInfo
));
}
};
```
## IIdmCallback<sup>8+</sup>
...
...
@@ -2970,25 +2898,12 @@ onResult: (result: number, extraInfo: RequestResult) => void;
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
let
CredentialInfo
=
null
;
let
onresult
=
{
addCredresult
:
null
,
credentialId
:
null
,
}
userIDM
.
updateCredential
(
CredentialInfo
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
====>test for examples updateCredential result =
"
+
result
)
onresult
.
updateCredresult
=
result
console
.
log
(
"
====>test for examples updateCredential credentialId =
"
+
extraInfo
.
credentialId
)
if
(
extraInfo
!=
undefined
)
{
onresult
.
CredentialId
=
extraInfo
.
credentialId
}
else
{
onresult
.
CredentialId
=
null
;
}
console
.
info
(
'
====>test for examples publicupdateCred updateCredential onResult =
'
+
JSON
.
stringify
(
onresult
));
}
})
var
idmCallback
=
{
onResult
:
(
result
,
extraInfo
)
=>
{
console
.
log
(
"
callback result =
"
+
result
)
console
.
info
(
'
callback extraInfo =
'
+
JSON
.
stringify
(
extraInfo
));
}
};
```
### onAcquireInfo?<sup>8+</sup>
...
...
@@ -3011,38 +2926,17 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
**示例:**
```
js
var
userIDM
=
new
osAccount
.
UserIdentityManager
();
let
CredentialInfo
=
null
;
let
onresult
=
{
addCredresult
:
null
,
credentialId
:
null
,
}
let
onacquireinfo
=
{
updateCredmodule
:
null
,
updateCredacquire
:
null
,
updateCredextr
:
null
}
userIDM
.
updateCredential
(
CredentialInfo
,
{
onResult
:
function
(
result
,
extraInfo
){
console
.
log
(
"
====>test for examples updateCredential result =
"
+
result
)
onresult
.
updateCredresult
=
result
console
.
log
(
"
====>test for examples updateCredential credentialId =
"
+
extraInfo
.
credentialId
)
if
(
extraInfo
!=
undefined
)
{
onresult
.
CredentialId
=
extraInfo
.
credentialId
}
else
{
onresult
.
CredentialId
=
null
;
}
console
.
info
(
'
====>test for examples publicupdateCred updateCredential onResult =
'
+
JSON
.
stringify
(
onresult
));
},
onAcquireInfo
:
function
(
modulea
,
acquire
,
extr
){
console
.
info
(
'
====>test for examples publicupdateCred updateCredential onAcquireInfo in
'
);
onacquireinfo
.
updateCredmodule
=
modulea
onacquireinfo
.
updateCredacquire
=
acquire
onacquireinfo
.
updateCredextr
=
extr
console
.
info
(
'
====>test for examples updateCredential onacquireinfo =
'
+
JSON
.
stringify
(
onacquireinfo
));
console
.
log
(
"
====>test for examples updateCredential module =
"
+
modulea
)
}
})
let
idmCallback
=
{
onResult
:
(
result
,
extraInfo
)
=>
{
console
.
log
(
"
callback result =
"
+
result
)
console
.
log
(
"
callback onResult =
"
+
JSON
.
stringify
(
extraInfo
));
},
onAcquireInfo
:
(
module
,
acquire
,
extraInfo
)
=>
{
console
.
log
(
"
callback module =
"
+
module
);
console
.
log
(
"
callback acquire =
"
+
acquire
);
console
.
log
(
'
callback onacquireinfo =
'
+
JSON
.
stringify
(
extraInfo
));
}
};
```
## GetPropertyRequest<sup>8+</sup>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录