web-vault-crypto
v0.2.0
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
Symmetric
- key generation −
CSPRNG - password-based key derivation −
argon2id/PBKDF2 - password hashing −
argon2id/PBKDF2 - key wrapping and unwrapping −
aes-key-wrap - encryption and decryption −
AEADusingAES-256-GCM(withaes-key-wrap) - signing and verification − using
hmacwithSHA-256
Asymmetric
- key generation −
Ed25519/RSA-OAEP - private key wrapping and unwrapping −
AES-256-GCM - encryption and decryption −
AEADusingAES-256-GCM(withRSA-OAEP)
(Supports multiple recipients) - signing and verification − using
Ed25519withSHA-256
Common
- change encryption keys (e.g. from symmetric to asymmetric) without re-encryption −
aes-key-wrap,RSA-OAEP
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 });
// or import only symmetric/asymmetric specific
import { createKey } from 'web-vault-crypto/symmetric';
import { sign } from 'web-vault-crypto/asymmetric';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
License
This project is licensed under the MIT License
