Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions vendor/hypercore/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ declare namespace Hypercore {

type ValueEncoding = 'json' | 'utf-8' | 'binary'

interface EncryptionOptions {
key?: Buffer
block?: boolean
}

interface HypercoreOptions<
TValueEncoding extends Hypercore.ValueEncoding = 'binary',
TKey extends Buffer | string | undefined = undefined
Expand All @@ -101,11 +106,14 @@ declare namespace Hypercore {
encodeBatch?(batch: any[]): void // optionally apply an encoding to complete batches
key: TKey
keyPair?: KeyPair // optionally pass the public key and secret key as a key pair
/**
* @deprecated Replaced with `encryption` field
*/
encryptionKey?: Buffer // optionally pass an encryption key to enable block encryption
encryption?: EncryptionOptions
onwait?: () => {} // hook that is called if gets are waiting for download
timeout?: number // wait at max some milliseconds (0 means no timeout)
writable?: boolean // disable appends and truncates
preload?: () => PromiseLike<Partial<HypercoreOptions<TValueEncoding, TKey>>>
}

interface HypercoreGetOptions<
Expand Down Expand Up @@ -196,8 +204,8 @@ declare class Hypercore<
: unknown)
>
/** Check if the core has all blocks between start and end. */
has(index: number): boolean
has(start: number, end: number): boolean
has(index: number): Promise<boolean>
has(start: number, end: number): Promise<boolean>
update(opts?: { wait?: boolean }): Promise<void>
seek(
byteOffset: number,
Expand Down