1 Star 0 Fork 4K

Feng Lin/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.account.osAccount.d.ts 217.47 KB
一键复制 编辑 原始数据 按行查看 历史
openharmony_ci 提交于 2024-07-08 14:04 +08:00 . !12472 jsapi lint告警处理
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273
/*
* Copyright (c) 2021-2023 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 BasicServicesKit
*/
import type distributedAccount from './@ohos.account.distributedAccount';
import type { AsyncCallback, Callback } from './@ohos.base';
/**
* This module provides the capability to manage os accounts.
*
* @namespace osAccount
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
declare namespace osAccount {
/**
* Obtains the AccountManager instance.
*
* @returns { AccountManager } Returns the instance of the AccountManager.
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
function getAccountManager(): AccountManager;
/**
* Provides abilities for you to manage and perform operations on your OS accounts.
*
* @interface AccountManager
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
interface AccountManager {
/**
* Activates a specified OS account.
* <p>
* If multiple OS accounts are available, you can call this method to enable a specific OS account
* to run in the foreground. Then, the OS account originally running in the foreground will be
* switched to the background.
* </p>
*
* @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @throws { BusinessError } 12300009 - Account has been activated.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
/**
* Activates a specified OS account.
* <p>
* If multiple OS accounts are available, you can call this method to enable a specific OS account
* to run in the foreground. Then, the OS account originally running in the foreground will be
* switched to the background.
* </p>
*
* @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @throws { BusinessError } 12300016 - The number of logged in accounts reaches the upper limit.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
activateOsAccount(localId: number, callback: AsyncCallback<void>): void;
/**
* Activates a specified OS account.
* <p>
* If multiple OS accounts are available, you can call this method to enable a specific OS account
* to run in the foreground. Then, the OS account originally running in the foreground will be
* switched to the background.
* </p>
*
* @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @throws { BusinessError } 12300009 - Account has been activated.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
/**
* Activates a specified OS account.
* <p>
* If multiple OS accounts are available, you can call this method to enable a specific OS account
* to run in the foreground. Then, the OS account originally running in the foreground will be
* switched to the background.
* </p>
*
* @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @throws { BusinessError } 12300016 - The number of logged in accounts reaches the upper limit.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
activateOsAccount(localId: number): Promise<void>;
/**
* Deactivates a specified OS account.
*
* @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
deactivateOsAccount(localId: number): Promise<void>;
/**
* Checks whether the function of supporting multiple OS accounts is enabled.
*
* @param { AsyncCallback<boolean> } callback - Returns {@code true} if this function is enabled; returns {@code false} otherwise.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#checkMultiOsAccountEnabled
*/
isMultiOsAccountEnable(callback: AsyncCallback<boolean>): void;
/**
* Checks whether the function of supporting multiple OS accounts is enabled.
*
* @returns { Promise<boolean> } Returns {@code true} if this function is enabled; returns {@code false} otherwise.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#checkMultiOsAccountEnabled
*/
isMultiOsAccountEnable(): Promise<boolean>;
/**
* Checks whether the function of supporting multiple OS accounts is enabled.
*
* @param { AsyncCallback<boolean> } callback - Returns {@code true} if this function is enabled; returns {@code false} otherwise.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
checkMultiOsAccountEnabled(callback: AsyncCallback<boolean>): void;
/**
* Checks whether the function of supporting multiple OS accounts is enabled.
*
* @returns { Promise<boolean> } Returns {@code true} if this function is enabled; returns {@code false} otherwise.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
checkMultiOsAccountEnabled(): Promise<boolean>;
/**
* Checks whether an OS account is activated based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the OS account is activated.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#checkOsAccountActivated
*/
isOsAccountActived(localId: number, callback: AsyncCallback<boolean>): void;
/**
* Checks whether an OS account is activated based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<boolean> } Returns {@code true} if the OS account is activated; returns {@code false} otherwise.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#checkOsAccountActivated
*/
isOsAccountActived(localId: number): Promise<boolean>;
/**
* Checks whether an OS account is activated based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the OS account is activated.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @since 9
* @deprecated since 11
*/
checkOsAccountActivated(localId: number, callback: AsyncCallback<boolean>): void;
/**
* Checks whether an OS account is activated based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<boolean> } - Returns {@code true} if the OS account is activated; returns {@code false} otherwise.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @since 9
* @deprecated since 11
*/
checkOsAccountActivated(localId: number): Promise<boolean>;
/**
* Checks whether an OS account is activated based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<boolean> } - Returns {@code true} if the OS account is activated; returns {@code false} otherwise.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 11
*/
isOsAccountActivated(localId: number): Promise<boolean>;
/**
* Checks whether a constraint has been enabled for an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } constraint - Indicates the constraint to check. The value can be:
* <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point.
* <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages.
* <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls.
* <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications
* <br> from unknown sources.
* @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the constraint is enabled for the specified OS account.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#checkOsAccountConstraintEnabled
*/
isOsAccountConstraintEnable(localId: number, constraint: string, callback: AsyncCallback<boolean>): void;
/**
* Checks whether a constraint has been enabled for an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } constraint - Indicates the constraint to check. The value can be:
* <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point.
* <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages.
* <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls.
* <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications
* <br> from unknown sources.
* @returns { Promise<boolean> } Returns {@code true} if the constraint has been enabled for the OS account;
* returns {@code false} otherwise.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#checkOsAccountConstraintEnabled
*/
isOsAccountConstraintEnable(localId: number, constraint: string): Promise<boolean>;
/**
* Checks whether the given constraint is enabled for the specified OS account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } constraint - Indicates the constraint to check. For example: the value can be:
* <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point.
* <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages.
* <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls.
* <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications
* <br> from unknown sources.
* @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the constraint is enabled for the specified OS account.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId or constraint.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @since 9
* @deprecated since 11
*/
checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void;
/**
* Checks whether the given constraint is enabled for the specified OS account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } constraint - Indicates the constraint to check. For example: the value can be:
* <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point.
* <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages.
* <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls.
* <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications
* <br> from unknown sources.
* @returns { Promise<boolean> } Returns whether the given constraint is enabled for the specified OS account.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId or constraint.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @since 9
* @deprecated since 11
*/
checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean>;
/**
* Checks whether the given constraint is enabled for the current OS account.
*
* @param { string } constraint - Indicates the constraint to check. For example: the value can be:
* <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point.
* <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages.
* <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls.
* <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications
* <br> from unknown sources.
* @returns { Promise<boolean> } Returns whether the given constraint is enabled for the current OS account.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 11
*/
isOsAccountConstraintEnabled(constraint: string): Promise<boolean>;
/**
* Checks whether the given constraint is enabled for the specified OS account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } constraint - Indicates the constraint to check. For example: the value can be:
* <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point.
* <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages.
* <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls.
* <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications
* <br> from unknown sources.
* @returns { Promise<boolean> } Returns whether the given constraint is enabled for the specified OS account.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 11
*/
isOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean>;
/**
* Checks whether this OS account is a test OS account.
*
* @param { AsyncCallback<boolean> } callback - Returns {@code true} if this OS account is a test OS account; returns {@code false} otherwise.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#checkOsAccountTestable
*/
isTestOsAccount(callback: AsyncCallback<boolean>): void;
/**
* Checks whether this OS account is a test OS account.
*
* @returns { Promise<boolean> } Returns {@code true} if this OS account is a test OS account; returns {@code false} otherwise.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#checkOsAccountTestable
*/
isTestOsAccount(): Promise<boolean>;
/**
* Checks whether current OS account is testable.
*
* @param { AsyncCallback<boolean> } callback - Returns {@code true} if this account is testable; returns {@code false} otherwise.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
checkOsAccountTestable(callback: AsyncCallback<boolean>): void;
/**
* Checks whether current OS account is testable.
*
* @returns { Promise<boolean> } Returns {@code true} if this account is testable; returns {@code false} otherwise.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
checkOsAccountTestable(): Promise<boolean>;
/**
* Checks whether an OS account has been verified based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { AsyncCallback<boolean> } callback - Returns {@code true} if the OS account has been verified successfully;
* returns {@code false} otherwise.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#checkOsAccountVerified
*/
isOsAccountVerified(callback: AsyncCallback<boolean>): void;
/**
* Checks whether an OS account has been verified based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<boolean> } callback - Returns {@code true} if the OS account has been verified successfully;
* returns {@code false} otherwise.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#checkOsAccountVerified
*/
isOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): void;
/**
* Checks whether an OS account has been verified based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<boolean> } Returns {@code true} if the OS account has been verified successfully;
* returns {@code false} otherwise.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#checkOsAccountVerified
*/
isOsAccountVerified(localId?: number): Promise<boolean>;
/**
* Checks whether the current OS account is verified.
*
* @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the current OS account is verified.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
* @deprecated since 11
* @useinstead osAccount.AccountManager#isOsAccountUnlocked
*/
checkOsAccountVerified(callback: AsyncCallback<boolean>): void;
/**
* Checks whether the current OS account is verified.
*
* @returns { Promise<boolean> } Returns whether the current OS account is verified.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
* @deprecated since 11
* @useinstead osAccount.AccountManager#isOsAccountUnlocked
*/
checkOsAccountVerified(): Promise<boolean>;
/**
* Checks whether the specified OS account is verified.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<boolean> } callback - Indicates the callback for checking whether the specified OS account is verified.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @since 9
* @deprecated since 11
*/
checkOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): void;
/**
* Checks whether the specified OS account is verified.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<boolean> } Returns whether the specified OS account is verified.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @since 9
* @deprecated since 11
*/
checkOsAccountVerified(localId: number): Promise<boolean>;
/**
* Checks whether the current OS account is unlocked.
*
* @returns { Promise<boolean> } Returns whether the current OS account is unlocked.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 11
*/
isOsAccountUnlocked(): Promise<boolean>;
/**
* Checks whether the specified OS account is unlocked.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<boolean> } Returns whether the specified OS account is unlocked.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 11
*/
isOsAccountUnlocked(localId: number): Promise<boolean>;
/**
* Removes an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<void> } callback - Indicates the callback for removing the specified OS account.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
removeOsAccount(localId: number, callback: AsyncCallback<void>): void;
/**
* Removes an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
removeOsAccount(localId: number): Promise<void>;
/**
* Sets constraints for an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { Array<string> } constraints - Indicates the constraints to set for the OS account. The value can be:
* <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point.
* <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages.
* <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls.
* <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications
* <br> from unknown sources.
* @param { boolean } enable - Specifies whether to enable the constraint.
* @param { AsyncCallback<void> } callback - Indicates the callback for setting the specified OS account constraints.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId or constraints.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
setOsAccountConstraints(
localId: number,
constraints: Array<string>,
enable: boolean,
callback: AsyncCallback<void>
): void;
/**
* Sets constraints for an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { Array<string> } constraints - Indicates the constraints to set for the OS account. The value can be:
* <br> {@code constraint.wifi.set} - Indicates the constraint on configuring the Wi-Fi access point.
* <br> {@code constraint.sms.use} - Indicates the constraint on sending and receiving short messages.
* <br> {@code constraint.calls.outgoing} - Indicates the constraint on making calls.
* <br> {@code constraint.unknown.sources.install} - Indicates the constraint on installing applications
* <br> from unknown sources.
* @param { boolean } enable - Specifies whether to enable the constraint.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId or constraints.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
setOsAccountConstraints(localId: number, constraints: Array<string>, enable: boolean): Promise<void>;
/**
* Sets the local name for an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } localName - Indicates the local name to set for the OS account.
* @param { AsyncCallback<void> } callback - Indicates the callback for setting the specified OS account name.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId or localName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
setOsAccountName(localId: number, localName: string, callback: AsyncCallback<void>): void;
/**
* Sets the local name for an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } localName - Indicates the local name to set for the OS account.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId or localName.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
setOsAccountName(localId: number, localName: string): Promise<void>;
/**
* Gets the name of the OS account to which the caller belongs.
*
* @returns { Promise<string> } The promise returned by the function.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 12
*/
getOsAccountName(): Promise<string>;
/**
* Obtains the number of all OS accounts created on a device.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { AsyncCallback<number> } callback - Returns the number of created OS accounts.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountCount
*/
getCreatedOsAccountsCount(callback: AsyncCallback<number>): void;
/**
* Obtains the number of all OS accounts created on a device.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @returns { Promise<number> } Returns the number of created OS accounts.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountCount
*/
getCreatedOsAccountsCount(): Promise<number>;
/**
* Obtains the number of all OS accounts created on a device.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { AsyncCallback<number> } callback - Returns the number of created OS accounts.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* This API can be called only by system applications.
* @since 9
*/
getOsAccountCount(callback: AsyncCallback<number>): void;
/**
* Obtains the number of all OS accounts created on a device.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @returns { Promise<number> } Returns the number of created OS accounts.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* This API can be called only by system applications.
* @since 9
*/
getOsAccountCount(): Promise<number>;
/**
* Obtains the local ID of an OS account from the current process UID.
*
* @param { AsyncCallback<number> } callback - Returns the local ID of the OS account.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountLocalId
*/
getOsAccountLocalIdFromProcess(callback: AsyncCallback<number>): void;
/**
* Obtains the local ID of an OS account from the current process UID.
*
* @returns { Promise<number> } Returns the local ID of the OS account.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountLocalId
*/
getOsAccountLocalIdFromProcess(): Promise<number>;
/**
* Gets the local ID of the current OS account.
*
* @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the current OS account.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getOsAccountLocalId(callback: AsyncCallback<number>): void;
/**
* Get the local ID of the current OS account.
*
* @returns { Promise<number> } Returns the local ID of the current account.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getOsAccountLocalId(): Promise<number>;
/**
* Gets the local ID of an OS account from the process UID
*
* @param { number } uid - Indicates the process UID.
* @param { AsyncCallback<number> } callback - Returns the local ID of the OS account.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountLocalIdForUid
*/
getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback<number>): void;
/**
* Gets the local ID of an OS account from the process UID
*
* @param { number } uid - Indicates the process UID.
* @returns { Promise<number> } Returns the local ID of the OS account.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountLocalIdForUid
*/
getOsAccountLocalIdFromUid(uid: number): Promise<number>;
/**
* Gets the local ID of the OS account associated with the specified UID.
*
* @param { number } uid - Indicates the process UID.
* @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the OS account associated with the specified UID.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid uid.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback<number>): void;
/**
* Get the local ID of the OS account associated with the specified UID.
*
* @param { number } uid - Indicates the process UID.
* @returns { Promise<number> } - Returns the local ID of the OS account associated with the specified UID.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid uid.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getOsAccountLocalIdForUid(uid: number): Promise<number>;
/**
* Gets the local ID of the OS account associated with the specified UID synchronously.
*
* @param { number } uid - Indicates the process UID.
* @returns { number } Returns the local ID of the OS account associated with the specified UID.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300002 - Invalid uid.
* @syscap SystemCapability.Account.OsAccount
* @since 10
*/
getOsAccountLocalIdForUidSync(uid: number): number;
/**
* Queries the local ID of an OS account which is bound to the specified domain account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { DomainAccountInfo } domainInfo - Indicates the domain account info.
* @param { AsyncCallback<number> } callback - Returns the local ID of the OS account.
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountLocalIdForDomain
*/
getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void;
/**
* Queries the local ID of an OS account which is bound to the specified domain account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { DomainAccountInfo } domainInfo - Indicates the domain account info.
* @returns { Promise<number> } Returns the local ID of the OS account.
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountLocalIdForDomain
*/
getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<number>;
/**
* Gets the local ID of the OS account associated with the specified domain account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { DomainAccountInfo } domainInfo - Indicates the domain account info.
* @param { AsyncCallback<number> } callback - Indicates the callback for
* getting the local ID of the OS account associated with the specified domain account.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid domainInfo.
* @syscap SystemCapability.Account.OsAccount
* This API can be called only by system applications.
* @since 9
*/
getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void;
/**
* Gets the local ID of the OS account associated with the specified domain account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { DomainAccountInfo } domainInfo - Indicates the domain account info.
* @returns { Promise<number> } Returns the local ID of the OS account associated with the specified domain account.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid domainInfo.
* @syscap SystemCapability.Account.OsAccount
* This API can be called only by system applications.
* @since 9
*/
getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number>;
/**
* Queries the maximum number of OS accounts that can be created on a device.
*
* @param { AsyncCallback<number> } callback - Returns the maximum number of OS accounts that can be created.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
queryMaxOsAccountNumber(callback: AsyncCallback<number>): void;
/**
* Queries the maximum number of OS accounts that can be created on a device.
*
* @returns { Promise<number> } Returns the maximum number of OS accounts that can be created.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
queryMaxOsAccountNumber(): Promise<number>;
/**
* Queries the maximum number of OS accounts that can be logged in.
*
* @returns { Promise<number> } Returns the maximum number of OS accounts that can be logged in.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
queryMaxLoggedInOsAccountNumber(): Promise<number>;
/**
* Obtains all constraints of an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<Array<string>> } callback - Returns a list of constraints.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountConstraints
*/
getOsAccountAllConstraints(localId: number, callback: AsyncCallback<Array<string>>): void;
/**
* Obtains all constraints of an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<Array<string>> } Returns a list of constraints.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountConstraints
*/
getOsAccountAllConstraints(localId: number): Promise<Array<string>>;
/**
* Obtains all constraints of an account based on its ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<Array<string>> } callback - Returns a list of constraints.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @since 9
* @deprecated since 11
*/
getOsAccountConstraints(localId: number, callback: AsyncCallback<Array<string>>): void;
/**
* Obtains all constraints of an account based on its ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<Array<string>> } Returns a list of constraints.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @since 9
* @deprecated since 11
*/
getOsAccountConstraints(localId: number): Promise<Array<string>>;
/**
* Gets all enabled constraints of the specified OS account by its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<Array<string>> } Returns a list of constraints.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 11
*/
getEnabledOsAccountConstraints(localId: number): Promise<Array<string>>;
/**
* Queries the list of all the OS accounts that have been created in the system.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { AsyncCallback<Array<OsAccountInfo>> } callback - Returns a list of OS accounts.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
queryAllCreatedOsAccounts(callback: AsyncCallback<Array<OsAccountInfo>>): void;
/**
* Queries the list of all the OS accounts that have been created in the system.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @returns { Promise<Array<OsAccountInfo>> } Returns a list of OS accounts.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
queryAllCreatedOsAccounts(): Promise<Array<OsAccountInfo>>;
/**
* Queries the id list of all activated OS accounts.
*
* @param { AsyncCallback<Array<number>> } callback - Returns a id list of OS accounts.
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getActivatedOsAccountLocalIds
*/
queryActivatedOsAccountIds(callback: AsyncCallback<Array<number>>): void;
/**
* Queries the id list of all activated OS accounts.
*
* @returns { Promise<Array<number>> } Returns a id list of OS accounts.
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getActivatedOsAccountLocalIds
*/
queryActivatedOsAccountIds(): Promise<Array<number>>;
/**
* Gets the local IDs of all activated OS accounts.
*
* @param { AsyncCallback<Array<number>> } callback - Indicates the callback for getting the local IDs of all activated OS accounts.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getActivatedOsAccountLocalIds(callback: AsyncCallback<Array<number>>): void;
/**
* Gets the local IDs of all activated OS accounts.
*
* @returns { Promise<Array<number>> } Returns all activated accounts.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getActivatedOsAccountLocalIds(): Promise<Array<number>>;
/**
* Gets the local ID of the foreground OS account.
*
* @returns { Promise<number> } Returns local ID of the foreground OS account.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
getForegroundOsAccountLocalId(): Promise<number>;
/**
* Creates an OS account using the local name and account type.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { string } localName - Indicates the local name of the OS account to create.
* @param { OsAccountType } type - Indicates the type of the OS account to create.
* {@link OsAccountType} specifies the account types available in the system.
* @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the created OS account; returns {@code null} if the creation fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localName or type.
* @throws { BusinessError } 12300005 - Multi-user not supported.
* @throws { BusinessError } 12300006 - Unsupported account type.
* @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
/**
* Creates an OS account with the specified local name and type.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { string } localName - Indicates the local name of the OS account to create.
* @param { OsAccountType } type - Indicates the type of the OS account to create.
* {@link OsAccountType} specifies the account types available in the system.
* @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the created OS account; returns {@code null} if the creation fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localName or type.
* @throws { BusinessError } 12300004 - Local name already exists.
* @throws { BusinessError } 12300005 - Multi-user not supported.
* @throws { BusinessError } 12300006 - Unsupported account type.
* @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback<OsAccountInfo>): void;
/**
* Creates an OS account using the local name and account type.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { string } localName - Indicates the local name of the OS account to create.
* @param { OsAccountType } type - Indicates the type of the OS account to create.
* {@link OsAccountType} specifies the account types available in the system.
* @returns { Promise<OsAccountInfo> } Returns information about the created OS account; returns {@code null} if the creation fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localName or type.
* @throws { BusinessError } 12300005 - Multi-user not supported.
* @throws { BusinessError } 12300006 - Unsupported account type.
* @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
/**
* Creates an OS account with the specified local name, type and options.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { string } localName - Indicates the local name of the OS account to create.
* @param { OsAccountType } type - Indicates the type of the OS account to create.
* {@link OsAccountType} specifies the account types available in the system.
* @param { CreateOsAccountOptions } [options] - Indicates the options for creating an OS account.
* @returns { Promise<OsAccountInfo> } Returns information about the created OS account; returns {@code null} if the creation fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localName, type or options.
* @throws { BusinessError } 12300004 - Local name already exists.
* @throws { BusinessError } 12300005 - Multi-user not supported.
* @throws { BusinessError } 12300006 - Unsupported account type.
* @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit.
* @throws { BusinessError } 12300015 - The short name already exists.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
createOsAccount(localName: string, type: OsAccountType, options?: CreateOsAccountOptions): Promise<OsAccountInfo>;
/**
* Creates an OS account using the account type and domain account info.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { OsAccountType } type - Indicates the type of the OS account to create.
* {@link OsAccountType} specifies the account types available in the system.
* @param { DomainAccountInfo } domainInfo - Indicates the domain account info.
* @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the created OS account; returns {@code null} if the creation fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid type or domainInfo.
* @throws { BusinessError } 12300004 - Account already exists.
* @throws { BusinessError } 12300005 - Multi-user not supported.
* @throws { BusinessError } 12300006 - Unsupported account type.
* @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
/**
* Creates an OS account using the account type and domain account info.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { OsAccountType } type - Indicates the type of the OS account to create.
* {@link OsAccountType} specifies the account types available in the system.
* @param { DomainAccountInfo } domainInfo - Indicates the domain account info.
* @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the created OS account; returns {@code null} if the creation fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid type or domainInfo.
* @throws { BusinessError } 12300004 - Account already exists.
* @throws { BusinessError } 12300005 - Multi-user not supported.
* @throws { BusinessError } 12300006 - Unsupported account type.
* @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
createOsAccountForDomain(
type: OsAccountType,
domainInfo: DomainAccountInfo,
callback: AsyncCallback<OsAccountInfo>
): void;
/**
* Creates an OS account using the account type and domain account info.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { OsAccountType } type - Indicates the type of the OS account to create.
* {@link OsAccountType} specifies the account types available in the system.
* @param { DomainAccountInfo } domainInfo - Indicates the domain account info.
* @returns { Promise<OsAccountInfo> } Returns information about the created OS account; returns {@code null} if the creation fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid type or domainInfo.
* @throws { BusinessError } 12300004 - Account already exists.
* @throws { BusinessError } 12300005 - Multi-user not supported.
* @throws { BusinessError } 12300006 - Unsupported account type.
* @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
/**
* Creates an OS account using the account type, domain account info and options.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { OsAccountType } type - Indicates the type of the OS account to create.
* {@link OsAccountType} specifies the account types available in the system.
* @param { DomainAccountInfo } domainInfo - Indicates the domain account info.
* @param { CreateOsAccountForDomainOptions } [options] - Indicates the options to create an OS account for domain.
* @returns { Promise<OsAccountInfo> } Returns information about the created OS account; returns {@code null} if the creation fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid type, domainInfo or options.
* @throws { BusinessError } 12300004 - Account already exists.
* @throws { BusinessError } 12300005 - Multi-user not supported.
* @throws { BusinessError } 12300006 - Unsupported account type.
* @throws { BusinessError } 12300007 - The number of accounts has reached the upper limit.
* @throws { BusinessError } 12300015 - The short name already exists.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, options?: CreateOsAccountForDomainOptions): Promise<OsAccountInfo>;
/**
* Queries information about the current OS account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the current OS account; returns {@code null} if the query fails.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#getCurrentOsAccount
*/
queryCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void;
/**
* Queries information about the current OS account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @returns { Promise<OsAccountInfo> } Returns information about the current OS account; returns {@code null} if the query fails.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#getCurrentOsAccount
*/
queryCurrentOsAccount(): Promise<OsAccountInfo>;
/**
* Gets information about the current OS account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the current OS account; returns {@code null} if the query fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
* @deprecated since 11
*/
/**
* Gets information about the current OS account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS
* @param { AsyncCallback<OsAccountInfo> } callback - Returns information about the current OS account; returns {@code null} if the query fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 10
* @deprecated since 11
*/
getCurrentOsAccount(callback: AsyncCallback<OsAccountInfo>): void;
/**
* Gets information about the current OS account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @returns { Promise<OsAccountInfo> } Returns information about the current OS account; returns {@code null} if the query fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
* @deprecated since 11
*/
/**
* Gets information about the current OS account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS
* @returns { Promise<OsAccountInfo> } Returns information about the current OS account; returns {@code null} if the query fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 10
* @deprecated since 11
*/
getCurrentOsAccount(): Promise<OsAccountInfo>;
/**
* Queries the current OS account information.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.GET_LOCAL_ACCOUNTS
* @returns { Promise<OsAccountInfo> } Returns information about the current OS account
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 11
*/
queryOsAccount(): Promise<OsAccountInfo>;
/**
* Queries OS account information based on the local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<OsAccountInfo> } callback - Returns the OS account information; returns {@code null} if the query fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
queryOsAccountById(localId: number, callback: AsyncCallback<OsAccountInfo>): void;
/**
* Queries OS account information based on the local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<OsAccountInfo> } Returns the OS account information; returns {@code null} if the query fails.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
queryOsAccountById(localId: number): Promise<OsAccountInfo>;
/**
* Obtains the type of this OS account from the current process.
*
* @param { AsyncCallback<OsAccountType> } callback - Returns the OS account type. The value can be {@link OsAccountType#ADMIN},
* {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountType
*/
getOsAccountTypeFromProcess(callback: AsyncCallback<OsAccountType>): void;
/**
* Obtains the type of this OS account from the current process.
*
* @returns { Promise<OsAccountType> } Returns the OS account type. The value can be {@link OsAccountType#ADMIN},
* {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountType
*/
getOsAccountTypeFromProcess(): Promise<OsAccountType>;
/**
* Obtains the type of this OS account from the current process.
*
* @param { AsyncCallback<OsAccountType> } callback - Returns the OS account type. The value can be {@link OsAccountType#ADMIN},
* {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getOsAccountType(callback: AsyncCallback<OsAccountType>): void;
/**
* Obtains the type of this OS account from the current process.
*
* @returns { Promise<OsAccountType> } Returns the OS account type. The value can be {@link OsAccountType#ADMIN},
* {@link OsAccountType#NORMAL}, and {@link OsAccountType#GUEST}.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getOsAccountType(): Promise<OsAccountType>;
/**
* Gets the type of the specified OS account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<OsAccountType> } Returns the OS account type.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
getOsAccountType(localId: number): Promise<OsAccountType>;
/**
* Obtains the distributed virtual device ID (DVID).
* <p>
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs.
* The same application running on different devices obtains the same DVID, whereas different applications
* obtain different DVIDs.
* <p>
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { AsyncCallback<string> } callback - Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#queryDistributedVirtualDeviceId
*/
getDistributedVirtualDeviceId(callback: AsyncCallback<string>): void;
/**
* Obtains the distributed virtual device ID (DVID).
* <p>
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs.
* The same application running on different devices obtains the same DVID, whereas different applications
* obtain different DVIDs.
* <p>
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @returns { Promise<string> } Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
* @syscap SystemCapability.Account.OsAccount
* @since 7
* @deprecated since 9
* @useinstead osAccount.AccountManager#queryDistributedVirtualDeviceId
*/
getDistributedVirtualDeviceId(): Promise<string>;
/**
* Queries the distributed virtual device ID (DVID).
* <p>
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs.
* The same application running on different devices obtains the same DVID, whereas different applications
* obtain different DVIDs.
* <p>
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { AsyncCallback<string> } callback - Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
queryDistributedVirtualDeviceId(callback: AsyncCallback<string>): void;
/**
* Queries the distributed virtual device ID (DVID).
* <p>
* If the same OHOS account has logged in to multiple devices, these devices constitute a super device
* through the distributed networking. On the connected devices, you can call this method to obtain the DVIDs.
* The same application running on different devices obtains the same DVID, whereas different applications
* obtain different DVIDs.
* <p>
*
* @permission ohos.permission.DISTRIBUTED_DATASYNC or ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @returns { Promise<string> } Returns the DVID if obtained; returns an empty string if no OHOS account has logged in.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
queryDistributedVirtualDeviceId(): Promise<string>;
/**
* Obtains the profile photo of an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<string> } callback - Returns the profile photo if obtained;
* returns {@code null} if the profile photo fails to be obtained.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
getOsAccountProfilePhoto(localId: number, callback: AsyncCallback<string>): void;
/**
* Obtains the profile photo of an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<string> } Returns the profile photo if obtained;
* returns {@code null} if the profile photo fails to be obtained.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
getOsAccountProfilePhoto(localId: number): Promise<string>;
/**
* Sets the profile photo for an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } photo - Indicates the profile photo to set for the OS account.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId or photo.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback<void>): void;
/**
* Sets the profile photo for an OS account based on its local ID.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } photo - Indicates the profile photo to set for the OS account.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId or photo.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted Account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
setOsAccountProfilePhoto(localId: number, photo: string): Promise<void>;
/**
* Obtain localId according to serial number
*
* @param { number } serialNumber - Indicates serial number.
* @param { AsyncCallback<number> } callback - Returns localId.
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountLocalIdForSerialNumber
*/
getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback<number>): void;
/**
* Obtain localId according to serial number
*
* @param { number } serialNumber - Indicates serial number.
* @returns { Promise<number> } Returns localId.
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getOsAccountLocalIdForSerialNumber
*/
getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number>;
/**
* Gets the local ID of the OS account associated with the serial number.
*
* @param { number } serialNumber - Indicates serial number.
* @param { AsyncCallback<number> } callback - Indicates the callback for getting the local ID of the OS account associated with the serial number.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid serialNumber.
* @throws { BusinessError } 12300003 - The account indicated by serialNumber dose not exist.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback<number>): void;
/**
* Gets the local ID of the OS account associated with the serial number.
*
* @param { number } serialNumber - Indicates serial number.
* @returns { Promise<number> } Returns the local ID of the OS account associated with the serial number.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid serialNumber.
* @throws { BusinessError } 12300003 - The account indicated by serialNumber dose not exist.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise<number>;
/**
* Obtain serial number according to localId.
*
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<number> } callback - Returns serial number.
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getSerialNumberForOsAccountLocalId
*/
getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void;
/**
* Obtain serial number according to localId.
*
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<number> } Returns serial number.
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 9
* @useinstead osAccount.AccountManager#getSerialNumberForOsAccountLocalId
*/
getSerialNumberByOsAccountLocalId(localId: number): Promise<number>;
/**
* Gets the serial number for the specified os account local id.
*
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<number> } callback - Indicates the callback for getting the serial number for the specified os account local id.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void;
/**
* Gets the serial number for the specified os account local id.
*
* @param { number } localId - Indicates the local ID of the OS account.
* @returns { Promise<number> } Returns the serial number according to local ID.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @since 9
*/
getSerialNumberForOsAccountLocalId(localId: number): Promise<number>;
/**
* Subscribes to the change events of accounts.
* <p>
* When user change the account, the subscriber will receive a notification
* about the account change event.
*
* @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
* @param { 'activate' | 'activating' } type - Event type.
* @param { string } name - Indicates the name of subscriber.
* @param { Callback<number> } callback - Asynchronous callback interface.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid type or name.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
on(type: 'activate' | 'activating', name: string, callback: Callback<number>): void;
/**
* Unsubscribes from account events.
*
* @permission ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
* @param { 'activate' | 'activating' } type - Event type.
* @param { string } name - Indicates the name of subscriber.
* @param { Callback<number> } callback - Asynchronous callback interface.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid type or name.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 7
*/
off(type: 'activate' | 'activating', name: string, callback?: Callback<number>): void;
/**
* Subscribes to the OS account switching event.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { 'switching' } type - Indicates the event type.
* @param { Callback<OsAccountSwitchEventData> } callback - Indicates the callback for getting the event data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid type.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
on(type: 'switching', callback: Callback<OsAccountSwitchEventData>): void;
/**
* Unsubscribes from the OS account switching event.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { 'switching' } type - Indicates the event type.
* @param { Callback<OsAccountSwitchEventData> } [callback] - Indicates the callback for getting the event data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid type.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
off(type: 'switching', callback?: Callback<OsAccountSwitchEventData>): void;
/**
* Subscribes to the OS account switched event.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { 'switched' } type - Indicates the event type.
* @param { Callback<OsAccountSwitchEventData> } callback - Indicates the callback for getting the event data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid type.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
on(type: 'switched', callback: Callback<OsAccountSwitchEventData>): void;
/**
* Unsubscribes from the OS account switched event.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { 'switched' } type - Indicates the event type.
* @param { Callback<OsAccountSwitchEventData> } [callback] - Indicates the callback for getting the event data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid type.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
off(type: 'switched', callback?: Callback<OsAccountSwitchEventData>): void;
/**
* Gets the bundle ID associated with the specified UID.
*
* @param { number } uid - Indicates the target uid.
* @param { AsyncCallback<number> } callback - Indicates the callback for getting the bundle ID associated with the specified UID.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid uid.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
getBundleIdForUid(uid: number, callback: AsyncCallback<number>): void;
/**
* Gets the bundle ID associated with the specified UID.
*
* @param { number } uid - Indicates the target uid.
* @returns { Promise<number> } Returns the bundle ID associated with the specified UID.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid uid.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
getBundleIdForUid(uid: number): Promise<number>;
/**
* Gets the bundle ID associated with the specified UID synchronously.
*
* @param { number } uid - Indicates the target uid.
* @returns { number } Returns the bundle ID associated with the specified UID.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300002 - Invalid uid.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
getBundleIdForUidSync(uid: number): number;
/**
* Check whether current process belongs to the main account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { AsyncCallback<boolean> } callback - Returns {@code true} if current process belongs to the main os account;
* returns {@code false} otherwise.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
isMainOsAccount(callback: AsyncCallback<boolean>): void;
/**
* Check whether current process belongs to the main account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @returns { Promise<boolean> } Returns {@code true} if current process belongs to the main os account;
* returns {@code false} otherwise.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
isMainOsAccount(): Promise<boolean>;
/**
* Gets a list of constraint source types for the specified os account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } constraint - Indicates the constraint to query the source type.
* @param { AsyncCallback<Array<ConstraintSourceTypeInfo>> } callback - Indicates the callback for
* getting a list of constraint source types for the specified os account.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid name or constraint.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
getOsAccountConstraintSourceTypes(
localId: number,
constraint: string,
callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>
): void;
/**
* Gets a list of constraint source types for the specified os account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { number } localId - Indicates the local ID of the OS account.
* @param { string } constraint - Indicates the constraint to query the source type.
* @returns { Promise<Array<ConstraintSourceTypeInfo>> } Returns a list of constraint source types for the specified os account.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid name or constraint.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>;
}
/**
* Provides information about OS accounts, including the local ID, local name, and type of an OS account.
*
* @interface OsAccountInfo
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
interface OsAccountInfo {
/**
* The local ID of an OS account.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
localId: number;
/**
* The local name of an OS account.
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
localName: string;
/**
* The short name of an OS account.
*
* @type { ?string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
shortName?: string;
/**
* Include: ADMIN, Normal, GUEST.
*
* @type { OsAccountType }
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
type: OsAccountType;
/**
* Account constraints information.
*
* @type { Array<string> }
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
constraints: Array<string>;
/**
* The account is verified or not.
*
* @type { boolean }
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 11
* @useinstead osAccount.OsAccountInfo#isUnlocked
*/
isVerified: boolean;
/**
* The OS account is unlocked or not.
*
* @type { boolean }
* @syscap SystemCapability.Account.OsAccount
* @since 11
*/
isUnlocked: boolean;
/**
* OS account photo.
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
photo: string;
/**
* Os account create time.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
createTime: number;
/**
* The last time to log in.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
lastLoginTime: number;
/**
* Os account serial number.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
serialNumber: number;
/**
* Os account is activated or not.
*
* @type { boolean }
* @syscap SystemCapability.Account.OsAccount
* @since 8
* @deprecated since 11
* @useinstead osAccount.OsAccountInfo#isActivated
*/
isActived: boolean;
/**
* The OS account is activated or not.
*
* @type { boolean }
* @syscap SystemCapability.Account.OsAccount
* @since 11
*/
isActivated: boolean;
/**
* Indicates whether the OS account is logged in.
*
* @type { ?boolean }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
isLoggedIn?: boolean;
/**
* Os account create completed or not.
*
* @type { boolean }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
isCreateCompleted: boolean;
/**
* Distributed account info.
*
* @type { distributedAccount.DistributedInfo }
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
distributedInfo: distributedAccount.DistributedInfo;
/**
* Domain account info.
*
* @type { DomainAccountInfo }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
domainInfo: DomainAccountInfo;
}
/**
* Defines the switching/switched event data structure for the OS account.
*
* @typedef OsAccountSwitchEventData
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
interface OsAccountSwitchEventData {
/**
* Indicates which OS account to switch from.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
fromAccountId: number;
/**
* Indicates which OS account to switch to.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
toAccountId: number;
}
/**
* Options for creating an OS account.
*
* @interface CreateOsAccountOptions
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
interface CreateOsAccountOptions {
/**
* Indicates the short name of the OS account.
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
shortName: string;
}
/**
* Options to create an OS account for domain.
*
* @interface CreateOsAccountForDomainOptions
* @extends CreateOsAccountOptions
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
interface CreateOsAccountForDomainOptions extends CreateOsAccountOptions {}
/**
* Provides information about domain accounts.
*
* @interface DomainAccountInfo
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
interface DomainAccountInfo {
/**
* The domain name
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
domain: string;
/**
* The account name in the domain
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @since 8
*/
accountName: string;
/**
* The account identifier in the domain.
*
* @type { ?string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
accountId?: string;
/**
* Indicates whether the account is authenticated.
*
* @type { ?boolean }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 11
*/
isAuthenticated?: boolean;
/**
* Indicates the server config identifier for the domain to which the account belongs.
*
* @type { ?string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
serverConfigId?: string;
}
/**
* Enumerates OS account types.
*
* @enum { number } OsAccountType
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
enum OsAccountType {
/**
* Indicates the administrator account, which has the permission to manage other OS accounts.
*
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
ADMIN = 0,
/**
* Indicates a normal account, which has access to common functions of OS accounts.
*
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
NORMAL,
/**
* Indicates a guest account, which is used to temporarily access the device and may be deleted at any time.
*
* @syscap SystemCapability.Account.OsAccount
* @since 7
*/
GUEST,
/**
* Indicates a private account.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
PRIVATE = 1024
}
/**
* Provides the abilities for user authentication.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
* @name UserAuth
*/
class UserAuth {
/**
* Constructor to get the UserAuth class instance.
*
* @throws { BusinessError } 202 - Not system application.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
constructor();
/**
* Gets version information.
*
* @returns { number } Returns the version information.
* @throws { BusinessError } 202 - Not system application.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
getVersion(): number;
/**
* Checks whether the authentication capability is available.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { AuthType } authType - Indicates the credential type for authentication.
* @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result.
* @returns { number } Returns a status result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid authType or authTrustLevel.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number;
/**
* Gets the property based on the specified request information.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { GetPropertyRequest } request - Indicates the request information, including authentication type, and property type list.
* @param { AsyncCallback<ExecutorProperty> } callback - Returns an executor property.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid request.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
/**
* Gets the property based on the specified request information.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { GetPropertyRequest } request - Indicates the request information, including authentication type, and property type list.
* @param { AsyncCallback<ExecutorProperty> } callback - Returns an executor property.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid request.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
getProperty(request: GetPropertyRequest, callback: AsyncCallback<ExecutorProperty>): void;
/**
* Gets the property based on the specified request information.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { GetPropertyRequest } request - Indicates the request information, including authentication type, and property type list.
* @returns { Promise<ExecutorProperty> } Returns an executor property.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid request.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
/**
* Gets the property based on the specified request information.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { GetPropertyRequest } request - Indicates the request information, including authentication type, and property type list.
* @returns { Promise<ExecutorProperty> } Returns an executor property.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid request.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
getProperty(request: GetPropertyRequest): Promise<ExecutorProperty>;
/**
* Sets property that can be used to initialize algorithms.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { SetPropertyRequest } request - Indicates the request information, including authentication type and the key-value to be set.
* @param { AsyncCallback<void> } callback - Asynchronous callback interface.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid request.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
setProperty(request: SetPropertyRequest, callback: AsyncCallback<void>): void;
/**
* Sets property that can be used to initialize algorithms.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { SetPropertyRequest } request - Indicates the request information, including authentication type and the key-value to be set.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid request.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
setProperty(request: SetPropertyRequest): Promise<void>;
/**
* Prepares remote authentication.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { string } remoteNetworkId - Indicates the remote network identifier.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - System service exception.
* @throws { BusinessError } 12300002 - Invalid remoteNetworkId.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
prepareRemoteAuth(remoteNetworkId: string): Promise<void>;
/**
* Executes authentication.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { Uint8Array } challenge - Indicates the challenge value.
* @param { AuthType } authType - Indicates the authentication type.
* @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result.
* @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo.
* @returns { Uint8Array } Returns a context ID for cancellation.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid challenge, authType or authTrustLevel.
* @throws { BusinessError } 12300101 - The credential is incorrect.
* @throws { BusinessError } 12300102 - The credential does not exist.
* @throws { BusinessError } 12300105 - The trust level is not supported.
* @throws { BusinessError } 12300106 - The authentication type is not supported.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300110 - The authentication is locked.
* @throws { BusinessError } 12300111 - The authentication time out.
* @throws { BusinessError } 12300112 - The authentication service is busy.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
/**
* Executes authentication.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { Uint8Array } challenge - Indicates the challenge value.
* @param { AuthType } authType - Indicates the authentication type.
* @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result.
* @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo.
* @returns { Uint8Array } Returns a context ID for cancellation.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid challenge, authType or authTrustLevel.
* @throws { BusinessError } 12300101 - The credential is incorrect.
* @throws { BusinessError } 12300102 - The credential does not exist.
* @throws { BusinessError } 12300105 - The trust level is not supported.
* @throws { BusinessError } 12300106 - The authentication type is not supported.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300110 - The authentication is locked.
* @throws { BusinessError } 12300111 - The authentication time out.
* @throws { BusinessError } 12300112 - The authentication service is busy.
* @throws { BusinessError } 12300117 - PIN is expired.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
auth(
challenge: Uint8Array,
authType: AuthType,
authTrustLevel: AuthTrustLevel,
callback: IUserAuthCallback
): Uint8Array;
/**
* Executes authentication.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { Uint8Array } challenge - Indicates the challenge value.
* @param { AuthType } authType - Indicates the authentication type.
* @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result.
* @param { AuthOptions } options - Indicates authentication options.
* @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo.
* @returns { Uint8Array } Returns a context ID for cancellation.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid challenge, authType, authTrustLevel or options.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300101 - The credential is incorrect.
* @throws { BusinessError } 12300102 - The credential does not exist.
* @throws { BusinessError } 12300105 - The trust level is not supported.
* @throws { BusinessError } 12300106 - The authentication type is not supported.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300110 - The authentication is locked.
* @throws { BusinessError } 12300111 - The authentication time out.
* @throws { BusinessError } 12300112 - The authentication service is busy.
* @throws { BusinessError } 12300117 - PIN is expired.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
auth(
challenge: Uint8Array,
authType: AuthType,
authTrustLevel: AuthTrustLevel,
options: AuthOptions,
callback: IUserAuthCallback
): Uint8Array;
/**
* Executes user authentication.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { number } userId - Indicates the user identification.
* @param { Uint8Array } challenge - Indicates the challenge value.
* @param { AuthType } authType - Indicates the authentication type.
* @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result.
* @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo.
* @returns { Uint8Array } Returns a context ID for cancellation.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid userId, challenge, authType or authTrustLevel.
* @throws { BusinessError } 12300101 - The credential is incorrect.
* @throws { BusinessError } 12300102 - The credential does not exist.
* @throws { BusinessError } 12300105 - The trust level is not supported.
* @throws { BusinessError } 12300106 - The authentication type is not supported.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300110 - The authentication is locked.
* @throws { BusinessError } 12300111 - The authentication time out.
* @throws { BusinessError } 12300112 - The authentication service is busy.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
/**
* Executes user authentication.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { number } userId - Indicates the user identification.
* @param { Uint8Array } challenge - Indicates the challenge value.
* @param { AuthType } authType - Indicates the authentication type.
* @param { AuthTrustLevel } authTrustLevel - Indicates the trust level of authentication result.
* @param { IUserAuthCallback } callback - Indicates the callback to get result and acquireInfo.
* @returns { Uint8Array } Returns a context ID for cancellation.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid challenge, authType or authTrustLevel.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300101 - The credential is incorrect.
* @throws { BusinessError } 12300102 - The credential does not exist.
* @throws { BusinessError } 12300105 - The trust level is not supported.
* @throws { BusinessError } 12300106 - The authentication type is not supported.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300110 - The authentication is locked.
* @throws { BusinessError } 12300111 - The authentication time out.
* @throws { BusinessError } 12300112 - The authentication service is busy.
* @throws { BusinessError } 12300117 - PIN is expired.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
authUser(
userId: number,
challenge: Uint8Array,
authType: AuthType,
authTrustLevel: AuthTrustLevel,
callback: IUserAuthCallback
): Uint8Array;
/**
* Cancels authentication with context ID.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { Uint8Array } contextID - Indicates the authentication context ID.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid contextId.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
cancelAuth(contextID: Uint8Array): void;
}
/**
* Provides the abilities for Pin code authentication.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
* @name PINAuth
*/
class PINAuth {
/**
* Constructor to get the PINAuth class instance.
*
* @throws { BusinessError } 202 - Not system application.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
constructor();
/**
* Register inputer.
*
* @permission ohos.permission.ACCESS_PIN_AUTH
* @param { IInputer } inputer - Indicates the password input box callback
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid inputer.
* @throws { BusinessError } 12300103 - The credential inputer already exists.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
registerInputer(inputer: IInputer): void;
/**
* Unregister inputer.
*
* @permission ohos.permission.ACCESS_PIN_AUTH
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
unregisterInputer(): void;
}
/**
* Provides the management of credential inputers.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
* @name InputerManager
*/
class InputerManager {
/**
* Register credential inputer by authentication type.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM
* @param { AuthType } authType - Indicates the authentication type.
* @param { IInputer } inputer - Indicates the credential input box callback.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid authType or inputer.
* @throws { BusinessError } 12300103 - The credential inputer already exists.
* @throws { BusinessError } 12300106 - The authentication type is not supported.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
static registerInputer(authType: AuthType, inputer: IInputer): void;
/**
* Unregister credential inputer by authentication type.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL or ohos.permission.MANAGE_USER_IDM
* @param { AuthType } authType - Indicates the authentication type.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300002 - Invalid authType.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
static unregisterInputer(authType: AuthType): void;
}
/**
* Provides the AuthStatusInfo type.
*
* @interface AuthStatusInfo
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
interface AuthStatusInfo {
/**
* Indicates the remaining times that authentication can be performed.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
remainTimes: number;
/**
* Indicates the freezing time before performing the next authentication.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
freezingTime: number;
}
/**
* Provides the GetDomainAccessTokenOptions type.
*
* @typedef GetDomainAccessTokenOptions
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
interface GetDomainAccessTokenOptions {
/**
* Indicates the domain account information.
*
* @type { DomainAccountInfo }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
domainAccountInfo: DomainAccountInfo;
/**
* Indicates the domain account token.
*
* @type { Uint8Array }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
domainAccountToken: Uint8Array;
/**
* Indicates the business parameters.
*
* @type { Record<string, Object> }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
businessParams: Record<string, Object>;
/**
* Indicates caller UID.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
callerUid: number;
}
/**
* Options for getting domain account information.
*
* @typedef GetDomainAccountInfoOptions
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
interface GetDomainAccountInfoOptions {
/**
* Indicates the account name.
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
accountName: string;
/**
* Indicates the domain to which the account belongs.
*
* @type { ?string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
domain?: string;
/**
* Indicates the server config identifier for the domain to which the account belongs.
*
* @type { ?string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
serverConfigId?: string;
}
/**
* Options for getting domain account information in the domain plugin.
*
* @typedef GetDomainAccountInfoPluginOptions
* @extends GetDomainAccountInfoOptions
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
interface GetDomainAccountInfoPluginOptions extends GetDomainAccountInfoOptions {
/**
* Indicates the caller UID.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
callerUid: number;
}
/**
* Provides the definition of domain plugin.
*
* @interface DomainPlugin
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
interface DomainPlugin {
/**
* Authenticates the specified domain account.
*
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication.
* @param { Uint8Array } credential - Indicates the credential for authentication.
* @param { IUserAuthCallback } callback - Indicates the authentication callback.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void;
/**
* Authenticates the specified domain account with a popup.
*
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication.
* @param { IUserAuthCallback } callback - Indicates the callback for notifying the authentication result.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
authWithPopup(domainAccountInfo: DomainAccountInfo, callback: IUserAuthCallback): void;
/**
* Authenticates the specified domain account with an authorization token.
*
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication.
* @param { Uint8Array } token - Indicates the authorization token generated when PIN or biometric authentication is successful.
* @param { IUserAuthCallback } callback - Indicates the callback for notifying the authentication result.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: IUserAuthCallback): void;
/**
* Gets the domain account information with the specified options.
*
* @param { GetDomainAccountInfoPluginOptions } options - Indicates the options for getting domain account information.
* @param { AsyncCallback<DomainAccountInfo> } callback - Indicates the callback for notifying the domain account information.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
getAccountInfo(options: GetDomainAccountInfoPluginOptions, callback: AsyncCallback<DomainAccountInfo>): void;
/**
* Gets the domain authentication property for the specified domain account.
*
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information for authentication.
* @param { AsyncCallback<AuthStatusInfo> } callback - Indicates the callback for notifying the domain authentication status information.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<AuthStatusInfo>): void;
/**
* Binds the specified domain account with an OS account.
*
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information.
* @param { number } localId - Indicates the local ID of the OS account.
* @param { AsyncCallback<void> } callback - Indicates the callback for notifying the binding result.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: AsyncCallback<void>): void;
/**
* Unbind the specified domain account.
*
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information.
* @param { AsyncCallback<void> } callback - Indicates the callback for notifying the unbinding result.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<void>): void;
/**
* Checks whether the token of specified domain account is valid.
*
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information.
* @param { Uint8Array } token - Indicates the account token.
* @param { AsyncCallback<boolean> } callback - Indicates the callback for notifying the checking result.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
isAccountTokenValid(
domainAccountInfo: DomainAccountInfo,
token: Uint8Array,
callback: AsyncCallback<boolean>
): void;
/**
* Gets the access token based on the specified options.
*
* @param { GetDomainAccessTokenOptions } options - Indicates the options for getting th access token.
* @param { AsyncCallback<Uint8Array> } callback - Indicates the callback for returning the access token.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>): void;
}
/**
* Provides abilities for the management of domain account.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
class DomainAccountManager {
/**
* Registers the domain plugin, which provides the capabilities for domain authentication.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { DomainPlugin } plugin - Indicates the domain plugin.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300201 - The domain plugin has been registered.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
static registerPlugin(plugin: DomainPlugin): void;
/**
* Unregisters domain plugin.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
static unregisterPlugin(): void;
/**
* Authenticates the specified domain account with a credential.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information.
* @param { Uint8Array } credential - Indicates the credential for authentication.
* @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid domainAccountInfo or credential.
* @throws { BusinessError } 12300003 - Domain account does not exist.
* @throws { BusinessError } 12300013 - Network exception.
* @throws { BusinessError } 12300101 - Authentication failed.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300110 - The authentication is locked.
* @throws { BusinessError } 12300111 - The authentication time out.
* @throws { BusinessError } 12300112 - The authentication service is busy.
* @throws { BusinessError } 12300113 - The account authentication service does not exist.
* @throws { BusinessError } 12300114 - The account authentication service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
static auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void;
/**
* Authenticates the domain account bound to the current OS account with a popup.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - No domain account is bound.
* @throws { BusinessError } 12300013 - Network exception.
* @throws { BusinessError } 12300101 - Authentication failed.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300110 - The authentication is locked.
* @throws { BusinessError } 12300111 - The authentication time out.
* @throws { BusinessError } 12300112 - The authentication service is busy.
* @throws { BusinessError } 12300113 - The account authentication service does not exist.
* @throws { BusinessError } 12300114 - The account authentication service works abnormally.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
/**
* Authenticates the domain account bound to the current OS account with a popup.
*
* @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - No domain account is bound.
* @throws { BusinessError } 12300013 - Network exception.
* @throws { BusinessError } 12300101 - Authentication failed.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300110 - The authentication is locked.
* @throws { BusinessError } 12300111 - The authentication time out.
* @throws { BusinessError } 12300112 - The authentication service is busy.
* @throws { BusinessError } 12300113 - The account authentication service does not exist.
* @throws { BusinessError } 12300114 - The account authentication service works abnormally.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 11
*/
static authWithPopup(callback: IUserAuthCallback): void;
/**
* Authenticates the domain account bound to the specified OS account with a popup.
*
* @permission ohos.permission.ACCESS_USER_AUTH_INTERNAL
* @param { number } localId - Indicates the local ID of the specified OS account.
* @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - No domain account is bound.
* @throws { BusinessError } 12300013 - Network exception.
* @throws { BusinessError } 12300101 - Authentication failed.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300110 - The authentication is locked.
* @throws { BusinessError } 12300111 - The authentication time out.
* @throws { BusinessError } 12300112 - The authentication service is busy.
* @throws { BusinessError } 12300113 - The account authentication service does not exist.
* @throws { BusinessError } 12300114 - The account authentication service works abnormally.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
/**
* Authenticates the domain account bound to the specified OS account with a popup.
*
* @param { number } localId - Indicates the local ID of the specified OS account.
* @param { IUserAuthCallback } callback - Indicates the callback for getting the authentication result.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid localId.
* @throws { BusinessError } 12300003 - No domain account is bound.
* @throws { BusinessError } 12300013 - Network exception.
* @throws { BusinessError } 12300101 - Authentication failed.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300110 - The authentication is locked.
* @throws { BusinessError } 12300111 - The authentication time out.
* @throws { BusinessError } 12300112 - The authentication service is busy.
* @throws { BusinessError } 12300113 - The account authentication service does not exist.
* @throws { BusinessError } 12300114 - The account authentication service works abnormally.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 11
*/
static authWithPopup(localId: number, callback: IUserAuthCallback): void;
/**
* Checks whether the specified domain account exists.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information.
* @param { AsyncCallback<boolean> } callback Indicates - The callback for checking whether the specified domain account exists.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid domainAccountInfo.
* @throws { BusinessError } 12300013 - Network exception.
* @throws { BusinessError } 12300111 - The operation time out.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
static hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<boolean>): void;
/**
* Checks whether the specified domain account exists.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information.
* @returns { Promise<boolean> } Returns whether the specified domain account exists.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid domainAccountInfo.
* @throws { BusinessError } 12300013 - Network exception.
* @throws { BusinessError } 12300111 - The operation time out.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
static hasAccount(domainAccountInfo: DomainAccountInfo): Promise<boolean>;
/**
* Updates the token for the specified domain account.
* <p>Only the registered domain plugin has the permission to call this function.<br/>
* An empty token indicates the token of the target domain account is invalid.</p>
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information.
* @param { Uint8Array } token - Indicates the domain account token.
* @param { AsyncCallback<void> } callback - Indicates the result callback.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid token.
* @throws { BusinessError } 12300003 - Account not found.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
static updateAccountToken(
domainAccountInfo: DomainAccountInfo,
token: Uint8Array,
callback: AsyncCallback<void>
): void;
/**
* Updates the token for the specified domain account.
* <p>Only the registered domain plugin has the permission to call this function.<br/>
* An empty token indicates the token of the target domain account is invalid.</p>
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information.
* @param { Uint8Array } token - Indicates the domain account token.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid token.
* @throws { BusinessError } 12300003 - Account not found.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
static updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Promise<void>;
/**
* Updates the information of the specified domain account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { DomainAccountInfo } oldAccountInfo - Indicates the old domain account information.
* @param { DomainAccountInfo } newAccountInfo - Indicates the new domain account information.
* @returns { Promise<void> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - The new account info is invalid.
* @throws { BusinessError } 12300003 - The old account not found.
* @throws { BusinessError } 12300004 - The new account already exists.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
static updateAccountInfo(oldAccountInfo: DomainAccountInfo, newAccountInfo: DomainAccountInfo): Promise<void>;
/**
* Gets the specified domain account information.
*
* @permission ohos.permission.GET_DOMAIN_ACCOUNTS
* @param { GetDomainAccountInfoOptions } options - Indicates the options for getting domain account information.
* @param { AsyncCallback<DomainAccountInfo> } callback - Indicates the result callback.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300013 - Network exception.
* @throws { BusinessError } 12300111 - The operation time out.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
static getAccountInfo(options: GetDomainAccountInfoOptions, callback: AsyncCallback<DomainAccountInfo>): void;
/**
* Gets the specified domain account information.
*
* @permission ohos.permission.GET_DOMAIN_ACCOUNTS
* @param { GetDomainAccountInfoOptions } options - Indicates the options for getting domain account information.
* @returns { Promise<DomainAccountInfo> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300013 - Network exception.
* @throws { BusinessError } 12300111 - The operation time out.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
static getAccountInfo(options: GetDomainAccountInfoOptions): Promise<DomainAccountInfo>;
/**
* Gets the business access token of the current domain account.
*
* @param { Record<string, Object> } businessParams - Indicates the business parameters.
* @param { AsyncCallback<Uint8Array> } callback - Indicates the result callback.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid business parameters.
* @throws { BusinessError } 12300003 - Domain account not found.
* @throws { BusinessError } 12300013 - Network exception.
* @throws { BusinessError } 12300014 - The domain account is not authenticated.
* @throws { BusinessError } 12300111 - The operation time out.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 11
*/
static getAccessToken(businessParams: Record<string, Object>, callback: AsyncCallback<Uint8Array>): void;
/**
* Gets the business access token for the current domain account.
*
* @param { Record<string, Object> } businessParams - Indicates the business parameters.
* @returns { Promise<Uint8Array> } The promise returned by the function.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid business parameters.
* @throws { BusinessError } 12300003 - Domain account not found.
* @throws { BusinessError } 12300013 - Network exception.
* @throws { BusinessError } 12300014 - The domain account is not authenticated.
* @throws { BusinessError } 12300111 - The operation time out.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 11
*/
static getAccessToken(businessParams: Record<string, Object>): Promise<Uint8Array>;
/**
* Checks whether the authentication of the target domain account is expired.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information.
* @returns { Promise<boolean> } The promise returned by the function.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - Domain account not found.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
static isAuthenticationExpired(domainAccountInfo: DomainAccountInfo): Promise<boolean>;
}
/**
* Defines the domain server config.
*
* @typedef DomainServerConfig
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
interface DomainServerConfig {
/**
* Indicates the detail config parameters.
*
* @type { Record<string, Object> }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
parameters: Record<string, Object>;
/**
* Indicates the config identifier.
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
id: string;
/**
* Indicates the domain to which the server config belongs.
*
* @type { string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
domain: string;
}
/**
* Provides abilities for managing domain server config.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
class DomainServerConfigManager {
/**
* Adds a domain server config.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { Record<string, Object> } parameters - Indicates the server config parameters.
* @returns { Promise<DomainServerConfig> } Returns the added domain server config.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid server config parameters.
* @throws { BusinessError } 12300211 - Server unreachable.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
static addServerConfig(parameters: Record<string, Object>): Promise<DomainServerConfig>;
/**
* Removes a domain server config.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { string } configId - Indicates the server config identifier.
* @returns { Promise<void> } Returns void.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300212 - Server config not found.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
static removeServerConfig(configId: string): Promise<void>;
/**
* Gets the server config of the specified domain account.
*
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
* @param { DomainAccountInfo } domainAccountInfo - Indicates the domain account information.
* @returns { Promise<DomainServerConfig> } Returns the domain server config.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - Domain account not found.
* @static
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
static getAccountServerConfig(domainAccountInfo: DomainAccountInfo): Promise<DomainServerConfig>;
}
/**
* Provides the abilities for managing user identity.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
* @name UserIdentityManager
*/
class UserIdentityManager {
/**
* Constructor to get the UserIdentityManager class instance.
*
* @throws { BusinessError } 202 - Not system application.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
constructor();
/**
* Opens session.
* <p>
* Start an IDM operation to obtain challenge value.
* A challenge value of 0 indicates that opensession failed.
*
* @permission ohos.permission.MANAGE_USER_IDM
* @param { AsyncCallback<Uint8Array> } callback - Returns a challenge value.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
openSession(callback: AsyncCallback<Uint8Array>): void;
/**
* Opens session.
* <p>
* Start an IDM operation to obtain challenge value.
* A challenge value of 0 indicates that opensession failed.
*
* @permission ohos.permission.MANAGE_USER_IDM
* @returns { Promise<Uint8Array> } Returns a challenge value.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
/**
* Opens a session.
* <p>
* Start an IDM operation to obtain challenge value.
*
* @permission ohos.permission.MANAGE_USER_IDM
* @param { number } [accountId] - Indicates the local ID of the OS account.
* @returns { Promise<Uint8Array> } Returns a challenge value.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
openSession(accountId?: number): Promise<Uint8Array>;
/**
* Adds credential.
* <p>
* Add user credential information, pass in credential addition method and credential information
* (credential type, subclass, if adding user's non password credentials, pass in password authentication token),
* and get the result / acquireInfo callback.
*
* @permission ohos.permission.MANAGE_USER_IDM
* @param { CredentialInfo } credentialInfo - Indicates the credential information.
* @param { IIdmCallback } callback - Indicates the callback to get results and acquireInfo.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid credentialInfo, i.e. authType or authSubType.
* @throws { BusinessError } 12300101 - The token is invalid.
* @throws { BusinessError } 12300106 - The authentication type is not supported.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300111 - The operation time out.
* @throws { BusinessError } 12300115 - The number of credentials reaches the upper limit.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
/**
* Adds a credential.
* <p>
* Add user credential information, pass in credential addition method and credential information
* (credential type, subclass, if adding user's non password credentials, pass in password authentication token),
* and get the result / acquireInfo callback.
*
* @permission ohos.permission.MANAGE_USER_IDM
* @param { CredentialInfo } credentialInfo - Indicates the credential information.
* @param { IIdmCallback } callback - Indicates the callback to get results and acquireInfo.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid credentialInfo, i.e. authType or authSubType.
* @throws { BusinessError } 12300101 - The token is invalid.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300106 - The authentication type is not supported.
* @throws { BusinessError } 12300008 - Restricted account.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300111 - The operation time out.
* @throws { BusinessError } 12300115 - The number of credentials reaches the upper limit.
* @throws { BusinessError } 12300116 - Credential complexity verification failed.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
/**
* Updates credential.
*
* @permission ohos.permission.MANAGE_USER_IDM
* @param { CredentialInfo } credentialInfo - Indicates the credential information.
* @param { IIdmCallback } callback - Indicates the callback to get results and acquireInfo.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid credentialInfo, i.e. authType or authSubType.
* @throws { BusinessError } 12300101 - The token is invalid.
* @throws { BusinessError } 12300102 - The credential does not exist.
* @throws { BusinessError } 12300106 - The authentication type is not supported.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300111 - The operation time out.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
/**
* Updates a credential.
*
* @permission ohos.permission.MANAGE_USER_IDM
* @param { CredentialInfo } credentialInfo - Indicates the credential information.
* @param { IIdmCallback } callback - Indicates the callback to get results and acquireInfo.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid credentialInfo, i.e. authType or authSubType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300101 - The token is invalid.
* @throws { BusinessError } 12300102 - The credential does not exist.
* @throws { BusinessError } 12300106 - The authentication type is not supported.
* @throws { BusinessError } 12300109 - The authentication, enrollment, or update operation is canceled.
* @throws { BusinessError } 12300111 - The operation time out.
* @throws { BusinessError } 12300116 - Credential complexity verification failed.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;
/**
* Closes session.
* <p>
* End an IDM operation.
*
* @permission ohos.permission.MANAGE_USER_IDM
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
/**
* Closes a session.
* <p>
* End an IDM operation.
*
* @permission ohos.permission.MANAGE_USER_IDM
* @param { number } [accountId] - Indicates the local ID of the OS account.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300008 - Restricted account.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
closeSession(accountId?: number): void;
/**
* Cancels entry with a challenge value.
*
* @permission ohos.permission.MANAGE_USER_IDM
* @param { Uint8Array } challenge - Indicates the challenge value.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid challenge.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
cancel(challenge: Uint8Array): void;
/**
* Deletes the user with the authentication token.
*
* @permission ohos.permission.MANAGE_USER_IDM
* @param { Uint8Array } token - Indicates the authentication token.
* @param { IIdmCallback } callback - Indicates the callback to get the deletion result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300101 - The token is invalid.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
delUser(token: Uint8Array, callback: IIdmCallback): void;
/**
* Deletes the user credential information.
*
* @permission ohos.permission.MANAGE_USER_IDM
* @param { Uint8Array } credentialId - Indicates the credential index.
* @param { Uint8Array } token - Indicates the authentication token.
* @param { IIdmCallback } callback - Indicates the callback to get the deletion result.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid credentialId.
* @throws { BusinessError } 12300101 - The token is invalid.
* @throws { BusinessError } 12300102 - The credential does not exist.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): void;
/**
* Gets authentication information.
*
* @permission ohos.permission.USE_USER_IDM
* @param { AsyncCallback<Array<EnrolledCredInfo>> } callback - Indicates the callback to get all registered credential information of
* the specified type for the current user.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300102 - The credential does not exist.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
getAuthInfo(callback: AsyncCallback<Array<EnrolledCredInfo>>): void;
/**
* Gets authentication information.
*
* @permission ohos.permission.USE_USER_IDM
* @param { AuthType } authType - Indicates the authentication type.
* @param { AsyncCallback<Array<EnrolledCredInfo>> } callback - Indicates the callback to get all registered credential information of
* the specified type for the current user.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid authType.
* @throws { BusinessError } 12300102 - The credential does not exist.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
getAuthInfo(authType: AuthType, callback: AsyncCallback<Array<EnrolledCredInfo>>): void;
/**
* Gets authentication information.
*
* @permission ohos.permission.USE_USER_IDM
* @param { AuthType } authType - Indicates the authentication type.
* @returns { Promise<Array<EnrolledCredInfo>> } Returns all registered credential information of
* the specified type for the current user.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid authType.
* @throws { BusinessError } 12300102 - The credential does not exist.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
getAuthInfo(authType?: AuthType): Promise<Array<EnrolledCredInfo>>;
/**
* Gets authentication information.
*
* @permission ohos.permission.USE_USER_IDM
* @param { GetAuthInfoOptions } [options] - Indicates the options for getting the authentication information.
* @returns { Promise<Array<EnrolledCredInfo>> } Returns all enrolled credential information
* according to the options.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid options.
* @throws { BusinessError } 12300003 - Account not found.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
getAuthInfo(options?: GetAuthInfoOptions): Promise<Array<EnrolledCredInfo>>;
/**
* Gets the credential enrolled identifier of the specified authentication type.
*
* @permission ohos.permission.USE_USER_IDM
* @param { AuthType } authType - Indicates the authentication type.
* @param { number } [accountId] - Indicates the OS account identifier.
* @returns { Promise<Uint8Array> } Returns the enrolled identifier.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300001 - The system service works abnormally.
* @throws { BusinessError } 12300002 - Invalid authType.
* @throws { BusinessError } 12300003 - Account not found.
* @throws { BusinessError } 12300102 - The credential does not exist.
* @throws { BusinessError } 12300106 - The authentication type is not supported.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
getEnrolledId(authType: AuthType, accountId?: number): Promise<Uint8Array>;
}
/**
* Options for getting authentication information.
*
* @typedef GetAuthInfoOptions
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
interface GetAuthInfoOptions {
/**
* Indicates the authentication credential type.
*
* @type { ?AuthType }
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
authType?: AuthType;
/**
* Indicates the OS account identifier.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
accountId?: number;
}
/**
* Indicates the enumeration of the authentication intent.
*
* @enum { number } AuthIntent
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
enum AuthIntent {
/**
* Indicates the intent to unlock screen.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
UNLOCK = 1
}
/**
* Options for remote authentication.
*
* @interface RemoteAuthOptions
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
interface RemoteAuthOptions {
/**
* Indicates the verifier network identifier.
*
* @type { ?string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
verifierNetworkId?: string;
/**
* Indicates the collector network identifier.
*
* @type { ?string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
collectorNetworkId?: string;
/**
* Indicates the collector token identifier.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
collectorTokenId?: number;
}
/**
* Options for authentication.
*
* @interface AuthOptions
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
interface AuthOptions {
/**
* Indicates the local ID of the OS account to be authenticated.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
accountId?: number;
/**
* Indicates the authentication intent.
*
* @type { ?AuthIntent }
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
authIntent?: AuthIntent;
/**
* Indicates the remote authentication options.
*
* @type { ?RemoteAuthOptions }
* @syscap SystemCapability.Account.OsAccount
* @systemapi
* @since 12
*/
remoteAuthOptions?: RemoteAuthOptions;
}
/**
* Password data callback.
*
* @interface IInputData
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface IInputData {
/**
* Notifies to set data.
*
* @type { function }
* @throws { BusinessError } 202 - Not system application.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
* <br> 2. Incorrect parameter types.
* @throws { BusinessError } 12300002 - Invalid pinSubType.
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
onSetData: (authSubType: AuthSubType, data: Uint8Array) => void;
}
/**
* Options for getting input data.
*
* @interface GetInputDataOptions
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
interface GetInputDataOptions {
/**
* Indicates the challenge.
*
* @type { ?Uint8Array }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
challenge?: Uint8Array;
}
/**
* Password input box callback.
*
* @interface IInputer
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface IInputer {
/**
* Notifies to get data.
*
* @type { function }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
onGetData: (authSubType: AuthSubType, callback: IInputData, options: GetInputDataOptions) => void;
}
/**
* User authentication callback.
*
* @interface IUserAuthCallback
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
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.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
onResult: (result: number, extraInfo: AuthResult) => void;
/**
* During an authentication, the TipsCode is returned through the callback.
*
* @type { ?function }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
onAcquireInfo?: (module: number, acquire: number, extraInfo: Uint8Array) => void;
}
/**
* Identity manager callback.
*
* @interface IIdmCallback
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface IIdmCallback {
/**
* The authentication result code is returned through the callback.
*
* @type { function }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
onResult: (result: number, extraInfo: RequestResult) => void;
/**
* During an authentication, the TipsCode is returned through the callback.
*
* @type { ?function }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
onAcquireInfo?: (module: number, acquire: number, extraInfo: Uint8Array) => void;
}
/**
* Provides the information of the get property request.
*
* @interface GetPropertyRequest
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface GetPropertyRequest {
/**
* Indicates the authentication credential type.
*
* @type { AuthType }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
authType: AuthType;
/**
* Indicates the array of property types to get.
*
* @type { Array<GetPropertyType> }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
keys: Array<GetPropertyType>;
/**
* Indicates the OS account identifier.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
accountId?: number;
}
/**
* Provides the information of the set property request.
*
* @interface SetPropertyRequest
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface SetPropertyRequest {
/**
* Indicates the authentication credential type.
*
* @type { AuthType }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
authType: AuthType;
/**
* Indicates the property type to set.
*
* @type { SetPropertyType }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
key: SetPropertyType;
/**
* Indicates the information to set.
*
* @type { Uint8Array }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
setInfo: Uint8Array;
}
/**
* Provides the property of executor.
*
* @interface ExecutorProperty
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface ExecutorProperty {
/**
* Indicates the result.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
result: number;
/**
* Indicates the authentication credential subtype.
*
* @type { AuthSubType }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
authSubType: AuthSubType;
/**
* Indicates the remaining times.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
remainTimes?: number;
/**
* Indicates the freezing times.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
freezingTime?: number;
/**
* Indicates next phase freezing time.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
nextPhaseFreezingTime?: number;
/**
* Indicates the enrollment progress.
*
* @type { ?string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
enrollmentProgress?: string;
/**
* Indicates the sensor information.
*
* @type { ?string }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
sensorInfo?: string;
}
/**
* Indicates the information of authentication result.
*
* @interface AuthResult
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface AuthResult {
/**
* Indicates the authentication token.
*
* @type { ?Uint8Array }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
token?: Uint8Array;
/**
* Indicates the remaining times.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
remainTimes?: number;
/**
* Indicates the freezing times.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
freezingTime?: number;
/**
* Indicates next phase freezing time.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
nextPhaseFreezingTime?: number;
/**
* Indicates the credential ID.
*
* @type { ?Uint8Array }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
credentialId?: Uint8Array;
/**
* Indicates the local ID of the authenticated OS account.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
accountId?: number;
/**
* Indicates the validity period after which the PIN will expire.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
pinValidityPeriod?: number;
}
/**
* Indicates the information of credential.
*
* @interface CredentialInfo
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface CredentialInfo {
/**
* Indicates the credential type.
*
* @type { AuthType }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
credType: AuthType;
/**
* Indicates the credential subtype.
*
* @type { AuthSubType }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
credSubType: AuthSubType;
/**
* Indicates the authentication token.
*
* @type { Uint8Array }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
token: Uint8Array;
/**
* Indicates the local ID of the OS account to which the credential belongs.
*
* @type { ?number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
accountId?: number;
}
/**
* Indicates the information of request result.
*
* @interface RequestResult
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface RequestResult {
/**
* Indicates the credential index.
*
* @type { ?Uint8Array }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
credentialId?: Uint8Array;
}
/**
* Indicates the information of enrolled credential.
*
* @interface EnrolledCredInfo
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
interface EnrolledCredInfo {
/**
* Indicates the credential index.
*
* @type { Uint8Array }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
credentialId: Uint8Array;
/**
* Indicates the authentication credential type.
*
* @type { AuthType }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
authType: AuthType;
/**
* Indicates the authentication credential subtype.
*
* @type { AuthSubType }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
authSubType: AuthSubType;
/**
* Indicates the credential template ID.
*
* @type { Uint8Array }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
templateId: Uint8Array;
}
/**
* Indicates the property type to get.
*
* @enum { number } GetPropertyType
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum GetPropertyType {
/**
* Indicates the authentication subtype.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
AUTH_SUB_TYPE = 1,
/**
* Indicates the remain times.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
REMAIN_TIMES = 2,
/**
* Indicates the freezing time.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FREEZING_TIME = 3,
/**
* Indicates the enrollment progress.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
ENROLLMENT_PROGRESS = 4,
/**
* Indicates the sensor information.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
SENSOR_INFO = 5,
/**
* Indicates the next phase freezing time.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
NEXT_PHASE_FREEZING_TIME = 6
}
/**
* Indicates the property type to set.
*
* @enum { number } SetPropertyType
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum SetPropertyType {
/**
* Indicates the init algorithm.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
INIT_ALGORITHM = 1
}
/**
* Indicates the credential type for authentication.
*
* @enum { number } AuthType
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum AuthType {
/**
* Indicates the PIN authentication type.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
PIN = 1,
/**
* Indicates the FACE authentication type.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FACE = 2,
/**
* Indicates the FINGERPRINT authentication type.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
FINGERPRINT = 4,
/**
* Indicates the RECOVERY_KEY authentication type.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
RECOVERY_KEY = 8,
/**
* Indicates the DOMAIN authentication type.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
DOMAIN = 1024
}
/**
* Indicates the credential subtype for authentication.
*
* @enum { number } AuthSubType
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum AuthSubType {
/**
* Indicates the 6-digit credential.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
PIN_SIX = 10000,
/**
* Indicates the self-defined digital credential.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
PIN_NUMBER = 10001,
/**
* Indicates the self-defined mixed credential.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
PIN_MIXED = 10002,
/**
* Indicates the 4-digit credential.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
PIN_FOUR = 10003,
/**
* Indicates the pattern credential.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 12
*/
PIN_PATTERN = 10004,
/**
* Indicates the 2D face credential.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FACE_2D = 20000,
/**
* Indicates the 3D face credential.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FACE_3D = 20001,
/**
* Indicates the capacitive fingerprint credential.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
FINGERPRINT_CAPACITIVE = 30000,
/**
* Indicates the optical fingerprint credential.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
FINGERPRINT_OPTICAL = 30001,
/**
* Indicates the ultrasonic fingerprint credential.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
FINGERPRINT_ULTRASONIC = 30002,
/**
* Indicates the mixed domain credential.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
DOMAIN_MIXED = 10240001
}
/**
* Indicates the trusted level of authentication results.
*
* @enum { number } AuthTrustLevel
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum AuthTrustLevel {
/**
* Indicates the trusted level 1.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
ATL1 = 10000,
/**
* Indicates the trusted level 2.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
ATL2 = 20000,
/**
* Indicates the trusted level 3.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
ATL3 = 30000,
/**
* Indicates the trusted level 4.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
ATL4 = 40000
}
/**
* Indicates the module of acquired information.
*
* @enum { number } Module
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum Module {
/**
* Indicates the information acquired from FaceAuth.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FACE_AUTH = 1
}
/**
* Indicates the enumeration of authentication result code.
*
* @enum { number } ResultCode
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum ResultCode {
/**
* Indicates that authentication is success or ability is supported.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
SUCCESS = 0,
/**
* Indicates the authenticator fails to identify user.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FAIL = 1,
/**
* Indicates other errors.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
GENERAL_ERROR = 2,
/**
* Indicates that authentication has been canceled.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
CANCELED = 3,
/**
* Indicates that authentication has timed out.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
TIMEOUT = 4,
/**
* Indicates that this authentication type is not supported.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
TYPE_NOT_SUPPORT = 5,
/**
* Indicates that the authentication trust level is not supported.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
TRUST_LEVEL_NOT_SUPPORT = 6,
/**
* Indicates that the authentication task is busy. Wait for a few seconds and try again.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
BUSY = 7,
/**
* Indicates incorrect parameters.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
INVALID_PARAMETERS = 8,
/**
* Indicates that the authenticator is locked.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
LOCKED = 9,
/**
* Indicates that the user has not enrolled the authenticator.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
NOT_ENROLLED = 10
}
/**
* Indicates the enumeration of prompt codes in the process of face authentication.
*
* @enum { number } FaceTipsCode
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum FaceTipsCode {
/**
* Indicates that the obtained facial image is too bright due to high illumination.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FACE_AUTH_TIP_TOO_BRIGHT = 1,
/**
* Indicates that the obtained facial image is too dark due to low illumination.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FACE_AUTH_TIP_TOO_DARK = 2,
/**
* Indicates that the face is too close to the device.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FACE_AUTH_TIP_TOO_CLOSE = 3,
/**
* Indicates that the face is too far away from the device.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
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.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
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.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
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.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
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.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FACE_AUTH_TIP_TOO_LEFT = 8,
/**
* Indicates that the face moves too fast during facial information collection.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FACE_AUTH_TIP_TOO_MUCH_MOTION = 9,
/**
* Indicates that the face is not facing the device.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FACE_AUTH_TIP_POOR_GAZE = 10,
/**
* Indicates that no face is detected.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FACE_AUTH_TIP_NOT_DETECTED = 11
}
/**
* Indicates the enumeration of prompt codes in the process of fingerprint authentication.
*
* @enum { number } FingerprintTips
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
enum FingerprintTips {
/**
* Indicates that the image acquired is good.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FINGERPRINT_TIP_GOOD = 0,
/**
* Indicates that the fingerprint image is too noisy due to suspected or detected dirt on the sensor.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FINGERPRINT_TIP_IMAGER_DIRTY = 1,
/**
* Indicates that the fingerprint image is too noisy to process due to a detected condition.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FINGERPRINT_TIP_INSUFFICIENT = 2,
/**
* Indicates that only a partial fingerprint image is detected.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FINGERPRINT_TIP_PARTIAL = 3,
/**
* Indicates that the fingerprint image is incomplete due to quick motion.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FINGERPRINT_TIP_TOO_FAST = 4,
/**
* Indicates that the fingerprint image is unreadable due to lack of motion.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 8
*/
FINGERPRINT_TIP_TOO_SLOW = 5,
/**
* Indicates that the finger is down.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
FINGERPRINT_TIP_FINGER_DOWN = 6,
/**
* Indicates that the finger is up.
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 10
*/
FINGERPRINT_TIP_FINGER_UP = 7
}
/**
* Enumerates for constraint source types.
*
* @enum { number } ConstraintSourceType
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
enum ConstraintSourceType {
/**
* No constraints are set
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
CONSTRAINT_NOT_EXIST = 0,
/**
* Constraint is set by setOsAccountConstraints
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
CONSTRAINT_TYPE_BASE = 1,
/**
* Constraint is set by device owner
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
CONSTRAINT_TYPE_DEVICE_OWNER = 2,
/**
* Constraint is set by profile owner
*
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
CONSTRAINT_TYPE_PROFILE_OWNER = 3
}
/**
* Provides information about the constraint source type info of an os account.
*
* @interface ConstraintSourceTypeInfo
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
interface ConstraintSourceTypeInfo {
/**
* Indicates the id of an os account who set the constraint.
* When type is CONSTRAINT_NOT_EXIST or CONSTRAINT_TYPE_BASE, localId will be -1.
*
* @type { number }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
localId: number;
/**
* Indicates the source type of the constraint.
*
* @type { ConstraintSourceType }
* @syscap SystemCapability.Account.OsAccount
* @systemapi Hide this for inner system use.
* @since 9
*/
type: ConstraintSourceType;
}
}
export default osAccount;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lffl8796/interface_sdk-js.git
git@gitee.com:lffl8796/interface_sdk-js.git
lffl8796
interface_sdk-js
interface_sdk-js
master

搜索帮助