JSPM

  • Created
  • Published
  • Downloads 12464
  • Score
    100M100P100Q133742F
  • License MIT

evervault Browser SDK

Package Exports

  • @evervault/sdk

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@evervault/sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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

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

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

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

set

evervault.set(toSet): Promise<Object>

Save data on behalf of the user in evervault storage.

Param Type Description
toSave Object the data to be saved. Must be an object in { "key": "value" } form

get

evervault.get([toGet]): Promise<Object>

Retrieve data on behalf of the user in evervault storage.

Param Type Description
toGet String Optional. the data to be retrieved. Must resolve to a previously stored piece of data

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