1.0.0 • Published 4 years ago

@figureai/react-native-aes-kit v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

react-native-aes-kit

AES-CBC-PKCS5Padding

Install

npm i --S react-native-aes-kit

react-native link react-native-aes-kit

methods

  • encrypt
NameTypeNote
sourceTextstringplaintxt
secretKeystringsecret key,max 16 bytes
ivstringinitialization vector,max 16 bytes
  • decrypt
NameTypeNote
sourceTextstringcipher txt
secretKeystringsecret key,max 16 bytes
ivstringinitialization vector,max 16 bytes

Usage

import AesCrypto from 'react-native-aes-kit';

const plaintxt = 'test';
const secretKey = '0102030405060708';
const iv = '1112131415161718';

AesCrypto.encrypt(plaintxt,secretKey,iv).then(cipher=>{
    console.log(cipher);// return a string type cipher
    this.setState({ cipher });
}).catch(err=>{
    console.log(err);
});

AesCrypto.decrypt(this.state.cipher,secretKey,iv).then(plaintxt=>{
    console.log(plaintxt);// return a string type plaintxt
}).catch(err=>{
    console.log(err);
});
1.0.0

4 years ago