DefinitelyTyped/types/libsodium-wrappers/index.d.ts
Daniel Rosenwasser aa66d1d0da
Merge pull request #32172 from dangodev/dangodev/optional-variant
[libsodium-wrappers] Make variant optional for from_base64 / to_base64
2019-01-18 13:32:05 -08:00

1087 lines
32 KiB
TypeScript

// Type definitions for libsodium-wrappers 0.7
// Project: https://github.com/jedisct1/libsodium.js
// Definitions by: Florian Keller <https://github.com/ffflorian>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
export type Uint8ArrayOutputFormat = 'uint8array';
export type StringOutputFormat = 'text' | 'hex' | 'base64';
export type KeyType = 'curve25519' | 'ed25519' | 'x25519';
export enum base64_variants {
ORIGINAL,
ORIGINAL_NO_PADDING,
URLSAFE,
URLSAFE_NO_PADDING,
}
export interface CryptoBox {
ciphertext: Uint8Array;
mac: Uint8Array;
}
export interface StringCryptoBox {
ciphertext: string;
mac: string;
}
export interface CryptoKX {
sharedRx: Uint8Array;
sharedTx: Uint8Array;
}
export interface StringCryptoKX {
sharedRx: string;
sharedTx: string;
}
export interface KeyPair {
keyType: KeyType;
privateKey: Uint8Array;
publicKey: Uint8Array;
}
export interface StringKeyPair {
keyType: KeyType;
privateKey: string;
publicKey: string;
}
export interface SecretBox {
cipher: Uint8Array;
mac: Uint8Array;
}
export interface StringSecretBox {
cipher: string;
mac: string;
}
export interface generichash_state_address {
name: string;
}
export interface onetimeauth_state_address {
name: string;
}
export interface state_address {
name: string;
}
export interface secretstream_xchacha20poly1305_state_address {
name: string;
}
export interface sign_state_address {
name: string;
}
export const SODIUM_LIBRARY_VERSION_MAJOR: number;
export const SODIUM_LIBRARY_VERSION_MINOR: number;
export const SODIUM_VERSION_STRING: string;
export const crypto_aead_chacha20poly1305_ABYTES: number;
export const crypto_aead_chacha20poly1305_KEYBYTES: number;
export const crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX: number;
export const crypto_aead_chacha20poly1305_NPUBBYTES: number;
export const crypto_aead_chacha20poly1305_NSECBYTES: number;
export const crypto_aead_chacha20poly1305_ietf_ABYTES: number;
export const crypto_aead_chacha20poly1305_ietf_KEYBYTES: number;
export const crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX: number;
export const crypto_aead_chacha20poly1305_ietf_NPUBBYTES: number;
export const crypto_aead_chacha20poly1305_ietf_NSECBYTES: number;
export const crypto_aead_xchacha20poly1305_ietf_ABYTES: number;
export const crypto_aead_xchacha20poly1305_ietf_KEYBYTES: number;
export const crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX: number;
export const crypto_aead_xchacha20poly1305_ietf_NPUBBYTES: number;
export const crypto_aead_xchacha20poly1305_ietf_NSECBYTES: number;
export const crypto_auth_BYTES: number;
export const crypto_auth_KEYBYTES: number;
export const crypto_box_BEFORENMBYTES: number;
export const crypto_box_MACBYTES: number;
export const crypto_box_MESSAGEBYTES_MAX: number;
export const crypto_box_NONCEBYTES: number;
export const crypto_box_PUBLICKEYBYTES: number;
export const crypto_box_SEALBYTES: number;
export const crypto_box_SECRETKEYBYTES: number;
export const crypto_box_SEEDBYTES: number;
export const crypto_core_hchacha20_CONSTBYTES: number;
export const crypto_core_hchacha20_INPUTBYTES: number;
export const crypto_core_hchacha20_KEYBYTES: number;
export const crypto_core_hchacha20_OUTPUTBYTES: number;
export const crypto_generichash_BYTES: number;
export const crypto_generichash_BYTES_MAX: number;
export const crypto_generichash_BYTES_MIN: number;
export const crypto_generichash_KEYBYTES: number;
export const crypto_generichash_KEYBYTES_MAX: number;
export const crypto_generichash_KEYBYTES_MIN: number;
export const crypto_hash_BYTES: number;
export const crypto_kdf_BYTES_MAX: number;
export const crypto_kdf_BYTES_MIN: number;
export const crypto_kdf_CONTEXTBYTES: number;
export const crypto_kdf_KEYBYTES: number;
export const crypto_kx_PUBLICKEYBYTES: number;
export const crypto_kx_SECRETKEYBYTES: number;
export const crypto_kx_SEEDBYTES: number;
export const crypto_kx_SESSIONKEYBYTES: number;
export const crypto_pwhash_ALG_ARGON2I13: number;
export const crypto_pwhash_ALG_ARGON2ID13: number;
export const crypto_pwhash_ALG_DEFAULT: number;
export const crypto_pwhash_BYTES_MAX: number;
export const crypto_pwhash_BYTES_MIN: number;
export const crypto_pwhash_MEMLIMIT_INTERACTIVE: number;
export const crypto_pwhash_MEMLIMIT_MAX: number;
export const crypto_pwhash_MEMLIMIT_MIN: number;
export const crypto_pwhash_MEMLIMIT_MODERATE: number;
export const crypto_pwhash_MEMLIMIT_SENSITIVE: number;
export const crypto_pwhash_OPSLIMIT_INTERACTIVE: number;
export const crypto_pwhash_OPSLIMIT_MAX: number;
export const crypto_pwhash_OPSLIMIT_MIN: number;
export const crypto_pwhash_OPSLIMIT_MODERATE: number;
export const crypto_pwhash_OPSLIMIT_SENSITIVE: number;
export const crypto_pwhash_PASSWD_MAX: number;
export const crypto_pwhash_PASSWD_MIN: number;
export const crypto_pwhash_SALTBYTES: number;
export const crypto_pwhash_STRBYTES: number;
export const crypto_pwhash_STRPREFIX: string;
export const crypto_pwhash_STR_VERIFY: number;
export const crypto_scalarmult_BYTES: number;
export const crypto_scalarmult_SCALARBYTES: number;
export const crypto_secretbox_KEYBYTES: number;
export const crypto_secretbox_MACBYTES: number;
export const crypto_secretbox_MESSAGEBYTES_MAX: number;
export const crypto_secretbox_NONCEBYTES: number;
export const crypto_secretstream_xchacha20poly1305_ABYTES: number;
export const crypto_secretstream_xchacha20poly1305_HEADERBYTES: number;
export const crypto_secretstream_xchacha20poly1305_KEYBYTES: number;
export const crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX: number;
export const crypto_secretstream_xchacha20poly1305_MESSAGESBYTES_MAX: number;
export const crypto_secretstream_xchacha20poly1305_NPUBBYTES: number;
export const crypto_secretstream_xchacha20poly1305_TAG_FINAL: number;
export const crypto_secretstream_xchacha20poly1305_TAG_MESSAGE: number;
export const crypto_secretstream_xchacha20poly1305_TAG_PUSH: number;
export const crypto_secretstream_xchacha20poly1305_TAG_REKEY: number;
export const crypto_shorthash_BYTES: number;
export const crypto_shorthash_KEYBYTES: number;
export const crypto_sign_BYTES: number;
export const crypto_sign_MESSAGEBYTES_MAX: number;
export const crypto_sign_PUBLICKEYBYTES: number;
export const crypto_sign_SECRETKEYBYTES: number;
export const crypto_sign_SEEDBYTES: number;
export const crypto_stream_MESSAGEBYTES_MAX: number;
export const crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX: number;
export const crypto_stream_xchacha20_MESSAGEBYTES_MAX: number;
export const randombytes_SEEDBYTES: number;
export const ready: Promise<void>;
export function add(a: Uint8Array, b: Uint8Array): void;
export function compare(b1: Uint8Array, b2: Uint8Array): number;
export function crypto_aead_chacha20poly1305_decrypt(
secret_nonce?: string | Uint8Array | null,
ciphertext?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_aead_chacha20poly1305_decrypt(
secret_nonce?: string | Uint8Array | null,
ciphertext?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_aead_chacha20poly1305_decrypt_detached(
secret_nonce?: string | Uint8Array | null,
ciphertext?: string | Uint8Array,
mac?: Uint8Array,
additional_data?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_aead_chacha20poly1305_decrypt_detached(
secret_nonce?: string | Uint8Array | null,
ciphertext?: string | Uint8Array,
mac?: Uint8Array,
additional_data?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_aead_chacha20poly1305_encrypt(
message?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
secret_nonce?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_aead_chacha20poly1305_encrypt(
message?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
secret_nonce?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_aead_chacha20poly1305_encrypt_detached(
message?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
secret_nonce?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): CryptoBox;
export function crypto_aead_chacha20poly1305_encrypt_detached(
message?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
secret_nonce?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: StringOutputFormat | null,
): StringCryptoBox;
export function crypto_aead_chacha20poly1305_ietf_decrypt(
secret_nonce?: string | Uint8Array | null,
ciphertext?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_aead_chacha20poly1305_ietf_decrypt(
secret_nonce?: string | Uint8Array | null,
ciphertext?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_aead_chacha20poly1305_ietf_decrypt_detached(
secret_nonce?: string | Uint8Array | null,
ciphertext?: string | Uint8Array,
mac?: Uint8Array,
additional_data?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_aead_chacha20poly1305_ietf_decrypt_detached(
secret_nonce?: string | Uint8Array | null,
ciphertext?: string | Uint8Array,
mac?: Uint8Array,
additional_data?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_aead_chacha20poly1305_ietf_encrypt(
message?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
secret_nonce?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_aead_chacha20poly1305_ietf_encrypt(
message?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
secret_nonce?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_aead_chacha20poly1305_ietf_encrypt_detached(
message?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
secret_nonce?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): CryptoBox;
export function crypto_aead_chacha20poly1305_ietf_encrypt_detached(
message?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
secret_nonce?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: StringOutputFormat | null,
): StringCryptoBox;
export function crypto_aead_chacha20poly1305_ietf_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_aead_chacha20poly1305_ietf_keygen(outputFormat?: StringOutputFormat | null): string;
export function crypto_aead_chacha20poly1305_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_aead_chacha20poly1305_keygen(outputFormat?: StringOutputFormat | null): string;
export function crypto_aead_xchacha20poly1305_ietf_decrypt(
secret_nonce?: string | Uint8Array | null,
ciphertext?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_aead_xchacha20poly1305_ietf_decrypt(
secret_nonce?: string | Uint8Array | null,
ciphertext?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_aead_xchacha20poly1305_ietf_decrypt_detached(
secret_nonce?: string | Uint8Array | null,
ciphertext?: string | Uint8Array,
mac?: Uint8Array,
additional_data?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_aead_xchacha20poly1305_ietf_decrypt_detached(
secret_nonce?: string | Uint8Array | null,
ciphertext?: string | Uint8Array,
mac?: Uint8Array,
additional_data?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_aead_xchacha20poly1305_ietf_encrypt(
message?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
secret_nonce?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_aead_xchacha20poly1305_ietf_encrypt(
message?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
secret_nonce?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_aead_xchacha20poly1305_ietf_encrypt_detached(
message?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
secret_nonce?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): CryptoBox;
export function crypto_aead_xchacha20poly1305_ietf_encrypt_detached(
message?: string | Uint8Array,
additional_data?: string | Uint8Array | null,
secret_nonce?: string | Uint8Array | null,
public_nonce?: Uint8Array,
key?: Uint8Array,
outputFormat?: StringOutputFormat | null,
): StringCryptoBox;
export function crypto_aead_xchacha20poly1305_ietf_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_aead_xchacha20poly1305_ietf_keygen(outputFormat?: StringOutputFormat | null): string;
export function crypto_auth(
message: string | Uint8Array,
key: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_auth(
message: string | Uint8Array,
key: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_auth_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_auth_keygen(outputFormat?: StringOutputFormat | null): string;
export function crypto_auth_verify(tag: Uint8Array, message: string | Uint8Array, key: Uint8Array): boolean;
export function crypto_box_beforenm(
publicKey: Uint8Array,
privateKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_box_beforenm(
publicKey: Uint8Array,
privateKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_box_detached(
message: string | Uint8Array,
nonce: Uint8Array,
publicKey: Uint8Array,
privateKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): CryptoBox;
export function crypto_box_detached(
message: string | Uint8Array,
nonce: Uint8Array,
publicKey: Uint8Array,
privateKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): StringCryptoBox;
export function crypto_box_easy(
message: string | Uint8Array,
nonce: Uint8Array,
publicKey: Uint8Array,
privateKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_box_easy(
message: string | Uint8Array,
nonce: Uint8Array,
publicKey: Uint8Array,
privateKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_box_easy_afternm(
message: string | Uint8Array,
nonce: Uint8Array,
sharedKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_box_easy_afternm(
message: string | Uint8Array,
nonce: Uint8Array,
sharedKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_box_keypair(outputFormat?: Uint8ArrayOutputFormat | null): KeyPair;
export function crypto_box_keypair(outputFormat?: StringOutputFormat | null): StringKeyPair;
export function crypto_box_open_detached(
ciphertext: string | Uint8Array,
mac: Uint8Array,
nonce: Uint8Array,
publicKey: Uint8Array,
privateKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_box_open_detached(
ciphertext: string | Uint8Array,
mac: Uint8Array,
nonce: Uint8Array,
publicKey: Uint8Array,
privateKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_box_open_easy(
ciphertext: string | Uint8Array,
nonce: Uint8Array,
publicKey: Uint8Array,
privateKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_box_open_easy(
ciphertext: string | Uint8Array,
nonce: Uint8Array,
publicKey: Uint8Array,
privateKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_box_open_easy_afternm(
ciphertext: string | Uint8Array,
nonce: Uint8Array,
sharedKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_box_open_easy_afternm(
ciphertext: string | Uint8Array,
nonce: Uint8Array,
sharedKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_box_seal(
message: string | Uint8Array,
publicKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_box_seal(
message: string | Uint8Array,
publicKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_box_seal_open(
ciphertext: string | Uint8Array,
publicKey: Uint8Array,
privateKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_box_seal_open(
ciphertext: string | Uint8Array,
publicKey: Uint8Array,
privateKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_box_seed_keypair(seed: Uint8Array, outputFormat?: Uint8ArrayOutputFormat | null): KeyPair;
export function crypto_box_seed_keypair(seed: Uint8Array, outputFormat?: StringOutputFormat | null): StringKeyPair;
export function crypto_generichash(
hash_length?: number,
message?: string | Uint8Array,
key?: string | Uint8Array | null,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_generichash(
hash_length?: number,
message?: string | Uint8Array,
key?: string | Uint8Array | null,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_generichash_final(
state_address: generichash_state_address,
hash_length: number,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_generichash_final(
state_address: generichash_state_address,
hash_length: number,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_generichash_init(key?: string | Uint8Array | null, hash_length?: number): state_address;
export function crypto_generichash_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_generichash_keygen(outputFormat?: StringOutputFormat | null): string;
export function crypto_generichash_update(
state_address: generichash_state_address,
message_chunk: string | Uint8Array,
): void;
export function crypto_hash(message: string | Uint8Array, outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_hash(message: string | Uint8Array, outputFormat?: StringOutputFormat | null): string;
export function crypto_kdf_derive_from_key(
subkey_len: number,
subkey_id: number,
ctx: string,
key: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_kdf_derive_from_key(
subkey_len: number,
subkey_id: number,
ctx: string,
key: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_kdf_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_kdf_keygen(outputFormat?: StringOutputFormat | null): string;
export function crypto_kx_client_session_keys(
clientPublicKey: Uint8Array,
clientSecretKey: Uint8Array,
serverPublicKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): CryptoKX;
export function crypto_kx_client_session_keys(
clientPublicKey: Uint8Array,
clientSecretKey: Uint8Array,
serverPublicKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): StringCryptoKX;
export function crypto_kx_keypair(outputFormat?: Uint8ArrayOutputFormat | null): KeyPair;
export function crypto_kx_keypair(outputFormat?: StringOutputFormat | null): StringKeyPair;
export function crypto_kx_seed_keypair(seed: Uint8Array, outputFormat?: Uint8ArrayOutputFormat | null): KeyPair;
export function crypto_kx_seed_keypair(seed: Uint8Array, outputFormat?: StringOutputFormat | null): StringKeyPair;
export function crypto_kx_server_session_keys(
serverPublicKey: Uint8Array,
serverSecretKey: Uint8Array,
clientPublicKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): CryptoKX;
export function crypto_kx_server_session_keys(
serverPublicKey: Uint8Array,
serverSecretKey: Uint8Array,
clientPublicKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): StringCryptoKX;
export function crypto_pwhash(
keyLength: number,
password: string | Uint8Array,
salt: Uint8Array,
opsLimit: number,
memLimit: number,
algorithm: number,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_pwhash(
keyLength: number,
password: string | Uint8Array,
salt: Uint8Array,
opsLimit: number,
memLimit: number,
algorithm: number,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_pwhash_str(password: string | Uint8Array, opsLimit: number, memLimit: number): string;
export function crypto_pwhash_str_verify(hashed_password: string, password: string | Uint8Array): boolean;
export function crypto_scalarmult(
privateKey: Uint8Array,
publicKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_scalarmult(
privateKey: Uint8Array,
publicKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_scalarmult_base(
privateKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_scalarmult_base(privateKey: Uint8Array, outputFormat?: StringOutputFormat | null): string;
export function crypto_secretbox_detached(
message: string | Uint8Array,
nonce: Uint8Array,
key: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): SecretBox;
export function crypto_secretbox_detached(
message: string | Uint8Array,
nonce: Uint8Array,
key: Uint8Array,
outputFormat?: StringOutputFormat | null,
): StringSecretBox;
export function crypto_secretbox_easy(
message: string | Uint8Array,
nonce: Uint8Array,
key: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_secretbox_easy(
message: string | Uint8Array,
nonce: Uint8Array,
key: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_secretbox_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_secretbox_keygen(outputFormat?: StringOutputFormat | null): string;
export function crypto_secretbox_open_detached(
ciphertext: string | Uint8Array,
mac: Uint8Array,
nonce: Uint8Array,
key: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_secretbox_open_detached(
ciphertext: string | Uint8Array,
mac: Uint8Array,
nonce: Uint8Array,
key: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_secretbox_open_easy(
ciphertext: string | Uint8Array,
nonce: Uint8Array,
key: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_secretbox_open_easy(
ciphertext: string | Uint8Array,
nonce: Uint8Array,
key: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_secretstream_xchacha20poly1305_init_pull(header: Uint8Array, key: Uint8Array): state_address;
export function crypto_secretstream_xchacha20poly1305_init_push(
key: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): { state: state_address; header: Uint8Array };
export function crypto_secretstream_xchacha20poly1305_init_push(
key: Uint8Array,
outputFormat?: StringOutputFormat | null,
): { state: state_address; header: string };
export function crypto_secretstream_xchacha20poly1305_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_secretstream_xchacha20poly1305_keygen(outputFormat?: StringOutputFormat | null): string;
export function crypto_secretstream_xchacha20poly1305_pull(
state_address: secretstream_xchacha20poly1305_state_address,
cipher: string | Uint8Array,
ad?: string | Uint8Array | null,
outputFormat?: Uint8ArrayOutputFormat | null,
): { message: Uint8Array; tag: number };
export function crypto_secretstream_xchacha20poly1305_pull(
state_address: secretstream_xchacha20poly1305_state_address,
cipher: string | Uint8Array,
ad?: string | Uint8Array | null,
outputFormat?: StringOutputFormat | null,
): { message: string; tag: number };
export function crypto_secretstream_xchacha20poly1305_push(
state_address: secretstream_xchacha20poly1305_state_address,
message_chunk: string | Uint8Array,
ad?: string | Uint8Array | null,
tag?: number,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_secretstream_xchacha20poly1305_push(
state_address: secretstream_xchacha20poly1305_state_address,
message_chunk: string | Uint8Array,
ad?: string | Uint8Array | null,
tag?: number,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_secretstream_xchacha20poly1305_rekey(
state_address: secretstream_xchacha20poly1305_state_address,
): true;
export function crypto_shorthash(
message: string | Uint8Array,
key: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_shorthash(
message: string | Uint8Array,
key: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_shorthash_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_shorthash_keygen(outputFormat?: StringOutputFormat | null): string;
export function crypto_sign(
message: string | Uint8Array,
privateKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_sign(
message: string | Uint8Array,
privateKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_sign_detached(
message: string | Uint8Array,
privateKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_sign_detached(
message: string | Uint8Array,
privateKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_sign_ed25519_pk_to_curve25519(
edPk: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_sign_ed25519_pk_to_curve25519(
edPk: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_sign_ed25519_sk_to_curve25519(
edSk: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_sign_ed25519_sk_to_curve25519(
edSk: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_sign_final_create(
state_address: sign_state_address,
privateKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_sign_final_create(
state_address: sign_state_address,
privateKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_sign_final_verify(
state_address: sign_state_address,
signature: Uint8Array,
publicKey: Uint8Array,
): boolean;
export function crypto_sign_init(): state_address;
export function crypto_sign_keypair(outputFormat?: Uint8ArrayOutputFormat | null): KeyPair;
export function crypto_sign_keypair(outputFormat?: StringOutputFormat | null): StringKeyPair;
export function crypto_sign_open(
signedMessage: string | Uint8Array,
publicKey: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_sign_open(
signedMessage: string | Uint8Array,
publicKey: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_sign_seed_keypair(seed: Uint8Array, outputFormat?: Uint8ArrayOutputFormat | null): KeyPair;
export function crypto_sign_seed_keypair(seed: Uint8Array, outputFormat?: StringOutputFormat | null): StringKeyPair;
export function crypto_sign_update(state_address: sign_state_address, message_chunk: string | Uint8Array): void;
export function crypto_sign_verify_detached(
signature: Uint8Array,
message: string | Uint8Array,
publicKey: Uint8Array,
): boolean;
export function crypto_stream_keygen(outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_stream_keygen(outputFormat?: StringOutputFormat | null): string;
export function from_base64(input: string, variant?: base64_variants): Uint8Array;
export function from_hex(input: string): Uint8Array;
export function from_string(str: string): Uint8Array;
export function increment(bytes: Uint8Array): void;
export function is_zero(bytes: Uint8Array): boolean;
export function memcmp(b1: Uint8Array, b2: Uint8Array): boolean;
export function memzero(bytes: Uint8Array): void;
export function pad(buf: Uint8Array, blocksize: number): Uint8Array;
export function randombytes_buf(length: number, outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function randombytes_buf(length: number, outputFormat?: StringOutputFormat | null): string;
export function randombytes_buf_deterministic(
length: number,
seed: Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function randombytes_buf_deterministic(
length: number,
seed: Uint8Array,
outputFormat?: StringOutputFormat | null,
): string;
export function randombytes_close(): void;
export function randombytes_random(): number;
export function randombytes_set_implementation(implementation: Uint8Array): void;
export function randombytes_stir(): void;
export function randombytes_uniform(upper_bound: number): number;
export function sodium_version_string(): string;
export function symbols(): string[];
export function to_base64(input: string | Uint8Array, variant?: base64_variants): string;
export function to_hex(input: string | Uint8Array): string;
export function to_string(bytes: Uint8Array): string;
export function unpad(buf: Uint8Array, blocksize: number): Uint8Array;