react-native-quick-crypto
Version:
A fast implementation of Node's `crypto` module written in C/C++ JSI
26 lines (22 loc) • 729 B
text/typescript
import type { HybridObject } from 'react-native-nitro-modules';
type CipherArgs = {
isCipher: boolean;
cipherType: string;
cipherKey: ArrayBuffer;
iv: ArrayBuffer;
authTagLen?: number;
};
export interface Cipher extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
update(data: ArrayBuffer): ArrayBuffer;
final(): ArrayBuffer;
setArgs(args: CipherArgs): void;
setAAD(data: ArrayBuffer, plaintextLength?: number): boolean;
setAutoPadding(autoPad: boolean): boolean;
setAuthTag(tag: ArrayBuffer): boolean;
getAuthTag(): ArrayBuffer;
getSupportedCiphers(): string[];
}
export interface CipherFactory
extends HybridObject<{ ios: 'c++'; android: 'c++' }> {
createCipher(args: CipherArgs): Cipher;
}