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
Parameter Type token
string
userIds
string
[]__namedParameters
object
__namedParameters.page
?number
__namedParameters.signal
?AbortSignal
Returns
Promise
<Paginated
<UserDevice
> >
api.keyFindAll
keyFindAll: (
token
,userIds
,__namedParameters
) =>Promise
<UserDevice
[] >Parameters
Parameter Type token
string
userIds
string
[]__namedParameters
object
__namedParameters.signal
?AbortSignal
Returns
Promise
<UserDevice
[] >
api.messageCreate
messageCreate: (
token
,encryptedMessageKeys
,__namedParameters
) =>Promise
< {id
:string
; } >Parameters
Parameter Type token
string
encryptedMessageKeys
EncryptedMessageKey
[]__namedParameters
object
__namedParameters.metadata
?string
__namedParameters.signal
?AbortSignal
Returns
Promise
< {id
:string
; } >
api.retrieveSession
retrieveSession: (
token
,sessionId
,secret
,__namedParameters
) =>Promise
<string
>Parameters
Parameter Type token
string
sessionId
string
secret
string
__namedParameters
object
__namedParameters.signal
?AbortSignal
Returns
Promise
<string
>
api.sigchainFind
sigchainFind: (
token
,userId
,__namedParameters
) =>Promise
<Paginated
<SigchainTransaction
> >Parameters
Parameter Type token
string
userId
string
__namedParameters
object
__namedParameters.page
?number
__namedParameters.signal
?AbortSignal
Returns
Promise
<Paginated
<SigchainTransaction
> >
api.sigchainFindAll
sigchainFindAll: (
token
,userId
,__namedParameters
) =>Promise
<SigchainTransaction
[] >Parameters
Parameter Type token
string
userId
string
__namedParameters
object
__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
Parameter | 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
Parameter |
---|
T extends string | Blob | ReadableStream < any > | Readable | Buffer |
Parameters
Parameter | 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
; } >
retrieveEncryptionSession
retrieveEncryptionSession(
opts
):Promise
<AnonymousEncryptionSession
>
Retrieve an Encryption Session with a SymEncKey.
You must pass either symEncKeyPassword
, or both symEncKeyRawSecret
and symEncKeyRawSymKey
.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | |
opts.appId ? | string | appId of your seald team. |
opts.retrieveSessionToken | string | Mandatory. The JWT used for EncryptionSession creation. |
opts.sessionId | string | sessionId of the session to retrieve. |
opts.sessionPassword ? | string | The password used to create this SymEncKey. |
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.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
Parameter | Type |
---|---|
logLevel | string |
Returns
void