The methods below allow you to start and stop a FileKit session.

Note

This documentation uses flow type annotations.

Start

Start a FileKit session, show the verification UI if needed and block until the user verifies their identity.

To verify the identity of a user, an email is sent by Tanker to their email address. This email contains a verification code that must be input in the UI displayed by FileKit when a verification is required.

function start(email: string, { identity: string, provisionalIdentity?: string }) : Promise<void>
Parameters Description
email: string The email address used to verify the user's identity
identity: string The Tanker identity of the given user (generated by @tanker/identity)
provisionalIdentity?: string A Tanker provisional identity that should be claimed by the user (generated by @tanker/identity). It only needs to be verified once and will be ignored if given again. (optional)
Returns
Promise The promise is fulfilled once the user has verified their identity
Throws Description
InvalidArgument The provided identity is invalid
PreconditionFailed The FileKit session has already been started
NetworkError Network error, e.g. connection lost or the Tanker server is not reachable

StartDisposableSession

Start a disposable, one time session. The user does not have to verify their identity as it is discarded once the FileKit Session is stopped.

Disposable sessions can be used to upload files without requiring the user to authenticate.

function startDisposableSession({ identity: string }) : Promise<void>
Parameters Description
identity: string A Tanker identity (generated by @tanker/identity or @tanker/fake-authentication) with a random userID
Returns
Promise The promise is fulfilled once the stop operation is done
Throws Description
InvalidArgument The provided identity is invalid
PreconditionFailed The FileKit session has already been started
NetworkError Network error, e.g. connection lost or the Tanker server is not reachable

Stop

Stop the current FileKit Session.

function stop(): Promise<void>
Returns
Promise The promise is fulfilled once the stop operation is done