Skip to content
On this page

Interface: AnonymousSDK

Properties

api

api: object

Anonymous SDK API Library. For advanced use.

Type declaration

api.keyFind

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

Parameters
ParameterType
tokenstring
userIdsstring[]
__namedParametersobject
__namedParameters.page?number
__namedParameters.signal?AbortSignal
Returns

Promise< Paginated< UserDevice > >

api.keyFindAll

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

Parameters
ParameterType
tokenstring
userIdsstring[]
__namedParametersobject
__namedParameters.signal?AbortSignal
Returns

Promise< UserDevice[] >

api.messageCreate

messageCreate: (token, encryptedMessageKeys, __namedParameters) => Promise< { id: string; } >

Parameters
ParameterType
tokenstring
encryptedMessageKeysEncryptedMessageKey[]
__namedParametersobject
__namedParameters.metadata?string
__namedParameters.signal?AbortSignal
Returns

Promise< { id: string; } >

api.retrieveSession

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

Parameters
ParameterType
tokenstring
sessionIdstring
secretstring
__namedParametersobject
__namedParameters.signal?AbortSignal
Returns

Promise< string >

api.sigchainFind

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

Parameters
ParameterType
tokenstring
userIdstring
__namedParametersobject
__namedParameters.page?number
__namedParameters.signal?AbortSignal
Returns

Promise< Paginated< SigchainTransaction > >

api.sigchainFindAll

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

Parameters
ParameterType
tokenstring
userIdstring
__namedParametersobject
__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.

Type declaration

utils.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

ParameterTypeDescription
optsobject
opts.encryptionTokenstringMandatory. The JWT used for message creation.
opts.getKeysToken?stringOptional. The JWT used for the key retrieval. If not supplied, the key retrieval will use encryptionToken.
opts.metadata?stringOptional.
opts.sealdIdsstring[]-
opts.signal?AbortSignalOptional. An AbortSignal to cancel the encryption.

Returns

Promise< AnonymousEncryptionSession >


encrypt

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

Encrypt

Type parameters

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

Parameters

ParameterTypeDescription
optsobject
opts.clearFileTThe 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.encryptionTokenstringMandatory. The JWT used for message creation.
opts.fileSize?numberOptional. Needed when using stream.
opts.filenamestringMandatory. Name of the file to encrypt.
opts.getKeysToken?stringOptional. The JWT used for the key retrieval. If not supplied, the key retrieval will use encryptionToken.
opts.metadata?stringOptional. Defaults to the filename.
opts.sealdIdsstring[]Mandatory. Array of Seald IDs of the recipients of the message to create.
opts.signal?AbortSignalOptional. An AbortSignal to cancel the encryption.

Returns

Promise< { encryptedFile: T; 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

ParameterTypeDescription
optsobject
opts.appId?stringappId of your seald team.
opts.retrieveSessionTokenstringMandatory. The JWT used for EncryptionSession creation.
opts.sessionIdstringsessionId of the session to retrieve.
opts.sessionPassword?stringThe password used to create this SymEncKey.
opts.signal?AbortSignalOptional. An AbortSignal to cancel the encryption.
opts.symEncKeyIdstringThe symEncKeyId of the SymEncKey to use to retrieve the EncryptionSession.
opts.symEncKeyRawSecret?stringThe rawSecret used to create this SymEncKey.
opts.symEncKeyRawSymKey?stringThe 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

ParameterType
logLevelstring

Returns

void