Skip to main content

Bucket

A client to a single Blyss bucket.

You should not need to construct this object directly. Instead, call client.connect() to connect to an existing bucket, or client.create() to create a new one.

You can serialize and deserialize this object using toSecretSeed() and client.connect(bucketName, secretSeed).

Index

Properties

readonlyapi

api: Api

The target API to send all underlying API calls to.

batchSize

batchSize: number = 5

The maximum size of query batches sent to the service. Must be greater than 0.

dpLib

dpLib: DoublePIRApiClient

The inner DoublePIR WASM client for this instance of the client.

optionalhint

hint?: Uint8Array

The cached hint downloaded from a checklist-enabled bucket.

lib

lib: BlyssLib

The inner WASM client for this instance of the client.

metadata

metadata: any

The metadata of this bucket.

name

name: string

The name of this bucket.

scheme

scheme: spiral | doublepir

The underlying PIR scheme to use to access this bucket.

optionalreadonlysecretSeed

secretSeed?: string

The secret seed for this instance of the client, which can be saved and then later used to restore state.

optionaluuid

uuid?: string

The public UUID of this client’s public parameters.

Methods

checkInclusion

  • checkInclusion(key: string): Promise<boolean>
  • Privately checks if the given key is in the checklist-enabled bucket. This method is only supported on special global buckets that are checklist-enabled. The supportsChecklistInclusion() method returns a boolean indicating support.


    Parameters

    • key: string

      The key to privately check against the checklist.

    Returns Promise<boolean>

clearEntireBucket

  • clearEntireBucket(): Promise<void>
  • Clears the contents of the entire bucket, and all data inside of it. This action is permanent and irreversible.


    Returns Promise<void>

deleteKey

  • deleteKey(key: string): Promise<void>
  • Deletes the supplied key from the bucket.

    Note that this does not remove the key from the Bloom filter, so subsequent calls to privateIntersect or privateKeyIntersect could still return this key.


    Parameters

    • key: string

      The key to delete.

    Returns Promise<void>

destroyEntireBucket

  • destroyEntireBucket(): Promise<void>
  • Destroys the entire bucket, and all data inside of it. This action is permanent and irreversible.


    Returns Promise<void>

info

  • info(): Promise<any>
  • Gets information about this bucket from the service.


    Returns Promise<any>

privateIntersect

  • privateIntersect(keys: string[], retrieveValues?: boolean): Promise<any>
  • Privately intersects the given set of keys with the keys in this bucket, returning the keys that intersected and their values. This is generally slower than a single private read.

    No entity, including the Blyss service, should be able to determine which keys this method was called for.

    The number of intersections could be determined by the Blyss service or a network observer.


    Parameters

    • keys: string[]

      The keys to privately intersect the value of.

    • retrieveValues: boolean = true

    Returns Promise<any>

privateKeyIntersect

  • privateKeyIntersect(keys: string[]): Promise<string[]>
  • Privately intersects the given set of keys with the keys in this bucket, returning the keys that intersected. This is generally slower than a single private read.

    No entity, including the Blyss service, should be able to determine which keys this method was called for.


    Parameters

    • keys: string[]

      The keys to privately intersect the value of.

    Returns Promise<string[]>

privateRead

  • privateRead(key: string): Promise<any>
  • Privately reads the supplied key from the bucket, returning the value corresponding to the key.

    No entity, including the Blyss service, should be able to determine which key this method was called for.


    Parameters

    • key: string

      The key to privately retrieve the value of.

    Returns Promise<any>

rename

  • rename(newBucketName: string): Promise<any>
  • Renames this bucket, leaving all data and other bucket settings intact.


    Parameters

    • newBucketName: string

    Returns Promise<any>

setup

  • setup(uuid?: string): Promise<void>
  • Prepares this bucket client for private reads.

    This method will be called automatically by string), but clients may call it explicitly prior to make subsequent string) calls faster.

    Can upload significant amounts of data (1-10 MB).


    Parameters

    • optionaluuid: string

      Optional previous UUID that the client should attempt to reuse, to avoid generating and uploading larger amounts of data.

    Returns Promise<void>

supportsChecklistInclusion

  • supportsChecklistInclusion(): boolean
  • Returns whether this bucket supports checkInclusion()


    Returns boolean

toSecretSeed

  • toSecretSeed(): string
  • Serializes the state of the bucket client to a secret seed.

    This secret seed is sensitive! It must stay local to the client to preserve query privacy.


    Returns string

write

  • write(keyValuePairs: {}): Promise<void>
  • Make a write to this bucket.


    Parameters

    • keyValuePairs: {}

      An object containing the key-value pairs to write. Keys must be strings, and values may be any JSON-serializable value or a Uint8Array. The maximum size of a key is 1024 UTF-8 bytes.

    Returns Promise<void>

staticinitialize

  • initialize(api: Api, name: string, secretSeed?: string): Promise<Bucket>
  • Initialize a client for a single existing Blyss bucket. You should not need to call this method directly. Instead, call client.connect() to connect to an existing bucket, or client.create() to create a new one.


    Parameters

    • api: Api

      A target API to send all underlying API calls to.

    • name: string

      The name of the bucket.

    • optionalsecretSeed: string

      An optional secret seed to initialize the client with. A random one will be generated if not supplied.

    Returns Promise<Bucket>

staticinitializeLocal

  • initializeLocal(url: string, secretSeed?: string): Promise<Bucket>
  • Initialize a client for a single existing Blyss bucket, connecting directly to it via a URL.


    Parameters

    • url: string

      A target bucket endpoint URL to send all underlying API calls to.

    • optionalsecretSeed: string

      An optional secret seed to initialize the client with. A random one will be generated if not supplied.

    Returns Promise<Bucket>