UNPKG

@hazae41/kdbx

Version:

Rust-like KeePass (KDBX 4) file format for TypeScript

124 lines (121 loc) 4.24 kB
import { Opaque } from '@hazae41/binary'; import { Cursor } from '@hazae41/cursor'; import { HeadersAndContentWithBytes } from './headers/inner/index.js'; import * as index from './headers/inner/index.js'; export { index as Inner }; import { MagicAndVersionAndHeadersWithBytesWithHashAndHmacWithKeys, MagicAndVersionAndHeadersWithBytesWithHashAndHmac } from './headers/outer/index.js'; import * as index$1 from './headers/outer/index.js'; export { index$1 as Outer }; declare class PasswordKey { #private; readonly value: Opaque<32>; constructor(value: Opaque<32>); static digestOrThrow(password: Uint8Array): Promise<PasswordKey>; } declare class CompositeKey { #private; readonly value: Opaque<32>; constructor(value: Opaque<32>); static digestOrThrow(password: PasswordKey): Promise<CompositeKey>; } declare class DerivedKey { #private; readonly value: Opaque<32>; constructor(value: Opaque<32>); } declare class PreMasterKey { #private; readonly seed: Opaque<32>; readonly hash: DerivedKey; constructor(seed: Opaque<32>, hash: DerivedKey); sizeOrThrow(): number; writeOrThrow(cursor: Cursor): void; digestOrThrow(): Promise<MasterKey>; } declare class MasterKey { #private; readonly value: Opaque<32>; constructor(value: Opaque<32>); } declare class PreHmacMasterKey { #private; readonly seed: Opaque<32>; readonly hash: DerivedKey; constructor(seed: Opaque<32>, hash: DerivedKey); sizeOrThrow(): number; writeOrThrow(cursor: Cursor): void; digestOrThrow(): Promise<HmacMasterKey>; } declare class HmacMasterKey { #private; readonly bytes: Opaque<64>; constructor(bytes: Opaque<64>); } declare class MasterKeys { #private; readonly encrypter: MasterKey; readonly authifier: HmacMasterKey; constructor(encrypter: MasterKey, authifier: HmacMasterKey); } declare namespace Database { class Decrypted { readonly outer: MagicAndVersionAndHeadersWithBytesWithHashAndHmacWithKeys; readonly inner: HeadersAndContentWithBytes; constructor(outer: MagicAndVersionAndHeadersWithBytesWithHashAndHmacWithKeys, inner: HeadersAndContentWithBytes); rotateOrThrow(composite: CompositeKey): Promise<Decrypted>; encryptOrThrow(): Promise<Encrypted>; } class Encrypted { readonly outer: MagicAndVersionAndHeadersWithBytesWithHashAndHmac; readonly inner: Blocks; constructor(outer: MagicAndVersionAndHeadersWithBytesWithHashAndHmac, inner: Blocks); sizeOrThrow(): number; writeOrThrow(cursor: Cursor): void; cloneOrThrow(): Encrypted; decryptOrThrow(composite: CompositeKey): Promise<Decrypted>; } namespace Encrypted { function readOrThrow(cursor: Cursor): Encrypted; } } declare class Blocks { readonly blocks: BlockWithIndex[]; constructor(blocks: BlockWithIndex[]); sizeOrThrow(): number; writeOrThrow(cursor: Cursor): void; cloneOrThrow(): Blocks; } declare namespace Blocks { function readOrThrow(cursor: Cursor): Blocks; } declare class BlockWithIndexPreHmacData { readonly index: bigint; readonly block: Opaque; constructor(index: bigint, block: Opaque); sizeOrThrow(): number; writeOrThrow(cursor: Cursor): void; } declare class BlockWithIndex { readonly index: bigint; readonly block: Block; constructor(index: bigint, block: Block); sizeOrThrow(): number; writeOrThrow(cursor: Cursor): void; cloneOrThrow(): BlockWithIndex; verifyOrThrow(keys: MasterKeys): Promise<void>; } declare namespace BlockWithIndex { function fromOrThrow(keys: MasterKeys, index: bigint, data: Uint8Array): Promise<BlockWithIndex>; } declare class Block { readonly hmac: Opaque<32>; readonly data: Opaque; constructor(hmac: Opaque<32>, data: Opaque); sizeOrThrow(): number; writeOrThrow(cursor: Cursor): void; cloneOrThrow(): Block; } declare namespace Block { function readOrThrow(cursor: Cursor): Block; } export { Block, BlockWithIndex, BlockWithIndexPreHmacData, Blocks, CompositeKey, Database, DerivedKey, HmacMasterKey, MasterKey, MasterKeys, PasswordKey, PreHmacMasterKey, PreMasterKey };