Complete API reference for identity management and authentication
generateSeedPhrase(wordCount?)
wordCount
(optional): 12 | 24
- Number of words (default: 12)string
- Generated seed phrase
Example:
createFromSeedPhrase(seedPhrase, key?)
seedPhrase
: string | string[]
- BIP39 mnemonic phrasekey
(optional): string
- Unique key for the identity (auto-generated if not provided)Promise<IIdentityCreationResult>
identity
: Secp256k1KeyIdentity
- Created identityinfo
: IIdentityInfo
- Identity informationcreateAnonymous(key?)
key
(optional): string
- Unique key for the identity (auto-generated if not provided)Promise<IIdentityCreationResult>
Example:
switch(key)
key
: string
- Key of the identity to switch toPromise<void>
Example:
remove(key)
key
: string
- Key of the identity to removevoid
Example:
list()
string[]
- Array of identity keys
Example:
getCurrentKey()
string
- Current identity key
Example:
getInfo()
Promise<IIdentityInfo>
type
: IdentityType
- Type of identity (secp256k1, anonymous)principal
: Principal
- Identity principalaccountId
: string
- ICP account identifierisAnonymous
: boolean
- Whether identity is anonymousgetPrincipal()
string
- Principal as string
Example:
getAccountId()
string
- Account identifier
Example:
IIdentityCreationResult
IIdentityInfo
IdentityType
agent.destroy()
to properly clean up identities when done.