UNPKG

1.32 kBTypeScriptView Raw
1import { BoxKeyPair } from "tweetnacl";
2import { HAPEncryption } from "./eventedhttp";
3/**
4 * @group Cryptography
5 */
6export declare function generateCurve25519KeyPair(): BoxKeyPair;
7/**
8 * @group Cryptography
9 */
10export declare function generateCurve25519SharedSecKey(priKey: Uint8Array, pubKey: Uint8Array): Uint8Array;
11/**
12 * @group Cryptography
13 */
14export declare function HKDF(hashAlg: string, salt: Buffer, ikm: Buffer, info: Buffer, size: number): Buffer;
15/**
16 * @group Utils
17 */
18export declare function writeUInt64LE(number: number, buffer: Buffer, offset?: number): void;
19/**
20 * @group Cryptography
21 */
22export declare function chacha20_poly1305_decryptAndVerify(key: Buffer, nonce: Buffer, aad: Buffer | null, ciphertext: Buffer, authTag: Buffer): Buffer;
23/**
24 * @group Cryptography
25 */
26export interface EncryptedData {
27 ciphertext: Buffer;
28 authTag: Buffer;
29}
30/**
31 * @group Cryptography
32 */
33export declare function chacha20_poly1305_encryptAndSeal(key: Buffer, nonce: Buffer, aad: Buffer | null, plaintext: Buffer): EncryptedData;
34/**
35 * @group Cryptography
36 */
37export declare function layerEncrypt(data: Buffer, encryption: HAPEncryption): Buffer;
38/**
39 * @group Cryptography
40 */
41export declare function layerDecrypt(packet: Buffer, encryption: HAPEncryption): Buffer;
42//# sourceMappingURL=hapCrypto.d.ts.map
\No newline at end of file