About
The evervault SDK allows developers to integrate with evervault auth and encrypt/decrypt data within their web app. Built on the Web Crypto API.
API Reference
checkAuth
checkAuth(appId): void
Check a user's auth status in the system, and redirect them if they are unauthenticated.
Param | Type | Description |
---|
appId | String | The unique identifier for your app in the evervault system |
encrypt
encrypt(data[, encryptOptions]): Promise<String>
Encrypt data using a user's secret key. The encrypt function will handle any data excluding undefined
and Symbol
.
Param | Type | Description |
---|
data | any | the data to be encrypted |
encryptOptions | object | control how your data is encrypted |
encryptOptions
Key | Value | Description |
---|
preserveObjectShape | boolean | if true, javascript objects will only have their values encrypted, if false objects will be stringified |
fieldsToEncrypt | Array<String> | a list of fields in an object to encrypt |
privateKey | String | a base64 representation of a user's evervault secret key |
decrypt
decrypt(data[, privateKey]): Promise<String>
Decrypt evervault encrypted data. Decrypt will preserve the shape of any object it's given (e.g. Array or Object). Any stringified data that enters decrypt will be parsable when it has been decrypted.
Param | Type | Description |
---|
data | any | the data to be decrypted, be it an object, array or a string |
privateKey | String | a base64 representation of a user's evervault secret key |
logout
logout(): void
Remove a user's credentials and redirect them to evervault auth.
refreshAccessToken
refreshAccessToken([accessToken, refreshToken]): Promise<Object>
Refresh a user's access token in the evervault system.
Param | Type | Description |
---|
accessToken | String | a user's evervault access token to authenticate them in your system |
refreshToken | String | a user's evervault refresh token to keep them authenticated |