https://github.com/mat-sz/matcrypt
🔐 Wrapper for WebCrypto designed to optimize certain tasks.
https://github.com/mat-sz/matcrypt
javascript javascript-library webcrypto webcryptoapi
Last synced: 3 months ago
JSON representation
🔐 Wrapper for WebCrypto designed to optimize certain tasks.
- Host: GitHub
- URL: https://github.com/mat-sz/matcrypt
- Owner: mat-sz
- License: bsd-3-clause-clear
- Created: 2019-11-18T20:44:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-22T18:52:43.000Z (about 2 years ago)
- Last Synced: 2025-10-26T11:52:29.356Z (4 months ago)
- Topics: javascript, javascript-library, webcrypto, webcryptoapi
- Language: TypeScript
- Homepage:
- Size: 223 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# matcrypt
## Disclaimer
While I've made sure to adhere to all best practices when it comes to AES and WebCrypto, I am not a cryptography professional. This code is not audited. I use this in production, but you should **never** blindly trust any cryptographic code from the internet.
This library only works in browser environments that support WebCrypto.
## About
WebCrypto wrapper that makes AES easy.
### This library supports
**(AES-256)**
- Random key generation
- String encryption/decryption (ciphertext is base64 encoded as well for easy storage)
- Binary data encryption/decryption
_(The library handles IV randomization and storage.)_
**(SHA-512)**
- Compute a base64-encoded hash of binary data
**(RSA-OAEP-2048)**
- Random key pair generation
- String encryption/decryption (ciphertext is base64 encoded as well for easy storage)
- Binary data encryption/decryption
_(The library handles AES secret randomization and storage.)_
## Code example
```ts
import { AES } from 'matcrypt';
async function example() {
let key = await AES.randomKey();
let ciphertext = await AES.encryptString(key, testString);
let plaintext = await AES.decryptString(key, ciphertext);
}
```