Skip to content

Interface: AnonymousSDK

Properties

api

api: object

Anonymous SDK API Library. For advanced use.

keyFind()

keyFind: (token, userIds, __namedParameters) => Promise<Paginated<UserDevice>>

Parameters

token: string

userIds: string[]

__namedParameters = {}

__namedParameters.page?: number = 1

__namedParameters.signal?: AbortSignal

Returns

Promise<Paginated<UserDevice>>

keyFindAll()

keyFindAll: (token, userIds, __namedParameters) => Promise<UserDevice[]>

Parameters

token: string

userIds: string[]

__namedParameters = {}

__namedParameters.signal?: AbortSignal

Returns

Promise<UserDevice[]>

messageCreate()

messageCreate: (token, encryptedMessageKeys, __namedParameters) => Promise<object>

Parameters

token: string

encryptedMessageKeys: EncryptedMessageKey[]

__namedParameters = {}

__namedParameters.metadata?: string

__namedParameters.signal?: AbortSignal

Returns

Promise<object>

id

id: string

retrieveSession()

retrieveSession: (token, sessionId, secret, __namedParameters) => Promise<string>

Parameters

token: string

sessionId: string

secret: string

__namedParameters = {}

__namedParameters.signal?: AbortSignal

Returns

Promise<string>

sigchainFind()

sigchainFind: (token, userId, __namedParameters) => Promise<Paginated<SigchainTransaction>>

Parameters

token: string

userId: string

__namedParameters = {}

__namedParameters.page?: number = 1

__namedParameters.signal?: AbortSignal

Returns

Promise<Paginated<SigchainTransaction>>

sigchainFindAll()

sigchainFindAll: (token, userId, __namedParameters) => Promise<SigchainTransaction[]>

Parameters

token: string

userId: string

__namedParameters = {}

__namedParameters.signal?: AbortSignal

Returns

Promise<SigchainTransaction[]>


apiURL

apiURL: string

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


scrypt

scrypt: SCrypt

SCrypt wrapper with reasonable parameters. For advanced use.


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.

fetch

fetch: FetchFunction

The fetch implementation used by this SDK instance For advanced use.

Methods

createEncryptionSession()

createEncryptionSession(opts): Promise<AnonymousEncryptionSession>

Create an Encryption Session

Parameters

opts

opts.encryptionToken: string

Mandatory. The JWT used for EncryptionSession 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<object>

Encrypt

Type Parameters

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

Parameters

opts

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 EncryptionSession 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 session to create.

opts.signal?: AbortSignal

Optional. An AbortSignal to cancel the encryption.

Returns

Promise<object>

encryptedFile

encryptedFile: T

id

id: string


retrieveEncryptionSession()

retrieveEncryptionSession(opts): Promise<AnonymousEncryptionSession>

Retrieve an Encryption Session with a SymEncKey.

You must pass either symEncKeyPassword, or both symEncKeyRawSecret and symEncKeyRawSymKey.

Parameters

opts

opts.appId?: string

appId of your seald team.

opts.retrieveSessionToken: string

Mandatory. A JWT to allow session retrieval.

opts.sessionId: string

sessionId of the session to retrieve.

opts.signal?: AbortSignal

Optional. An AbortSignal to cancel the encryption.

opts.symEncKeyId: string

The symEncKeyId of the SymEncKey to use to retrieve the EncryptionSession.

opts.symEncKeyPassword?: string

The password used to create this SymEncKey.

opts.symEncKeyRawSecret?: string

The rawSecret used to create this SymEncKey.

opts.symEncKeyRawSymKey?: string

The rawSymKey used to create this SymEncKey.

Returns

Promise<AnonymousEncryptionSession>


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

logLevel: string

Returns

void