Path: blob/master/node_modules/@adiwajshing/baileys/lib/Utils/crypto.d.ts
1129 views
/// <reference types="node" />1import { KeyPair } from '../Types';2/** prefix version byte to the pub keys, required for some curve crypto functions */3export declare const generateSignalPubKey: (pubKey: Uint8Array | Buffer) => Buffer | Uint8Array;4export declare const Curve: {5generateKeyPair: () => KeyPair;6sharedKey: (privateKey: Uint8Array, publicKey: Uint8Array) => Buffer;7sign: (privateKey: Uint8Array, buf: Uint8Array) => any;8verify: (pubKey: Uint8Array, message: Uint8Array, signature: Uint8Array) => boolean;9};10export declare const signedKeyPair: (identityKeyPair: KeyPair, keyId: number) => {11keyPair: KeyPair;12signature: any;13keyId: number;14};15/**16* encrypt AES 256 GCM;17* where the tag tag is suffixed to the ciphertext18* */19export declare function aesEncryptGCM(plaintext: Uint8Array, key: Uint8Array, iv: Uint8Array, additionalData: Uint8Array): Buffer;20/**21* decrypt AES 256 GCM;22* where the auth tag is suffixed to the ciphertext23* */24export declare function aesDecryptGCM(ciphertext: Uint8Array, key: Uint8Array, iv: Uint8Array, additionalData: Uint8Array): Buffer;25/** decrypt AES 256 CBC; where the IV is prefixed to the buffer */26export declare function aesDecrypt(buffer: Buffer, key: Buffer): Buffer;27/** decrypt AES 256 CBC */28export declare function aesDecryptWithIV(buffer: Buffer, key: Buffer, IV: Buffer): Buffer;29export declare function aesEncrypt(buffer: Buffer | Uint8Array, key: Buffer): Buffer;30export declare function aesEncrypWithIV(buffer: Buffer, key: Buffer, IV: Buffer): Buffer;31export declare function hmacSign(buffer: Buffer | Uint8Array, key: Buffer | Uint8Array, variant?: 'sha256' | 'sha512'): Buffer;32export declare function sha256(buffer: Buffer): Buffer;33export declare function hkdf(buffer: Uint8Array | Buffer, expandedLength: number, info: {34salt?: Buffer;35info?: string;36}): Buffer;373839