libsodium.common.d.ts 4.1 KB
Newer Older
David Burke's avatar
David Burke committed
1 2 3 4 5
export interface IKeyPair {
    keyType?: string;
    privateKey: Uint8Array;
    publicKey: Uint8Array;
}
David Burke's avatar
David Burke committed
6
export declare class Common {
David Burke's avatar
David Burke committed
7
    static BASE64_FLAGS: number;
8 9 10 11 12 13 14
    static base64_variants: {
        ORIGINAL: number;
        ORIGINAL_NO_PADDING: number;
        URLSAFE: number;
        URLSAFE_NO_PADDING: number;
    };
    static ready: Promise<void>;
David Burke's avatar
David Burke committed
15
    private static javaByteArrayToUint8Array(javaBytes);
16
    private static Uint8ArrayToJavaByteArray(inBytes);
17 18
    static to_base64(aBytes: Uint8Array, variant?: any): string;
    static from_base64(sBase64: string, variant?: any): Uint8Array;
David Burke's avatar
David Burke committed
19 20
    static randombytes_buf(length: number): Uint8Array;
    static crypto_box_keypair(): IKeyPair;
David Burke's avatar
David Burke committed
21
    static crypto_pwhash(keyLength: number, password: string | Uint8Array, salt: Uint8Array, opsLimit: number, memlimit: number, algorithm: number): Uint8Array;
22 23
    private static force_bytes(input);
    private static force_java_bytes(input);
David Burke's avatar
David Burke committed
24
    private static trimJavaBytes(input);
25
    static crypto_secretbox_easy(message: string | Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array;
David Burke's avatar
David Burke committed
26
    static crypto_secretbox_open_easy(ciphertext: Uint8Array, nonce: Uint8Array, key: Uint8Array): Uint8Array;
27 28
    static crypto_box_seal(message: string | Uint8Array, publicKey: Uint8Array): Uint8Array;
    static crypto_box_seal_open(ciphertext: Uint8Array, publicKey: Uint8Array, secretKey: Uint8Array): Uint8Array;
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
    static readonly crypto_aead_chacha20poly1305_ABYTES: number;
    static readonly crypto_aead_chacha20poly1305_KEYBYTES: number;
    static readonly crypto_aead_chacha20poly1305_NPUBBYTES: number;
    static readonly crypto_aead_chacha20poly1305_NSECBYTES: number;
    static readonly crypto_auth_BYTES: number;
    static readonly crypto_auth_KEYBYTES: number;
    static readonly crypto_auth_hmacsha256_BYTES: number;
    static readonly crypto_auth_hmacsha256_KEYBYTES: number;
    static readonly crypto_auth_hmacsha512_BYTES: number;
    static readonly crypto_auth_hmacsha512_KEYBYTES: number;
    static readonly crypto_box_BEFORENMBYTES: number;
    static readonly crypto_box_MACBYTES: number;
    static readonly crypto_box_NONCEBYTES: number;
    static readonly crypto_box_PUBLICKEYBYTES: number;
    static readonly crypto_box_SEALBYTES: number;
    static readonly crypto_box_SECRETKEYBYTES: number;
David Burke's avatar
David Burke committed
45
    static readonly crypto_box_SEEDBYTES: number;
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
    static readonly crypto_generichash_BYTES: number;
    static readonly crypto_generichash_BYTES_MAX: number;
    static readonly crypto_generichash_BYTES_MIN: number;
    static readonly crypto_generichash_KEYBYTES: number;
    static readonly crypto_generichash_KEYBYTES_MAX: number;
    static readonly crypto_generichash_KEYBYTES_MIN: number;
    static readonly crypto_onetimeauth_BYTES: number;
    static readonly crypto_onetimeauth_KEYBYTES: number;
    static readonly crypto_pwhash_ALG_ARGON2I13: number;
    static readonly crypto_pwhash_ALG_DEFAULT: number;
    static readonly crypto_pwhash_MEMLIMIT_INTERACTIVE: number;
    static readonly crypto_pwhash_MEMLIMIT_MODERATE: number;
    static readonly crypto_pwhash_MEMLIMIT_SENSITIVE: number;
    static readonly crypto_pwhash_OPSLIMIT_INTERACTIVE: number;
    static readonly crypto_pwhash_OPSLIMIT_MODERATE: number;
    static readonly crypto_pwhash_OPSLIMIT_SENSITIVE: number;
    static readonly crypto_pwhash_SALTBYTES: number;
    static readonly crypto_pwhash_STRBYTES: number;
    static readonly crypto_scalarmult_BYTES: number;
    static readonly crypto_scalarmult_SCALARBYTES: number;
    static readonly crypto_secretbox_KEYBYTES: number;
    static readonly crypto_secretbox_MACBYTES: number;
    static readonly crypto_secretbox_NONCEBYTES: number;
    static readonly crypto_shorthash_BYTES: number;
    static readonly crypto_shorthash_KEYBYTES: number;
    static readonly crypto_sign_BYTES: number;
    static readonly crypto_sign_PUBLICKEYBYTES: number;
    static readonly crypto_sign_SECRETKEYBYTES: number;
    static readonly crypto_sign_SEEDBYTES: number;
    static readonly crypto_stream_chacha20_KEYBYTES: number;
    static readonly crypto_stream_chacha20_NONCEBYTES: number;
David Burke's avatar
David Burke committed
77
    static DEMO_MSG(): string;
78
}