Skip to content

Interface: AnonymousSDK

Properties

api

api: {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;tmrMessageKeys: EncryptedTMRMessageKey[]; }) => Promise<{id: string; }>;retrieveSession: (token: string, sessionId: string, secret: string, __namedParameters: {signal: AbortSignal; }) => Promise<string>;sigchainFind: (token: string, userId: string, __namedParameters: {page: number;signal: AbortSignal; }) => Promise<Paginated<SigchainTransaction>>;sigchainFindAll: (token: string, userId: string, __namedParameters: {signal: AbortSignal; }) => Promise<SigchainTransaction[]>; }

Anonymous SDK API Library. For advanced use.

keyFind()

keyFind: (token: string, userIds: string[], __namedParameters: {page: number;signal: AbortSignal; }) => Promise<Paginated<UserDevice>>

Parameters
token

string

userIds

string[]

__namedParameters
page

number = 1

signal

AbortSignal

Returns

Promise<Paginated<UserDevice>>

keyFindAll()

keyFindAll: (token: string, userIds: string[], __namedParameters: {signal: AbortSignal; }) => Promise<UserDevice[]>

Parameters
token

string

userIds

string[]

__namedParameters
signal

AbortSignal

Returns

Promise<UserDevice[]>

messageCreate()

messageCreate: (token: string, encryptedMessageKeys: EncryptedMessageKey[], __namedParameters: {metadata: string;signal: AbortSignal;tmrMessageKeys: EncryptedTMRMessageKey[]; }) => Promise<{id: string; }>

Parameters
token

string

encryptedMessageKeys

EncryptedMessageKey[]

__namedParameters
metadata

string

signal

AbortSignal

tmrMessageKeys

EncryptedTMRMessageKey[]

Returns

Promise<{id: string; }>

id

id: string

retrieveSession()

retrieveSession: (token: string, sessionId: string, secret: string, __namedParameters: {signal: AbortSignal; }) => Promise<string>

Parameters
token

string

sessionId

string

secret

string

__namedParameters
signal

AbortSignal

Returns

Promise<string>

sigchainFind()

sigchainFind: (token: string, userId: string, __namedParameters: {page: number;signal: AbortSignal; }) => Promise<Paginated<SigchainTransaction>>

Parameters
token

string

userId

string

__namedParameters
page

number = 1

signal

AbortSignal

Returns

Promise<Paginated<SigchainTransaction>>

sigchainFindAll()

sigchainFindAll: (token: string, userId: string, __namedParameters: {signal: AbortSignal; }) => Promise<SigchainTransaction[]>

Parameters
token

string

userId

string

__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: {fetch: FetchFunction; }

Various utilities, for advanced use.

fetch

fetch: FetchFunction

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

Methods

createEncryptionSession()

createEncryptionSession(opts: {encryptionToken: string;getKeysToken: string;metadata: string;recipients: Recipients;signal: AbortSignal; }): Promise<AnonymousEncryptionSession>

Create an Encryption Session

Parameters

opts
encryptionToken

string

Mandatory. The JWT used for EncryptionSession creation.

getKeysToken

string

Optional. The JWT used for the key retrieval. If not supplied, the key retrieval will use encryptionToken.

metadata

string

Optional.

recipients

Recipients

Mandatory. Recipients of the session to create.

signal

AbortSignal

Optional. An AbortSignal to cancel the encryption.

Returns

Promise<AnonymousEncryptionSession>


encrypt()

encrypt<T>(opts: {clearFile: T;encryptionToken: string;filename: string;fileSize: number;getKeysToken: string;metadata: string;recipients: Recipients;signal: AbortSignal; }): Promise<{encryptedFile: T;id: string; }>

Encrypt

Type Parameters

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

Parameters

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.

encryptionToken

string

Mandatory. The JWT used for EncryptionSession creation.

filename

string

Mandatory. Name of the file to encrypt.

fileSize

number

Optional. Needed when using stream.

getKeysToken

string

Optional. The JWT used for the key retrieval. If not supplied, the key retrieval will use encryptionToken.

metadata

string

Optional. Defaults to the filename.

recipients

Recipients

Mandatory. Recipients of the session to create.

signal

AbortSignal

Optional. An AbortSignal to cancel the encryption.

Returns

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

encryptedFile

encryptedFile: T

id

id: string


retrieveEncryptionSession()

retrieveEncryptionSession(opts: {appId: string;retrieveSessionToken: string;sessionId: string;signal: AbortSignal;symEncKeyId: string;symEncKeyPassword: string;symEncKeyRawSecret: string;symEncKeyRawSymKey: string; }): Promise<AnonymousEncryptionSession>

Retrieve an Encryption Session with a SymEncKey.

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

Parameters

opts
appId

string

appId of your seald team.

retrieveSessionToken

string

Mandatory. A JWT to allow session retrieval.

sessionId

string

sessionId of the session to retrieve.

signal

AbortSignal

Optional. An AbortSignal to cancel the encryption.

symEncKeyId

string

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

symEncKeyPassword

string

The password used to create this SymEncKey.

symEncKeyRawSecret

string

The rawSecret used to create this SymEncKey.

symEncKeyRawSymKey

string

The rawSymKey used to create this SymEncKey.

Returns

Promise<AnonymousEncryptionSession>


setLogLevel()

setLogLevel(logLevel: string): 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