OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-push / index.d.ts

27 lines · typescript ref:
declare module "@holepunchto/keet-push" {
  import DHT from "hyperdht"
  import Hypercore from "hypercore"
  import { type CompactEncoding } from "compact-encoding"

  export default class KeetPush {
    constructor(keys: Array<Uint8Array | String>, options?: { dht?: DHT })

    setDHT(dht: DHT): void
    setGatewayKeys(keys: Array<Uint8Array | String>): void

    send(
      sender: Hypercore,
      roomKey: Uint8Array,
      roomDiscoveryKey?: Uint8Array
    ): Promise<void>

    destroy(): Promise<void>

    static requestEncoding: CompactEncoding
    static receive(
      corestoreStoragePath: string,
      buffer: Uint8Array
    ): Promise<null | { roomKey: Uint8Array; roomTitle: string }>
  }
}