react-native-seald-accelerator
Native module for Seald SDK
Installation
npm install @seald-io/react-native-accelerator
Usage
import { generateSymkey, encryptFileAsString, decryptFileAsString } from "@seald-io/react-native-accelerator";
const symKey = await generateSymkey() // Generate AES Symmetric Key
// To encrypt a file
const messageId = "00000000-0000-1000-a000-1d0000000000"
const filename = "myFilename"
const utf8FileContent = "it's my file ! it's encrypted !"
const b64EncryptedFile = await encryptFileAsString(utf8FileContent, filename, messageId, symKey)
// To decrypt a file
const clearString = await decryptFileAsString(b64EncryptedFile, symKey)
const clearFile = JSON.parse(clearString)
console.log('clearFile.filename', clearFile.filename)
console.log('clearFile.messageId', clearFile.messageId)
console.log('clearFile.fileContent', clearFile.fileContent) // as utf8 string
Dev
init
installer go, puis gomobile:
go install golang.org/x/mobile/cmd/gomobile@latest
Ajouter les executables go dans le path:
Linux :/usr/local/go/bin:/home/$USER/go/bin
Mac export PATH=${PATH}:/Users/$USER/go/bin
Installer le SDK et le NDK Android (Android Studio
le fait très bien).
You may have to install the NDK (Obsolete) package in the Android SDK Manager (for which you will have to uncheck the "Hide obsolete tools" checkbox)
Télécharger les bibliothèques GO
./download-go-library.sh -e prod
# Pour télécharger les sources depuis different env, il faut utiliser l'option -e dev/limb/prod. Default to prod
./download-go-library.sh -e dev
Run the example project
cd example
npm run ios
npm run android
// If metro serveur is not automatically started:
npm run start
IOS: For every new go build, you need to run `pod install`