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