@hazae41/chacha20poly1305
Version:
ChaCha20Poly1305 adapter for WebAssembly and JS implementations
121 lines (118 loc) • 5.03 kB
TypeScript
import { ChaCha20Poly1305Wasm } from '@hazae41/chacha20poly1305.wasm';
import { Lengthed } from '@hazae41/lengthed';
import { Ownable } from '../../libs/ownable/index.js';
import { Abstract } from './abstract.js';
declare function fromWasm(Wasm: typeof ChaCha20Poly1305Wasm): {
Memory: {
new <N extends number = number>(inner: ChaCha20Poly1305Wasm.Memory): {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
};
fromOrThrow<N extends number = number>(memory: Abstract.Memory<N>): Ownable<{
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N_1>;
[Symbol.dispose](): void;
}>;
importOrThrow<N extends number = number>(bytes: Uint8Array & Lengthed<N>): {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N_1>;
[Symbol.dispose](): void;
};
};
ChaCha20Cipher: {
new (inner: ChaCha20Poly1305Wasm.ChaCha20Cipher): {
readonly inner: ChaCha20Poly1305Wasm.ChaCha20Cipher;
applyOrThrow(message: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}): void;
[Symbol.dispose](): void;
};
importOrThrow(key: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}, nonce: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}): {
readonly inner: ChaCha20Poly1305Wasm.ChaCha20Cipher;
applyOrThrow(message: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}): void;
[Symbol.dispose](): void;
};
};
ChaCha20Poly1305Cipher: {
new (inner: ChaCha20Poly1305Wasm.ChaCha20Poly1305Cipher): {
readonly inner: ChaCha20Poly1305Wasm.ChaCha20Poly1305Cipher;
encryptOrThrow(message: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}, nonce: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}): {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
};
decryptOrThrow(message: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}, nonce: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}): {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
};
[Symbol.dispose](): void;
};
importOrThrow(key: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}): {
readonly inner: ChaCha20Poly1305Wasm.ChaCha20Poly1305Cipher;
encryptOrThrow(message: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}, nonce: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}): {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
};
decryptOrThrow(message: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}, nonce: {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
}): {
readonly inner: ChaCha20Poly1305Wasm.Memory;
readonly bytes: Uint8Array & Lengthed<N>;
[Symbol.dispose](): void;
};
[Symbol.dispose](): void;
};
};
};
export { fromWasm };