Skip to main content

@exodus/keystore-mobile

Secure key-value storage implementation for secrets management.

Usage

import { Platform } from 'react-native'
import createKeystore from '@exodus/keystore-mobile'
import * as reactNativeKeychain from '@exodus/react-native-keychain'

const keystore = createKeystore({
reactNativeKeychain,
platform: Platform.OS,
})

const horcrux = await keystore.getSecret('horcrux')

Methods

getSecret(key: string): Promise<any | undefined>

Fetches a secret from the keystore.

setSecret(key: string, value: any, opts?: { accessControl, accessible, accessGroup, securityLevel }): Promise

See supported values for opts here: https://github.com/ExodusMovement/react-native-keychain?tab=readme-ov-file#options

The default value for opts:

// ios/android:
accessible: RNKeychain.ACCESSIBLE.WHEN_UNLOCKED,
// android:
securityLevel: RNKeychain.SECURITY_LEVEL.SECURE_SOFTWARE

deleteSecret(key: string): Promise

Delete a secret from the keystore.

lock(): Promise

Lock the keystore. All calls will hang until unlock() is called.

unlock(): Promise

Unlock the keystore and allow through all pending calls.