web-vault-crypto
v0.1.1
Published
Crypto-Library for e2e encrypted web vaults, using native web crypto api, written in typescript, easy to use.
Maintainers
Readme
web-vault-crypto
Crypto-Library for e2e encrypted web vaults, using native web crypto api and argon2-browser, written in typescript, easy to use.
Introduction
This package provides easy to use crypto-functions, suitable for web-vaults (examples: password-safes, e2e encrypted video collections).
Used crypto-libraries:
- argon2-browser for password-based-key-derivation and password hashing, using argon2id
- native web crypto api for everything else
Features
- key generation
- password-based key derivation − argon2id
- password hashing − argon2id / PBKDF2
- key wrapping and unwrapping − aeskeywrap
- encryption and decryption −
AEADusingAES-256-GCM - signing and verification − using
hmac
Usage
npm
Install:
npm install web-vault-cryptoImport:
// Replace createKey with a comma-separated list of the functions, you need
import { createKey } from 'web-vault-crypto';
const key = await createKey({ sizeInBytes: 32 });
// or import all functions
import webVaultCrypto from 'web-vault-crypto';
const key = await webVaultCrypto.createKey({ sizeInBytes: 32 });Browser
<!-- Load the file from jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/web-vault-crypto@latest/dist/web-vault-crypto.js"></script>
<!-- or load the file from unpkg -->
<script src="https://unpkg.com/web-vault-crypto@latest/dist/web-vault-crypto.js"></script>
<!-- or download the file and host it yourself -->
<script src="/js/web-vault-crypto.js"></script>
<script>
// Replace createKey with a comma-separated list of the functions, you need
const { createKey } = webVaultCrypto;
const key = await createKey({ sizeInBytes: 32 });
// or use functions directly
const key = await webVaultCrypto.createKey({ sizeInBytes: 32 });
</script>API
Read API Documentation to see how to use the functions
Crypto/Security
Read Security Concept to see the crypto/security concepts
Changelog
Read Changelog to see recent changes
Future
Future Plans:
- Add asymmetric crypto functions (public key / private key) (March − June)
License
This project is licensed under the MIT License
