# Interface: AnonymousSDK

# Table of contents

# Properties

# Methods

# Properties

# api

api: Object

Anonymous SDK API Library. For advanced use.

# Type declaration

Name Type
keyFind (token: string, userIds: string[], __namedParameters: { page?: number ; signal?: AbortSignal }) => Promise<Paginated<UserDevice>>
keyFindAll (token: string, userIds: string[], __namedParameters: { signal?: AbortSignal }) => Promise<UserDevice[]>
messageCreate (token: string, encryptedMessageKeys: EncryptedMessageKey[], __namedParameters: { metadata?: string ; signal?: AbortSignal }) => Promise<{ id: string }>
sigchainFind (token: string, userId: string, __namedParameters: { page?: number ; signal?: AbortSignal }) => Promise<Paginated<SigchainTransaction>>
sigchainFindAll (token: string, userId: string, __namedParameters: { signal?: AbortSignal }) => Promise<SigchainTransaction[]>

# apiURL

apiURL: string

apiURL with which this SealdSDK instance was created. URL of the Seald API Servers to which it should connect.


# sscrypto

sscrypto: SSCrypto

Full SSCrypto library. For advanced use. See SSCrypto documentation at https://github.com/seald/sscrypto


# utils

utils: Object

Various utilities, for advanced use.

# Type declaration

Name Type Description
fetch FetchFunction The fetch implementation used by this SDK instance For advanced use.

# Methods

# createEncryptionSession

createEncryptionSession(opts): Promise<AnonymousEncryptionSession>

Create an Enrcyption Session

# Parameters

Name Type Description
opts Object
opts.encryptionToken string Mandatory. The JWT used for message creation.
opts.getKeysToken? string Optional. The JWT used for the key retrieval. If not supplied, the key retrieval will use encryptionToken.
opts.metadata? string Optional.
opts.sealdIds string[] -
opts.signal? AbortSignal Optional. An AbortSignal to cancel the encryption.

# Returns

Promise<AnonymousEncryptionSession>


# encrypt

encrypt<T>(opts): Promise<{ encryptedFile: T ; id: string }>

Encrypt

# Type parameters

Name Type
T extends string | Blob | ReadableStream<any> | Readable | Buffer

# Parameters

Name Type Description
opts Object
opts.clearFile T The file to encrypt. Can be a string, a Buffer, a Blob, a WebStream ReadableStream, or a Node Readable stream. If you are using a ReadableStream or a Readable, you must also give the fileSize argument.
opts.encryptionToken string Mandatory. The JWT used for message creation.
opts.fileSize? number Optional. Needed when using stream.
opts.filename string Mandatory. Name of the file to encrypt.
opts.getKeysToken? string Optional. The JWT used for the key retrieval. If not supplied, the key retrieval will use encryptionToken.
opts.metadata? string Optional. Defaults to the filename.
opts.sealdIds string[] Mandatory. Array of Seald IDs of the recipients of the message to create.
opts.signal? AbortSignal Optional. An AbortSignal to cancel the encryption.

# Returns

Promise<{ encryptedFile: T ; id: string }>


# setLogLevel

setLogLevel(logLevel): void

This sets the log level. logLevel must be a string of value silly, debug, info, warn, error, or a template of the format ${namespace_1}:${logLevel_for_namespace_1},${namespace_2}:${logLevel_for_namespace_2},.... This will set the log level for all SDK and AnonymousSDK instances, not only the current one.

# Parameters

Name Type
logLevel string

# Returns

void