Crypto React
    Preparing search index...

    Interface UseEncryptResult

    Return type of the useEncrypt hook.

    const { encrypt, decrypt, ciphertext, plaintext }: UseEncryptResult = useEncrypt();
    
    interface UseEncryptResult {
        encrypt: (
            plaintext: string | Uint8Array<ArrayBufferLike>,
            key?: string,
        ) => string;
        decrypt: (ciphertext: string, key?: string) => string;
        ciphertext: string | null;
        plaintext: string | null;
        isProcessing: boolean;
    }
    Index
    encrypt: (
        plaintext: string | Uint8Array<ArrayBufferLike>,
        key?: string,
    ) => string

    Encrypt plaintext. Returns the base64-encoded sealed box.

    decrypt: (ciphertext: string, key?: string) => string

    Decrypt a sealed box. Returns the plaintext as a UTF-8 string.

    ciphertext: string | null

    The last ciphertext produced by encrypt().

    plaintext: string | null

    The last plaintext produced by decrypt().

    isProcessing: boolean

    True while an encrypt or decrypt operation is in progress.