当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
46 Star 180 Fork 4.8K

OpenHarmony/interface_sdk-js
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.userIAM.userAuth.d.ts 74.59 KB
一键复制 编辑 原始数据 按行查看 历史
李蜜 提交于 30天前 . 静态化需求
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427
/*
* Copyright (c) 2023-2025 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.
*/
/**
* @file
* @kit UserAuthenticationKit
*/
/*** if arkts 1.1 */
import type { AsyncCallback } from './@ohos.base';
/*** endif */
/*** if arkts 1.2 */
import Context from './application/Context';
/*** endif */
/**
* User authentication
*
* @namespace userAuth
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
*/
/**
* The userAuth module provides APIs for user authentication, which applies to scenarios such as device unlocking,
* payment, and application login.
*
* @namespace userAuth
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
declare namespace userAuth {
/**
* Maximum reuse duration of the authentication result, in milliseconds. The value is 300000.
*
* @constant
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since 12
*/
const MAX_ALLOWABLE_REUSE_DURATION: 300000;
/**
* Maximum reuse duration of the authentication result, in milliseconds. The value is 300000.
*
* @constant
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 22
* @arkts 1.2
*/
const MAX_ALLOWABLE_REUSE_DURATION: int = 300000;
/**
* Enum for authentication result.
*
* @enum { number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
* @useinstead ohos.userIAM.userAuth.ResultCode
*/
export enum AuthenticationResult {
/**
* Indicates that the device does not support authentication.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
NO_SUPPORT = -1,
/**
* Indicates that authentication is success.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
SUCCESS = 0,
/**
* Indicates the authenticator fails to identify user.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
COMPARE_FAILURE = 1,
/**
* Indicates that authentication has been canceled.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
CANCELED = 2,
/**
* Indicates that authentication has timed out.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
TIMEOUT = 3,
/**
* Indicates a failure to open the camera.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
CAMERA_FAIL = 4,
/**
* Indicates that the authentication task is busy. Wait for a few seconds and try again.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
BUSY = 5,
/**
* Indicates incorrect parameters.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
INVALID_PARAMETERS = 6,
/**
* Indicates that the authenticator is locked.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
LOCKED = 7,
/**
* Indicates that the user has not enrolled the authenticator.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
NOT_ENROLLED = 8,
/**
* Indicates other errors.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
GENERAL_ERROR = 100
}
/**
* Auth types
*
* @typedef { 'ALL' | 'FACE_ONLY' }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
type AuthType = 'ALL' | 'FACE_ONLY';
/**
* Secure levels
*
* @typedef { 'S1' | 'S2' | 'S3' | 'S4' }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
type SecureLevel = 'S1' | 'S2' | 'S3' | 'S4';
/**
* Used to initiate authentication.
*
* @interface Authenticator
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
interface Authenticator {
/**
* Execute authentication.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @param { AuthType } type - Indicates the authentication type.
* @param { SecureLevel } level - Indicates the security level.
* @param { AsyncCallback<number> } callback - Async callback of execute.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
execute(type: AuthType, level: SecureLevel, callback: AsyncCallback<number>): void;
/**
* Execute authentication.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @param { AuthType } type - Indicates the authentication type.
* @param { SecureLevel } level - Indicates the security level.
* @returns { Promise<number> }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
execute(type: AuthType, level: SecureLevel): Promise<number>;
}
/**
* Get Authenticator instance.
*
* @returns { Authenticator } Returns an Authenticator.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 6
* @deprecated since 8
*/
function getAuthenticator(): Authenticator;
/**
* User authentication.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.userIAM.userAuth.AuthInstance
*/
class UserAuth {
/**
* Constructor to get the UserAuth class instance.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.userIAM.userAuth.getAuthInstance
*/
constructor();
/**
* Get version information.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @returns { number } Returns version information.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.userIAM.userAuth.getVersion
*/
getVersion(): number;
/**
* Check whether the authentication capability is available.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @param { UserAuthType } authType - Credential type for authentication.
* @param { AuthTrustLevel } authTrustLevel - Trust level of authentication result.
* @returns { number } Returns a check result, which is specified by getAvailableStatus, the value of number is related to the ResultCode enum, **201** is
* check permission failed.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.userIAM.userAuth.getAvailableStatus
*/
getAvailableStatus(authType: UserAuthType, authTrustLevel: AuthTrustLevel): number;
/**
* Executes authentication.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @param { Uint8Array } challenge - Pass in challenge value.
* @param { UserAuthType } authType - Type of authentication.
* @param { AuthTrustLevel } authTrustLevel - Trust level of authentication result.
* @param { IUserAuthCallback } callback - Return result and acquireInfo through callback, the value of result code is related to the ResultCode enum,
* **201** is check permission failed.
* @returns { Uint8Array } Returns ContextId for cancel.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.userIAM.userAuth.AuthInstance.start
*/
auth(
challenge: Uint8Array,
authType: UserAuthType,
authTrustLevel: AuthTrustLevel,
callback: IUserAuthCallback
): Uint8Array;
/**
* Cancel authentication with ContextID.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @param { Uint8Array } contextID - Cancel authentication and pass in ContextID.
* @returns { number } Returns a number value indicating whether Cancel authentication was successful, the value of number is related to the ResultCode
* enum, **201** is check permission failed.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.userIAM.userAuth.AuthInstance.cancel
*/
cancelAuth(contextID: Uint8Array): number;
}
/**
* Asynchronous callback of authentication operation.
*
* @interface IUserAuthCallback
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.userIAM.userAuth.AuthEvent
*/
interface IUserAuthCallback {
/**
* The authentication result code is returned through the callback.
* If the authentication is passed, the authentication token is returned in extraInfo,
* If the authentication fails, the remaining authentication times are returned in extraInfo,
* If the authentication executor is locked, the freezing time is returned in extraInfo.
*
* @type { function }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.userIAM.userAuth.AuthEvent.callback
*/
onResult: (result: number, extraInfo: AuthResult) => void;
/**
* During an authentication, the TipsCode is returned through the callback.
*
* @type { ?function }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.userIAM.userAuth.AuthEvent.callback
*/
onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void;
}
/**
* Authentication result: authentication token, remaining authentication times, freezing time.
*
* @typedef AuthResult
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.userIAM.userAuth.AuthResultInfo
*/
interface AuthResult {
/**
* The authentication result if the authentication is passed.
*
* @type { ?Uint8Array }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
token?: Uint8Array;
/**
* The remaining authentication times if the authentication fails.
*
* @type { ?number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
remainTimes?: number;
/**
* The freezing time if the authentication executor is locked.
*
* @type { ?number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
freezingTime?: number;
}
/**
* Enum for operation result.
*
* @enum { number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
* @useinstead ohos.userIAM.userAuth.UserAuthResultCode
*/
enum ResultCode {
/**
* Indicates that the result is success or ability is supported.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
SUCCESS = 0,
/**
* Indicates that authentication failed.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
FAIL = 1,
/**
* Indicates other errors.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
GENERAL_ERROR = 2,
/**
* Indicates that this operation has been canceled.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
CANCELED = 3,
/**
* Indicates that this operation has timed out.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
TIMEOUT = 4,
/**
* Indicates that this authentication type is not supported.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
TYPE_NOT_SUPPORT = 5,
/**
* Indicates that the authentication trust level is not supported.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
TRUST_LEVEL_NOT_SUPPORT = 6,
/**
* Indicates that the authentication task is busy. Wait for a few seconds and try again.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
BUSY = 7,
/**
* Indicates incorrect parameters.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
INVALID_PARAMETERS = 8,
/**
* Indicates that the authenticator is locked.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
LOCKED = 9,
/**
* Indicates that the user has not enrolled the authenticator.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 9
*/
NOT_ENROLLED = 10
}
/**
* The enumeration of prompt codes in the process of face authentication.
*
* @enum { number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
enum FaceTips {
/**
* Indicates that the obtained facial image is too bright due to high illumination.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FACE_AUTH_TIP_TOO_BRIGHT = 1,
/**
* Indicates that the obtained facial image is too dark due to low illumination.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FACE_AUTH_TIP_TOO_DARK = 2,
/**
* Indicates that the face is too close to the device.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FACE_AUTH_TIP_TOO_CLOSE = 3,
/**
* Indicates that the face is too far away from the device.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FACE_AUTH_TIP_TOO_FAR = 4,
/**
* Indicates that the device is too high, and that only the upper part of the face is captured.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FACE_AUTH_TIP_TOO_HIGH = 5,
/**
* Indicates that the device is too low, and that only the lower part of the face is captured.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FACE_AUTH_TIP_TOO_LOW = 6,
/**
* Indicates that the device is deviated to the right, and that only the right part of the face is captured.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FACE_AUTH_TIP_TOO_RIGHT = 7,
/**
* Indicates that the device is deviated to the left, and that only the left part of the face is captured.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FACE_AUTH_TIP_TOO_LEFT = 8,
/**
* Indicates that the face moves too fast during facial information collection.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FACE_AUTH_TIP_TOO_MUCH_MOTION = 9,
/**
* Indicates that the face is not facing the device.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FACE_AUTH_TIP_POOR_GAZE = 10,
/**
* Indicates that no face is detected.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FACE_AUTH_TIP_NOT_DETECTED = 11
}
/**
* The enumeration of prompt codes in the process of fingerprint authentication.
*
* @enum { number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
enum FingerprintTips {
/**
* Indicates that the image acquired is good.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FINGERPRINT_AUTH_TIP_GOOD = 0,
/**
* Indicates that the fingerprint image is too noisy due to suspected or detected dirt on sensor.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FINGERPRINT_AUTH_TIP_DIRTY = 1,
/**
* Indicates that the fingerprint image is too noisy to process due to a detected condition.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FINGERPRINT_AUTH_TIP_INSUFFICIENT = 2,
/**
* Indicates that only a partial fingerprint image is detected.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FINGERPRINT_AUTH_TIP_PARTIAL = 3,
/**
* Indicates that the fingerprint image is incomplete due to quick motion.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FINGERPRINT_AUTH_TIP_TOO_FAST = 4,
/**
* Indicates that the fingerprint image is unreadable due to lack of motion.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
* @deprecated since 11
*/
FINGERPRINT_AUTH_TIP_TOO_SLOW = 5
}
/**
* Credential type for authentication.
*
* @enum { number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
*/
/**
* Enumerates the identity authentication types.
*
* @enum { int }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
enum UserAuthType {
/**
* Authentication type pin.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* PIN authentication.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
PIN = 1,
/**
* Authentication type face.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
*/
/**
* Facial authentication.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
FACE = 2,
/**
* Authentication type fingerprint.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
*/
/**
* Fingerprint authentication.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
FINGERPRINT = 4,
/**
* Privacy password authentication.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'14','1.2':'22'}
* @arkts 1.1&1.2
*/
PRIVATE_PIN = 16
}
/**
* Trust level of authentication results.
*
* @enum { number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
*/
/**
* Enumerates the trust levels of the authentication result.
* For details about typical scenarios and examples, see Principles for Classifying Biometric
* Authentication Trust Levels.
*
* @enum { int }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
enum AuthTrustLevel {
/**
* Authentication result trusted level 1.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
*/
/**
* Authentication trust level 1. The authentication of this level can identify individual users and provides
* limited liveness detection capabilities. It is applicable to scenarios such as service risk control and
* access to common personal data.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
ATL1 = 10000,
/**
* Authentication result trusted level 2.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
*/
/**
* Authentication trust level 2. The authentication of this level can accurately identify individual users and
* provides regular liveness detection capabilities. It is applicable to scenarios such as device unlocking
* and application login.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
ATL2 = 20000,
/**
* Authentication result trusted level 3.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
*/
/**
* Authentication trust level 3. The authentication of this level can accurately identify individual users and
* provides strong liveness detection capabilities. It is applicable to scenarios such as device unlocking.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
ATL3 = 30000,
/**
* Authentication result trusted level 4.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 8
*/
/**
* Authentication trust level 4. The authentication of this level can accurately identify individual users and
* provides powerful liveness detection capabilities. It is applicable to scenarios such as small-amount payment.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
ATL4 = 40000
}
/**
* Authentication events.
*
* @typedef { 'result' | 'tip' }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 11
*/
type AuthEventKey = 'result' | 'tip';
/**
* Return information of Authentication events.
*
* @typedef { AuthResultInfo | TipInfo }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 11
* @useinstead ohos.userIAM.userAuth.UserAuthResult
*/
type EventInfo = AuthResultInfo | TipInfo;
/**
* Asynchronous callback of authentication event.
*
* @interface AuthEvent
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 11
* @useinstead ohos.userIAM.userAuth.IAuthCallback
*/
interface AuthEvent {
/**
* The authentication event callback.
*
* @param { EventInfo } result - Event info.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 11
* @useinstead ohos.userIAM.userAuth.IAuthCallback.onResult
*/
callback(result: EventInfo): void;
}
/**
* Authentication result information.
*
* @typedef AuthResultInfo
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 11
*/
interface AuthResultInfo {
/**
* The authentication result.
*
* @type { number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 11
*/
result: number;
/**
* The authentication token if the authentication is passed.
*
* @type { ?Uint8Array }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 11
*/
token?: Uint8Array;
/**
* The remaining authentication attempts if the authentication fails.
*
* @type { ?number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 11
*/
remainAttempts?: number;
/**
* The lockout duration if the authentication executor is locked.
*
* @type { ?number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 11
*/
lockoutDuration?: number;
}
/**
* Authentication tip info.
*
* @typedef TipInfo
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 11
*/
interface TipInfo {
/**
* The authentication module of sending tip information.
*
* @type { number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 11
*/
module: number;
/**
* Tip information, used to prompt the business to perform some operations.
*
* @type { number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 11
*/
tip: number;
}
/**
* Authentication instance, used to initiate a complete authentication.
*
* @interface AuthInstance
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 10
* @useinstead ohos.userIAM.userAuth.UserAuthInstance
*/
interface AuthInstance {
/**
* Turn on authentication event listening.
*
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 10
*/
on: (name: AuthEventKey, callback: AuthEvent) => void;
/**
* Turn off authentication event listening.
*
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 10
*/
off: (name: AuthEventKey) => void;
/**
* Start this authentication, an instance can only perform authentication once.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @type { function }
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 12500001 - Authentication failed.
* @throws { BusinessError } 12500002 - General operation error.
* @throws { BusinessError } 12500003 - The operation is canceled.
* @throws { BusinessError } 12500004 - The operation is time-out.
* @throws { BusinessError } 12500005 - The authentication type is not supported.
* @throws { BusinessError } 12500006 - The authentication trust level is not supported.
* @throws { BusinessError } 12500007 - The authentication task is busy.
* @throws { BusinessError } 12500009 - The authenticator is locked.
* @throws { BusinessError } 12500010 - The type of credential has not been enrolled.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 10
*/
start: () => void;
/**
* Cancel this authentication.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @type { function }
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 10
*/
cancel: () => void;
}
/**
* Check whether the authentication capability is available.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @param { UserAuthType } authType - Credential type for authentication.
* @param { AuthTrustLevel } authTrustLevel - Trust level of authentication result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* @throws { BusinessError } 12500002 - General operation error.
* @throws { BusinessError } 12500005 - The authentication type is not supported.
* @throws { BusinessError } 12500006 - The authentication trust level is not supported.
* @throws { BusinessError } 12500010 - The type of credential has not been enrolled.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
*/
/**
* Checks whether the specified authentication capability is supported.
*
* <p><strong>NOTE</strong>:
* <br>Error code 12500005 is returned if the authentication executor is not registered and the specified
* authentication capability is not supported.
* <br>Error code 12500006 is returned if the authentication executor has been registered, the authentication
* functionality is not disabled, but the authentication trust level is lower than that specified by the service.
* <br>Error code 12500010 is returned if the authentication executor has been registered, the authentication
* functionality is not disabled, but the user has not enrolled credential.
* <br>Error code 12500013 is returned if the authentication executor has been registered, the authentication
* functionality is not disabled, but the password has expired.
* <br>If getAvailableStatus is called to check whether lock screen password authentication at ATL4 is supported
* for a user who has enrolled a 4-digit PIN as the lock screen password (the authentication trust level is ATL3),
* error code 12500010 will be returned.
* </p>
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @param { UserAuthType } authType - Authentication type. PIN is supported since API version 11.
* @param { AuthTrustLevel } authTrustLevel - Authentication trust level.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* @throws { BusinessError } 12500002 - General operation error.
* @throws { BusinessError } 12500005 - The authentication type is not supported.
* @throws { BusinessError } 12500006 - The authentication trust level is not supported.
* @throws { BusinessError } 12500010 - The type of credential has not been enrolled.
* @throws { BusinessError } 12500013 - Operation failed because of PIN expired.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
function getAvailableStatus(authType: UserAuthType, authTrustLevel: AuthTrustLevel): void;
/**
* Represents the state of a credential enrolled.
*
* @typedef EnrolledState
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
interface EnrolledState {
/**
* Credential digest, which is randomly generated when a credential is added.
*
* @type { int }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
credentialDigest: int;
/**
* Number of enrolled credentials.
*
* @type { int }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
credentialCount: int;
}
/**
* Obtains information about the credentials enrolled. With this API, you can obtain the change of the credentials.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @param { UserAuthType } authType - Authentication type.
* @returns { EnrolledState } Credential state obtained if the operation is successful.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* @throws { BusinessError } 12500002 - General operation error.
* @throws { BusinessError } 12500005 - The authentication type is not supported.
* @throws { BusinessError } 12500010 - The type of credential has not been enrolled.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
function getEnrolledState(authType: UserAuthType): EnrolledState;
/**
* Get Authentication instance.
*
* @param { Uint8Array } challenge - Pass in challenge value.
* @param { UserAuthType } authType - Credential type for authentication.
* @param { AuthTrustLevel } authTrustLevel - Trust level of authentication result.
* @returns { AuthInstance } Returns an authentication instance.
* @throws { BusinessError } 401 - Parameter error.
* @throws { BusinessError } 12500002 - General operation error.
* @throws { BusinessError } 12500005 - The authentication type is not supported.
* @throws { BusinessError } 12500006 - The authentication trust level is not supported.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
* @deprecated since 10
* @useinstead ohos.userIAM.userAuth.getUserAuthInstance
*/
function getAuthInstance(challenge: Uint8Array, authType: UserAuthType, authTrustLevel: AuthTrustLevel): AuthInstance;
/**
* Enumerates the window types of the authentication widget.
*
* @enum { int }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'10','1.2':'22'}
* @arkts 1.1&1.2
*/
enum WindowModeType {
/**
* Window mode type is dialog box.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'10','1.2':'22'}
* @arkts 1.1&1.2
*/
DIALOG_BOX = 1,
/**
* Window mode type is full screen.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'10','1.2':'22'}
* @arkts 1.1&1.2
*/
FULLSCREEN = 2
}
/**
* Enumerates the modes for reusing authentication results.
*
* @enum { int }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
enum ReuseMode {
/**
* The device unlock authentication result can be reused within the validity period if the authentication type
* matches any of the authentication types specified for this authentication.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
AUTH_TYPE_RELEVANT = 1,
/**
* The device unlock authentication result can be reused within the validity period regardless of the
* authentication type.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
AUTH_TYPE_IRRELEVANT = 2,
/**
* Any identity authentication result (including device unlock authentication result) can be reused within the
* validity period if the authentication type matches any of the authentication types specified for
* this authentication.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'14','1.2':'22'}
* @arkts 1.1&1.2
*/
CALLER_IRRELEVANT_AUTH_TYPE_RELEVANT = 3,
/**
* Any identity authentication result (including device unlock authentication result) can be reused within the
* validity period regardless of the authentication type.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'14','1.2':'22'}
* @arkts 1.1&1.2
*/
CALLER_IRRELEVANT_AUTH_TYPE_IRRELEVANT = 4
}
/**
* Represents information about the authentication result reuse.
*
* <p><strong>NOTE</strong>:
* <br>If the credential changes within the reuse duration after a successful identity authentication
* (including device unlock authentication), the authentication result can still be reused and the actual
* EnrolledState is returned in the authentication result.
* <br>If the credential used for the previous authentication has been deleted when the authentication
* result is used:
* 1.If the deleted credential is face or fingerprint, the authentication result can still be reused, but
* credentialCount and credentialDigest in the EnrolledState returned are both 0.
* 2.If the deleted credential is a lock screen password, the reuse will fail.
* </p>
*
* @typedef ReuseUnlockResult
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
interface ReuseUnlockResult {
/**
* Authentication result reuse mode.
*
* @type { ReuseMode }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
reuseMode: ReuseMode;
/**
* Period for which the authentication result can be reused. The value must be greater than 0 and less
* than MAX_ALLOWABLE_REUSE_DURATION.
*
* @type { int }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
reuseDuration: int;
}
/**
* Auth parameter.
*
* @typedef AuthParam
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Defines the user authentication parameters.
*
* @typedef AuthParam
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
interface AuthParam {
/**
* Pass in challenge value.
*
* @type { Uint8Array }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Random challenge value, which can be used to prevent replay attacks.
* It cannot exceed 32 bytes and can be passed in Uint8Array([]) format.
*
* @type { Uint8Array }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
challenge: Uint8Array;
/**
* Credential type for authentication.
*
* @type { UserAuthType[] }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Authentication type list, which specifies the types of authentication provided on the user authentication page.
*
* @type { UserAuthType[] }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
authType: UserAuthType[];
/**
* Trust level of authentication result.
*
* @type { AuthTrustLevel }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Authentication trust level. For details, see Principles for Classifying Biometric Authentication Trust Levels.
*
* @type { AuthTrustLevel }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
authTrustLevel: AuthTrustLevel;
/**
* Information about the authentication result reuse.
*
* @type { ?ReuseUnlockResult }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
reuseUnlockResult?: ReuseUnlockResult;
/**
* ID of the user to be authenticated.
*
* @type { ?int }
* @default The ID of the current user. The value is a positive integer greater than or equal to 0.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'18','1.2':'22'}
* @arkts 1.1&1.2
*/
userId?: int;
/**
* Indicates whether to skip biometric authentication which has been locked by continuous failures.
*
* @type { ?boolean }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
skipLockedBiometricAuth?: boolean;
}
/**
* Auth widget parameter.
*
* @typedef WidgetParam
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Represents the information presented on the user authentication page.
*
* @typedef WidgetParam
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
interface WidgetParam {
/**
* Title of widget.
*
* @type { string }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Title of the user authentication page. It cannot exceed 500 characters.
*
* @type { string }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
title: string;
/**
* The description text of navigation button.
*
* @type { ?string }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Text on the navigation button. It cannot exceed 60 characters. It is supported in single fingerprint or facial
* authentication before API version 18. Since API version 18, it is also supported in combined facial and
* fingerprint authentication.
*
* @type { ?string }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
navigationButtonText?: string;
/**
* Display format of the user authentication page.
*
* @type { ?WindowModeType }
* @default WindowModeType.DIALOG_BOX
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'10','1.2':'22'}
* @arkts 1.1&1.2
*/
windowMode?: WindowModeType;
/**
* Whether to display the authentication dialog box in modal application mode. This mode is applicable only
* to 2-in-1 devices. If this mode is not used or other types of devices are used, the authentication dialog
* box is displayed in modal system mode.
*
* @type { ?Context }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'18','1.2':'22'}
* @arkts 1.1&1.2
*/
uiContext?: Context;
}
/**
* Authentication result: authentication token, credential type for authentication succeed.
*
* @typedef UserAuthResult
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Represents the user authentication result. If the authentication is successful, the authentication type and token
* information are returned.
*
* @typedef UserAuthResult
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
interface UserAuthResult {
/**
* The authentication result.
*
* @type { number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* User authentication result. If the authentication is successful, SUCCESS is returned. Otherwise, an error code
* is returned. For details, see UserAuthResultCode.
*
* @type { int }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
result: int;
/**
* The authentication result if the authentication is passed.
*
* @type { ?Uint8Array }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* The authentication result if the authentication is passed.
*
* @type { ?Uint8Array }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
token?: Uint8Array;
/**
* Credential type for authentication succeed.
*
* @type { ?UserAuthType }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Credential type for authentication succeed.
*
* @type { ?UserAuthType }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
authType?: UserAuthType;
/**
* The enrolled state for authentication succeed. EnrolledState would be returned when the authentication has
* passed.
*
* @type { ?EnrolledState }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
enrolledState?: EnrolledState;
}
/**
* Called to return the authentication result. If the authentication is successful,
* UserAuthResult contains the token information.
*
* @typedef { function } AuthCallbackOnResultFunc
* @param { UserAuthResult } result - Authentication result information.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 22
* @arkts 1.2
*/
type AuthCallbackOnResultFunc = (result: UserAuthResult) => void;
/**
* Asynchronous callback of authentication operation.
*
* @interface IAuthCallback
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Provides callbacks to return the authentication result.
*
* @interface IAuthCallback
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
interface IAuthCallback {
/**
* The authentication result code is returned through the callback.
* If the authentication is passed, the authentication token is returned in extraInfo.
*
* @param { UserAuthResult } result - Authentication result information.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Called to return the authentication result. If the authentication is successful,
* UserAuthResult contains the token information.
*
* @param { UserAuthResult } result - Authentication result information.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since 12
*/
onResult(result: UserAuthResult): void;
/**
* Called to return the authentication result. If the authentication is successful,
* UserAuthResult contains the token information.
*
* @type { AuthCallbackOnResultFunc }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 22
* @arkts 1.2
*/
onResult: AuthCallbackOnResultFunc;
}
/**
* Authentication tip code.
*
* @enum { int }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
enum UserAuthTipCode {
/**
* Authentication tip for authentication failed.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
COMPARE_FAILURE = 1,
/**
* Authentication tip for authentication timeout.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
TIMEOUT = 2,
/**
* Authentication tip for authentication temporarily frozen.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
TEMPORARILY_LOCKED = 3,
/**
* Authentication tip for authentication permanent frozen.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
PERMANENTLY_LOCKED = 4,
/**
* Authentication tip for widget load success.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
WIDGET_LOADED = 5,
/**
* Authentication tip for widget released.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
WIDGET_RELEASED = 6,
/**
* Authentication tip for authentication failed which causes authentication frozen.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
COMPARE_FAILURE_WITH_FROZEN = 7
}
/**
* Authentication tip information.
*
* @typedef AuthTipInfo
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
interface AuthTipInfo {
/**
* Authentication tip type.
*
* @type { UserAuthType }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
tipType: UserAuthType;
/**
* Authentication tip code.
*
* @type { UserAuthTipCode }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
tipCode: UserAuthTipCode;
}
/**
* The authentication tip information is returned through the callback.
*
* @typedef { function } AuthTipCallback
* @param { AuthTipInfo } authTipInfo - Tips returned during authentication process.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
type AuthTipCallback = (authTipInfo: AuthTipInfo) => void;
/**
* User authentication instance, used to initiate a complete authentication.
*
* @interface UserAuthInstance
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Provides APIs for user authentication. The user authentication widget is supported. Before using the APIs
* of UserAuthInstance, you must obtain a UserAuthInstance instance by using getUserAuthInstance.
*
* @interface UserAuthInstance
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
interface UserAuthInstance {
/**
* Turn on widget authentication result event listening.
*
* @param { 'result' } type - Indicates the type of event.
* @param { IAuthCallback } callback - Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types.
* <br>3. Parameter verification failed.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Subscribes to the user authentication result.
*
* @param { 'result' } type - Event type. The value is result, which indicates the authentication result.
* @param { IAuthCallback } callback - Callback used to return the user authentication result.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types.
* <br>3. Parameter verification failed.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
on(type: 'result', callback: IAuthCallback): void;
/**
* Turn off widget authentication result event listening.
*
* @param { 'result' } type - Indicates the type of event.
* @param { IAuthCallback } callback - Indicates the listener.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types.
* <br>3. Parameter verification failed.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Unsubscribes from the user authentication result.
*
* <p><strong>NOTE</strong>:
* <br>The UserAuthInstance instance used to invoke this API must be the one used to subscribe to the event.
* </p>
*
* @param { 'result' } type - Event type. The value is result, which indicates the authentication result.
* @param { IAuthCallback } callback - Callback to unregister.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types.
* <br>3. Parameter verification failed.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
off(type: 'result', callback?: IAuthCallback): void;
/**
* Start this authentication, an instance can only perform authentication once.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Incorrect parameter types.
* @throws { BusinessError } 12500001 - Authentication failed.
* @throws { BusinessError } 12500002 - General operation error.
* @throws { BusinessError } 12500003 - Authentication canceled.
* @throws { BusinessError } 12500004 - Authentication timeout.
* @throws { BusinessError } 12500005 - The authentication type is not supported.
* @throws { BusinessError } 12500006 - The authentication trust level is not supported.
* @throws { BusinessError } 12500007 - Authentication service is busy.
* @throws { BusinessError } 12500009 - Authentication is locked out.
* @throws { BusinessError } 12500010 - The type of credential has not been enrolled.
* @throws { BusinessError } 12500011 - Switched to the custom authentication process.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Start this authentication, an instance can only perform authentication once.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Incorrect parameter types.
* @throws { BusinessError } 12500001 - Authentication failed.
* @throws { BusinessError } 12500002 - General operation error.
* @throws { BusinessError } 12500003 - Authentication canceled.
* @throws { BusinessError } 12500004 - Authentication timeout.
* @throws { BusinessError } 12500005 - The authentication type is not supported.
* @throws { BusinessError } 12500006 - The authentication trust level is not supported.
* @throws { BusinessError } 12500007 - Authentication service is busy.
* @throws { BusinessError } 12500009 - Authentication is locked out.
* @throws { BusinessError } 12500010 - The type of credential has not been enrolled.
* @throws { BusinessError } 12500011 - Switched to the custom authentication process.
* @throws { BusinessError } 12500013 - Operation failed because of PIN expired.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since 12
*/
/**
* Starts authentication.
*
* <p><strong>NOTE</strong>:
* <br>Each UserAuthInstance can be used for authentication only once.
* <br>Starting from API version 20, only system applications can apply for the
* ohos.permission.USER_AUTH_FROM_BACKGROUND permission.
* </p>
*
* @permission ohos.permission.ACCESS_BIOMETRIC or ohos.permission.USER_AUTH_FROM_BACKGROUND
* @throws { BusinessError } 201 - Permission denied. Possible causes:
* <br>1. No permission to access biometric.
* <br>2. No permission to start authentication from background.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Incorrect parameter types.
* @throws { BusinessError } 12500002 - General operation error.
* @throws { BusinessError } 12500003 - Authentication canceled.
* @throws { BusinessError } 12500005 - The authentication type is not supported.
* @throws { BusinessError } 12500006 - The authentication trust level is not supported.
* @throws { BusinessError } 12500009 - Authentication is locked out.
* @throws { BusinessError } 12500010 - The type of credential has not been enrolled.
* @throws { BusinessError } 12500011 - Switched to the customized authentication process.
* @throws { BusinessError } 12500013 - Operation failed because of PIN expired.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
start(): void;
/**
* Cancel this authentication.
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Incorrect parameter types.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Cancels this authentication.
*
* <p><strong>NOTE</strong>:
* <br>UserAuthInstance must be the instance being authenticated.
* </p>
*
* @permission ohos.permission.ACCESS_BIOMETRIC
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Incorrect parameter types.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
cancel(): void;
/**
* Turn on authentication tip event listening.
*
* @param { 'authTip' } type - Indicates the type of event.
* @param { AuthTipCallback } callback - Indicates the listener.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since 20
*/
on(type: 'authTip', callback: AuthTipCallback): void;
/**
* Turn off authentication tip event listening.
*
* @param { 'authTip' } type - Indicates the type of event.
* @param { AuthTipCallback } [callback] - Indicates the listener.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since 20
*/
off(type: 'authTip', callback?: AuthTipCallback): void;
}
/**
* Get user authentication instance with widget.
*
* @param { AuthParam } authParam - Auth parameter.
* @param { WidgetParam } widgetParam - Widget parameter.
* @returns { UserAuthInstance } Returns an authentication instance with widget.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types.
* <br>3. Parameter verification failed.
* @throws { BusinessError } 12500002 - General operation error.
* @throws { BusinessError } 12500005 - The authentication type is not supported.
* @throws { BusinessError } 12500006 - The authentication trust level is not supported.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Obtains a UserAuthInstance instance for user authentication. The user authentication widget is also supported.
*
* <p><strong>NOTE</strong>:
* <br>Each UserAuthInstance can be used for authentication only once.
* </p>
*
* @param { AuthParam } authParam - Auth parameter.
* @param { WidgetParam } widgetParam - Widget parameter.
* @returns { UserAuthInstance } Returns an authentication instance with widget.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types.
* <br>3. Parameter verification failed.
* @throws { BusinessError } 12500002 - General operation error.
* @throws { BusinessError } 12500005 - The authentication type is not supported.
* @throws { BusinessError } 12500006 - The authentication trust level is not supported.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
function getUserAuthInstance(authParam: AuthParam, widgetParam: WidgetParam): UserAuthInstance;
/**
* Defines the type of the user authentication notification.
*
* @enum { int }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'10','1.2':'22'}
* @arkts 1.1&1.2
*/
enum NoticeType {
/**
* Notification from the user authentication widget.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'10','1.2':'22'}
* @arkts 1.1&1.2
*/
WIDGET_NOTICE = 1
}
/**
* Sends a notification from the user authentication widget.
*
* @permission ohos.permission.SUPPORT_USER_AUTH
* @param { NoticeType } noticeType - Notification type.
* @param { string } eventData - Event data. The data cannot exceed 65536 bytes.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Permission denied. Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types.
* <br>3. Parameter verification failed.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'10','1.2':'22'}
* @arkts 1.1&1.2
*/
function sendNotice(noticeType: NoticeType, eventData: string): void;
/**
* Enum for operation result.
*
* @enum { number }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
*/
/**
* Enumerates the authentication result codes.
*
* @enum { int }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
enum UserAuthResultCode {
/**
* Indicates that the result is success or ability is supported.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
*/
/**
* The authentication is successful.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
SUCCESS = 12500000,
/**
* Indicates that the authentication result is failed.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
*/
/**
* The authentication failed.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
FAIL = 12500001,
/**
* Indicates other errors.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
*/
/**
* A general operation error occurred.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
GENERAL_ERROR = 12500002,
/**
* Indicates that this operation is canceled.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
*/
/**
* The authentication is canceled.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
CANCELED = 12500003,
/**
* Indicates that this operation is time-out.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
*/
/**
* The authentication has timed out.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
TIMEOUT = 12500004,
/**
* Indicates that this authentication type is not supported.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
*/
/**
* The authentication type is not supported.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
TYPE_NOT_SUPPORT = 12500005,
/**
* Indicates that the authentication trust level is not supported.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
*/
/**
* Indicates that the authentication trust level is not supported.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
TRUST_LEVEL_NOT_SUPPORT = 12500006,
/**
* Indicates that the authentication task is busy. Wait for a few seconds and try again.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
*/
/**
* Indicates that the authentication task is busy. Wait for a few seconds and try again.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
BUSY = 12500007,
/**
* Indicates that the paramter is out of range.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
INVALID_PARAMETERS = 12500008,
/**
* Indicates that the authenticator is locked.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
*/
/**
* Indicates that the authenticator is locked.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
LOCKED = 12500009,
/**
* Indicates that the user has not enrolled the authenticator.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 9
*/
/**
* Indicates that the user has not enrolled the specified system identity authentication credential.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
NOT_ENROLLED = 12500010,
/**
* Indicates that this operation is canceled from widget's navigation button.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @since 10
*/
/**
* Indicates that the user cancels the system authentication and selects a custom authentication of the application.
* The caller needs to launch the custom authentication page.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
CANCELED_FROM_WIDGET = 12500011,
/**
* Indicates that the authentication failed because the lock screen password has expired.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @atomicservice
* @since arkts {'1.1':'12','1.2':'22'}
* @arkts 1.1&1.2
*/
PIN_EXPIRED = 12500013,
/**
* Indicates that current operation failed because of authToken integrity check failed.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'18','1.2':'22'}
* @arkts 1.1&1.2
*/
AUTH_TOKEN_CHECK_FAILED = 12500015,
/**
* The interval between the AuthToken issuance time and the AuthToken verification time exceeds
* the maximum validity period.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'18','1.2':'22'}
* @arkts 1.1&1.2
*/
AUTH_TOKEN_EXPIRED = 12500016,
/**
* Indicates that reuse of last authentication result is failed.
*
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
REUSE_AUTH_RESULT_FAILED = 12500017
}
/**
* Provides APIs for managing the user authentication widget. You can use the APIs to register the user
* authentication widget with UserAuthWidgetMgr for management and scheduling.
*
* @interface UserAuthWidgetMgr
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'10','1.2':'22'}
* @arkts 1.1&1.2
*/
interface UserAuthWidgetMgr {
/**
* Subscribes to commands from the user authentication framework for the user authentication widget.
*
* @param { 'command' } type - Event type. The vlaue is command, which indicates the command sent from the user
* authentication framework to the user authentication widget.
* @param { IAuthWidgetCallback } callback - Callback used to return the command from the user authentication
* framework to the user authentication widget.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types.
* <br>3. Parameter verification failed.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'10','1.2':'22'}
* @arkts 1.1&1.2
*/
on(type: 'command', callback: IAuthWidgetCallback): void;
/**
* Unsubscribes from commands sent from the user authentication framework.
*
* @param { 'command' } type - Event type. The value is command, which indicates the command sent from the user
* authentication framework to the user authentication widget.
* @param { IAuthWidgetCallback } callback - Callback to unregister.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types.
* <br>3. Parameter verification failed.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'10','1.2':'22'}
* @arkts 1.1&1.2
*/
off(type: 'command', callback?: IAuthWidgetCallback): void;
}
/**
* Obtains a UserAuthWidgetMgr instance for user authentication.
*
* <p><strong>NOTE</strong>:
* <br>A UserAuthInstance instance can be used for an authentication only once.
* </p>
*
* @permission ohos.permission.SUPPORT_USER_AUTH
* @param { int } version - Version of the user authentication widget.
* @returns { UserAuthWidgetMgr } UserAuthWidgetMgr instance obtained.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Permission denied. Called by non-system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes:
* <br>1. Mandatory parameters are left unspecified.
* <br>2. Incorrect parameter types.
* @throws { BusinessError } 12500002 - General operation error.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'10','1.2':'22'}
* @arkts 1.1&1.2
*/
function getUserAuthWidgetMgr(version: int): UserAuthWidgetMgr;
/**
* Called to return the command sent from the user authentication framework to the user authentication widget.
*
* @typedef { function } AuthWidgetCallbackSendCommandFunc
* @param { string } cmdData - Command sent from the user authentication framework to the user authentication widget.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since 22
* @arkts 1.2
*/
type AuthWidgetCallbackSendCommandFunc = (cmdData: string) => void;
/**
* Provides the callback for returning the commands sent from the user authentication framework
* to the user authentication widget.
*
* @interface IAuthWidgetCallback
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'10','1.2':'22'}
* @arkts 1.1&1.2
*/
interface IAuthWidgetCallback {
/**
* Called to return the command sent from the user authentication framework to the user authentication widget.
*
* @param { string } cmdData - Command sent from the user authentication framework to the user authentication widget.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since 10
*/
sendCommand(cmdData: string): void;
/**
* Called to return the command sent from the user authentication framework to the user authentication widget.
*
* @type { AuthWidgetCallbackSendCommandFunc }
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since 22
* @arkts 1.2
*/
sendCommand: AuthWidgetCallbackSendCommandFunc;
}
/**
* Obtains the reusable authentication result.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { AuthParam } authParam - Auth parameter.
* @returns { Uint8Array } The reuse authentication token.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Permission denied. Called by non-system application.
* @throws { BusinessError } 12500002 - General operation error.
* @throws { BusinessError } 12500008 - The parameter is out of range.
* @throws { BusinessError } 12500017 - Failed to reuse authentication result.
* @syscap SystemCapability.UserIAM.UserAuth.Core
* @systemapi Hide this for inner system use.
* @since arkts {'1.1':'20','1.2':'22'}
* @arkts 1.1&1.2
*/
function queryReusableAuthResult(authParam: AuthParam): Uint8Array;
}
export default userAuth;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/interface_sdk-js.git
git@gitee.com:openharmony/interface_sdk-js.git
openharmony
interface_sdk-js
interface_sdk-js
master

搜索帮助