Documentation
    Preparing search index...

    Class SealClient

    Index

    Constructors

    Methods

    • Decrypt the given encrypted bytes using cached keys. Calls fetchKeys in case one or more of the required keys is not cached yet. The function throws an error if the client's key servers are not a subset of the encrypted object's key servers or if the threshold cannot be met.

      If checkShareConsistency is true, the decrypted shares are checked for consistency, meaning that any combination of at least threshold shares should either succesfully combine to the plaintext or fail. This is useful in case the encryptor is not trusted and the decryptor wants to ensure all decryptors receive the same output (e.g., for onchain encrypted voting).

      Parameters

      Returns Promise<Uint8Array<ArrayBufferLike>>

      • The decrypted plaintext corresponding to ciphertext.
    • Return an encrypted message under the identity.

      Parameters

      Returns Promise<{ encryptedObject: Uint8Array; key: Uint8Array }>

      The bcs bytes of the encrypted object containing all metadata and the 256-bit symmetric key that was used to encrypt the object. Since the symmetric key can be used to decrypt, it should not be shared but can be used e.g. for backup.

    • Fetch keys from the key servers and update the cache.

      It is recommended to call this function once for all ids of all encrypted objects if there are multiple, then call decrypt for each object. This avoids calling fetchKey individually for each decrypt.

      Parameters

      Returns Promise<void>

    • Get derived keys from the given services.

      Parameters

      Returns Promise<Map<string, DerivedKey>>

      • Derived keys for the given services that are in the cache as a "service object ID" -> derived key map. If the call is succesful, exactly threshold keys will be returned.
    • Returns Promise<Map<string, KeyServer>>

    • Get the public keys for the given services. If all public keys are not in the cache, they are retrieved.

      Parameters

      • services: string[]

        The services to get the public keys for.

      Returns Promise<G2Element[]>

      The public keys for the given services in the same order as the given services.