TankerHQ / sdk-js
- пятница, 24 мая 2019 г. в 00:18:17
JavaScript
Tanker client-side encryption SDK for JavaScript
Overview · Packages · Usage example · Documentation · Release notes · Browser support · Contributing · License
Tanker is an open-source client SDK that can be embedded in any application.
It leverages powerful client-side encryption of any type of data, textual or binary, but without performance loss and assuring a seamless end-user experience. No cryptographic skills are required.
| Package | Version | Description |
|---|---|---|
| @tanker/client-browser | Client SDK for Web applications | |
| @tanker/client-node | Client SDK for Node.js client applications |
Tanker can be integrated in cross-platform applications, all sharing the same Trustchain.
To use Tanker in your mobile applications, use our open-source iOS and Android SDKs.
The client SDK takes care of all the difficult cryptography in the background, leaving you with simple high-level APIs:
import { Tanker } from '@tanker/client-browser';
// Init the isolated Tanker environment within your application
const tanker = new Tanker({ trustchainId: '...' });
// Sign in with the user's cryptographic identity
await tanker.open(aliceUserId, aliceUserToken);
// Encrypt data and share it with separate recipients or groups
const encryptedMessage = await tanker.encrypt(
'It is a secret to everybody',
{ shareWithUsers: [bobUserId] }
);
// Decrypt data (or throw if not a legitimate recipient)
const message = await tanker.decrypt(encryptedMessage);The client SDK automatically handles complex key exchanges, cryptographic operations, and identity verification for you.
For more details and advanced examples, please refer to:
Or fiddle with the quickstart examples to see the Tanker SDKs integrated in a collection of demo apps.
Detailed changes for each release are documented in the release notes.
The JavaScript client SDK supports and is heavily tested on:
We welcome feedback, bug reports, and bug fixes in the form of pull requests.
To build the JavaScript client SDK yourself, please follow the steps below.
Install Yarn version 1.0 or greater.
Use this command to check the Yarn version installed on your system:
yarn -vClone this repository:
git clone https://github.com/TankerHQ/sdk-js.gitInstall dependencies:
cd sdk-js && yarnOur codebase uses the following ES6 features: async / await, import / export, and classes with flow for type-checking and with eslint for linting.
To check that the code is correct and to launch the tests in Node.js, use:
yarn proofBefore submitting your pull request, please make sure that your changes pass the linters and that all the tests pass on your local machine.
For non-trivial changes, we highly recommend including extra tests.
When you're ready, submit your pull request, targeting the master branch of this repository.
At Tanker, we happily use BrowserStack to automate testing on many browsers.
The Tanker JavaScript SDK is licensed under the Apache License, version 2.0.