A mnemonic is a human readable list of words that generates a master seed, that in turn, generates wallet accounts for users. It is critical that a mnemonic must be backed-up by the user, as soon as it is generated. If the user’s account is deleted from their device, or if the device is lost, the mnemonic is not recoverable! It is the key to accessing a user’s wallet accounts. We are working on cloud-backup using the iOS/Android keystore for users with smaller account balances.
Generate a Mnemonic seed
Creates a random mnemonic string. Returned string can be displayed to the user for backup.
createAccount to create the first account using this mnemonic.
Abstrakt.shared.createMnemonic() -> String
This function imports an mnemonic to the device. The user can type in their mnemonic and recover previously generated accounts or import accounts from another device. Two Cases:
- The user already has accounts previously created from this menmonic in SDK. (function
- In this case, private keys of existing accounts are automatically generated using the imported menmonic.
- The user does not have existing accounts generated earlier.
- In this case, nickName and blockchainNetwork can be set to create first account. If unset, defaults will be used to create first account.
Note: only one mnemonic is support at this time. multi-mnemonic support will be added soon.
|isTestnetEnabled||if enabled will generate testnet work accounts and mainnet accounts of existing accounts|
|mnemonic||mnemonic string to import|
|nickName||optional name of first account created using mnemonic. Both blockchainNetwork and nickName have to be specifed or either.|
|blockchainNetwork||optional blockchain network of first account created.|
|boolean||returns true = success or false = failed|
Abstrakt.shared.importMnemonic(isTestnetEnabled: Bool = false, mnemonic: String, nickName: String, blockchainNetwork: BlockchainNetwork, completion: @escaping (Bool) -> Void)
This function returns generated/imported menmonic encrypted on the device. It can be displayed to the user for backing up.
Abstrakt.shared.getMnemonic(completion: @escaping (String) -> Void)
Cloud backup (work in progress…)
This function will enable you to encrypt the user generated mnenomnic with a password and store it to the apple keychain.
Recover cloud backup (work in progress…)
Once a mnenomic is encrypted and backuped to the user’s apple keychain, it can be recovered automatcially on future logins.