0.2.3-1 • Published 2 years ago
@seald-io/react-native-accelerator v0.2.3-1
react-native-seald-accelerator
Native module for Seald SDK
Installation
npm install @seald-io/react-native-acceleratorUsage
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 stringDev
init
installer go, puis gomobile:
go install golang.org/x/mobile/cmd/gomobile@latestAjouter 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 devRun the example project
cd example
npm run ios
npm run android
// If metro serveur is not automatically started:
npm run startIOS: For every new go build, you need to run `pod install`