New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tv-js-sdk

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tv-js-sdk

The official TrueVault JavaScript SDK

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

TrueVault JavaScript SDK

The official JavasScript SDK for TrueVault. For more information about TrueVault, check out our website and API documentation. To see how the SDK is used in a real application, check out the TrueVault React Sample App.

Note: This SDK is only supported for the latest release of Chrome.

Install using unpkg CDN

Simply copy this line into your HTML:

<script src="https://unpkg.com/tv-js-sdk@0.1.0/build/index.js"></script>

Install using yarn / npm

First download the package using yarn or npm.

yarn add tv-js-sdk

// OR

npm install tv-js-sdk

Then import the JS SDK into your project:

ES6

import TrueVaultClient from 'tv-js-sdk';

ES5

const TrueVaultClient = require('tv-js-sdk');

Usage

Initialize a TrueVaultClient using an access token or API key

const tvClient = new TrueVaultClient(apiKeyOrAccessToken);

You can also create a new TrueVaultClient by logging in:

const tvClient = await TrueVaultClient.login(accountId, username, password, mfaCode);

Asynchronous Requests

The methods in this SDK make asynchronous web requests to TrueVault and return Promises. We recommend using async/await in favor of Promises wherever possible for clarity and conciseness.

async/await

async readTrueVaultDocument() {
    try {
        const response = await tvClient.readDocument(vaultId, documentId);
        console.log(response);
    } catch (err) {
        console.error(err);
    }
}

Promises

readTrueVaultDocument() {
    tvClient.readDocument(vaultId, documentId).then(response => {
        console.log(response);
    }).catch(err => {
        console.error(err);
    });
}

Example

Test out the SDK with this simple JSFiddle example.

Development

Make changes to index.js and then bundle them into build/index.js with webpack:

./node_modules/.bin/webpack

License

This SDK is released under the BSD 3-Clause License.

Keywords

truevault

FAQs

Package last updated on 20 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts