React Native SSSA
Shamir's Secret Sharing Algorithm For React-Native
A library to generate cryptographically secure shares of a secret.
Installation
$ yarn add react-native-sssa react-native-securerandom react-native-aes-crypto react-native-secure-storage$ react-native link
react-native-securerandom is used to provide entropy in shamir's secret sharing algorithm
react-native-aes-crypto is used to encrypt a file with AES before being processed with SSSA
react-native-secure-storage is used to securely stored the private key
Usage
To put a plain text secret through the entire pipeline (encrypt with. AES, generate shares of the secret with Shamir's Secret Sharing Algorithm, and distribute shares to IPFS (via Infura), use the following:
;let ipfsHashes = await
To collect shares back from IPFS, use Shamir's secret sharing algorithm to reconstruct the encrypted file, and then decrypt the file back to the plain-text secret, do:
;let secret = await
If you just want to use Shamir's Secret Sharing Algorithm alone without encryption and IPFS, do the following:
;//This does secret sharing with 3 bit coefficients in the field GF(2^3).let sssa = 3; let shares = sssa;let secret = sssa;