Skip to content

Commit

Permalink
feat 0.1.1: change aes to chacha20 on android
Browse files Browse the repository at this point in the history
  • Loading branch information
hayr-hotoca committed Aug 14, 2023
1 parent 0fab33a commit 1b95d4d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# react-native-key-generator

Secure unique key generator for React Native
Secure unique 128, 192, 256 bit key generator for React Native

# Requirements
iOS >= 13.0\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class KeyGeneratorModule(reactContext: ReactApplicationContext) :
if (outputEncoding != "base64" && outputEncoding != "hex") {
return promise.reject("Output encoding error", "Output encoding should be in 'base64' or 'hex'", null)
}
val keygen = KeyGenerator.getInstance("ChaCha20")

val keygen = KeyGenerator.getInstance("AES")
keygen.init(size)
val key: SecretKey = keygen.generateKey()
val encodedKey = if (outputEncoding == "base64")
Expand Down
2 changes: 1 addition & 1 deletion ios/KeyGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class KeyGenerator: NSObject {
@objc(generateSymmetricKey:withOutputEncoding:withResolver:withRejecter:)
func generateSymmetricKey(size: Int, outputEncoding: String, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
if (outputEncoding != "base64" && outputEncoding != "hex") {
reject("Output encoding error", "Output encoding should be in 'base64' or 'hex'", nil)
return reject("Output encoding error", "Output encoding should be in 'base64' or 'hex'", nil)
}

var newKey = SymmetricKey.init(size: SymmetricKeySize.bits256)
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-key-generator",
"version": "0.1.0",
"description": "Secure unique key generator for React Native",
"version": "0.1.1",
"description": "Secure unique 128, 192, 256 bit key generator for React Native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
"types": "lib/typescript/index.d.ts",
Expand Down

0 comments on commit 1b95d4d

Please sign in to comment.