Core initialization
Before any functions can be used, the Core must be initialized. Only one instance can be initialized; repeated calls will fail.
Function
- React Native
- iOS
- Android
initializeCore(): Promise<ONECore>
Wherever you installed and imported the framework, initialize the core.
func initializeCore(configJson: String, dataDirPath: String, nativeSecureElement: NativeKeyStorage?, remoteSecureElement: NativeKeyStorage?, bleCentral: BleCentral?, blePeripheral: BlePeripheral?)throws -> OneCoreBinding
Wherever you installed and imported the framework, initialize the core.
fun `initializeCore`(`configJson`: kotlin.String, `dataDirPath`: kotlin.String, `nativeSecureElement`: NativeKeyStorage?, `remoteSecureElement`: NativeKeyStorage?, `bleCentral`: BleCentral?, `blePeripheral`: BlePeripheral?): OneCoreBinding
Parameters
- React Native
- iOS
- Android
Parameters are provided internally via the mobile application internal directory and native key storage implementation.
-
configJson
- Pass a JSON file to override the default wallet configuration. See the one-core repository for the default configuration. -
dataDirPath
- Path, in the directory of the app, where the database should be saved. The system creates a sqlite file as the database. -
nativeSecureElement
- Use the native implementation of Secure Enclave (SecureEnclaveKeyStorage()
) by creating an instance of it and passing it with initialization. For example:try initializeCore(..., nativeSecureElement: SecureEnclaveKeyStorage(), ...);
Alternatively, create a custom implementation of Secure Enclave, create an instance of it and pass it with initialization.
noteThe default configuration expects an implementation for this parameter, and initialization will fail without one. To initialize without a secure element, pass the following in the
configJson
:{
"keyStorage": {
"SECURE_ELEMENT": {
"enabled": false
}
}
} -
remoteSecureElement
- Create a custom implementation of HSM and pass it here.infoThe Procivis One Wallet uses Ubiqu for its HSM implementatation. This is not available through the open source repositories.
-
bleCentral
- For the native implementation, useIOSBLECentral()
. -
blePeripheral
- For the native implementation, useIOSBLEPeripheral()
.
-
configJson
- Pass a JSON file to override the default wallet configuration. See the one-core repository for the default configuration. -
dataDirPath
- Path, in the directory of the app, where the database should be saved. The system creates a sqlite file as the database. -
nativeSecureElement
- Use the native implementation of Keystore (AndroidKeyStoreKeyStorage()
) by creating an instance of it and passing it with initialization. For example:uniffi.one_core.initializeCore(..., nativeSecureElement = AndroidKeyStoreKeyStorage(), ...);
Alternatively, create a custom implementation of Keystore, create an instance of it and pass it with initialization.
noteThe default configuration expects an implementation for this parameter, and initialization will fail without one. To initialize without a secure element, pass the following in the
configJson
:{
"keyStorage": {
"SECURE_ELEMENT": {
"enabled": false
}
}
} -
remoteSecureElement
- Create a custom implementation of HSM and pass it here.infoThe Procivis One Wallet uses Ubiqu for its HSM implementatation. This is not available through the open source repositories.
-
bleCentral
- For the native implementation, useIOSBLECentral()
. -
blePeripheral
- For the native implementation, useIOSBLEPeripheral()
.
A mobile device initialized with either
Secure Enclave for iOS
or Keystore for Android can
use SECURE_ELEMENT
as its storageType
when generating keys.
Return value
Initilization returns the One Core Binding.
Uninitializing
The core can be uninitialized. Deletion of data is optional. If data is not deleted and the core is reinitialized, it will be carried over and reused.
Deleting data while uninitializing the core erases all wallet data permanently.
- React Native
- iOS
- Android
uninitialize(deleteData: boolean): Promise<void>
func uninitialize(deleteData: Bool) throws
fun `uninitialize`(`deleteData`: Boolean)