Crypto Vue
    Preparing search index...

    Interface UseEncryptReturn

    Reactive state and methods returned by useEncrypt.

    const state: UseEncryptReturn = useEncrypt();
    const key = state.randomKey();
    await state.encrypt(key, "hello");
    interface UseEncryptReturn {
        ciphertext: DeepReadonly<Ref<string | null>>;
        plaintext: DeepReadonly<Ref<string | null>>;
        isProcessing: DeepReadonly<Ref<boolean>>;
        error: DeepReadonly<Ref<Error | null>>;
        encrypt: (
            key: string,
            data: string | Uint8Array<ArrayBufferLike>,
        ) => Promise<string>;
        decrypt: (
            key: string,
            data: string,
        ) => Promise<Uint8Array<ArrayBufferLike>>;
        randomKey: () => string;
        clear: () => void;
    }
    Index
    ciphertext: DeepReadonly<Ref<string | null>>

    The most recent ciphertext (hex-encoded).

    plaintext: DeepReadonly<Ref<string | null>>

    The most recent decrypted plaintext (as UTF-8 string).

    isProcessing: DeepReadonly<Ref<boolean>>

    Whether an encrypt/decrypt operation is in progress.

    error: DeepReadonly<Ref<Error | null>>

    Error from the last operation, if any.

    encrypt: (
        key: string,
        data: string | Uint8Array<ArrayBufferLike>,
    ) => Promise<string>

    Encrypt plaintext with the given key.

    decrypt: (key: string, data: string) => Promise<Uint8Array<ArrayBufferLike>>

    Decrypt ciphertext with the given key.

    randomKey: () => string

    Generate a random 256-bit key (hex string).

    clear: () => void

    Clear all reactive state.