react-native link @ostdotcom/ost-wallet-sdk-react-native
- Open up
./android/app/src/main/java/[...]/MainApplication.java
.- Add
import com.ostwalletrnsdk.OstWalletRnSdkPackage;
to the imports at the top of the file. - Add
new OstWalletRnSdkPackage()
to the list returned by thegetPackages()
method
- Add
- Append the following lines to
./android/settings.gradle
:include ':ost-wallet-sdk-react-native' project(':ost-wallet-sdk-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/ost-wallet-sdk-react-native/android')
- Insert the following lines inside the dependencies block in
./android/app/build.gradle
:compile project(':ost-wallet-sdk-react-native')
Change the minSdkVersion
to 22 in android/build.gradle
android {
defaultConfig {
minSdkVersion 22
...
...
...
}
}
Create file ./android/app/src/main/assets/ost-mobilesdk.json
with application specific configurations using the json below as an example
{
"BLOCK_GENERATION_TIME": 3,
"PIN_MAX_RETRY_COUNT": 3,
"REQUEST_TIMEOUT_DURATION": 60,
"SESSION_BUFFER_TIME": 3600,
"PRICE_POINT_CURRENCY_SYMBOL": "USD",
"USE_SEED_PASSWORD": false
}
- BlockGenerationTime: The time in seconds it takes to mine a block on auxiliary chain.
- PricePointTokenSymbol: This is the symbol of base currency. So its value will be OST.
- PricePointCurrencySymbol: It is the symbol of quote currency used in price conversion.
- RequestTimeoutDuration: Request timeout in seconds for https calls made by ostWalletSdk.
- PinMaxRetryCount: Maximum retry count to get the wallet Pin from user.
- SessionBufferTime: Buffer expiration time for session keys in seconds. Default value is 3600 seconds.
- UseSeedPassword: The seed password is salt to PBKDF2 used to generate seed from the mnemonic. When UseSeedPassword set to
true
, different deterministic salts are used for different keys.
NOTE: These configurations are MANDATORY for successful operation. Failing to set them will significantly impact usage.
Starting with Android 9 (API level 28), cleartext support is disabled by default. On the other hand, Ost Wallet Android Sdk leverages on Public Key Pinning to ensure the authenticity of a Ost Platform server's public key used in TLS sessions using TrustKit. As TrustKit can only be inititialized with application's network security configuration, sdk initialization fails. To work-around this issues, application needs to have TrustKit as a dependency and initialize it.
Please refer to Public Key Pinning Using TrustKit documentation.