Changeset View
Changeset View
Standalone View
Standalone View
native/utils/aes-crypto-module.js
// @flow | // @flow | ||||
import { requireNativeModule } from 'expo-modules-core'; | import { requireNativeModule } from 'expo-modules-core'; | ||||
const KEY_SIZE = 32; | |||||
const AESCryptoModule: { | const AESCryptoModule: { | ||||
+hello: () => string, | +generateKey: (destination: Uint8Array) => void, | ||||
} = requireNativeModule('AESCrypto'); | } = requireNativeModule('AESCrypto'); | ||||
export function hello(): string { | export function generateKey(): Uint8Array { | ||||
return AESCryptoModule.hello(); | const key = new Uint8Array(KEY_SIZE); | ||||
atul: Kind of confusing naming that we're passing `key` to a function named `generateKey`.
Maybe… | |||||
bartekAuthorUnsubmitted Done Inline ActionsGood idea, keyBuffer sounds better bartek: Good idea, `keyBuffer` sounds better | |||||
AESCryptoModule.generateKey(key); | |||||
return key; | |||||
} | } |
Kind of confusing naming that we're passing key to a function named generateKey.
Maybe buffer or keyBuffer or keyDestination or something along those lines?