@hazae41/chacha20poly1305
Version:
ChaCha20Poly1305 adapter for WebAssembly and JS implementations
33 lines (32 loc) • 1.1 kB
TypeScript
export declare namespace Abstract {
type MemoryLike = Memory | Uint8Array;
abstract class Memory implements Disposable {
abstract [Symbol.dispose](): void;
abstract readonly inner: unknown;
abstract readonly bytes: Uint8Array;
}
namespace Memory {
interface Static {
fromOrThrow(memory: MemoryLike): Memory;
}
}
abstract class ChaCha20Cipher implements Disposable {
abstract [Symbol.dispose](): void;
abstract applyOrThrow(message: Memory): void;
}
namespace ChaCha20Cipher {
interface Static {
importOrThrow(key: Memory, nonce: Memory): ChaCha20Cipher;
}
}
abstract class ChaCha20Poly1305Cipher implements Disposable {
abstract [Symbol.dispose](): void;
abstract encryptOrThrow(message: Memory, nonce: Memory): Memory;
abstract decryptOrThrow(message: Memory, nonce: Memory): Memory;
}
namespace ChaCha20Poly1305Cipher {
interface Static {
importOrThrow(key: Memory): ChaCha20Poly1305Cipher;
}
}
}