* rewrite

* testing worklflow

* sprcify version

* config stuff

* add hash as buffer

* delete docs

* use typedarray everywhere and docs

* readme

* aes

* cleanup

* rsa

* testing with playwright

* fix playwright

* readme

* docs

* update deps

* use headless

* add prepublish

* build pipeline

* move types up

* move types up

* add types legacy

* packaging

* versions bump

* cleanup

* maybe this time

* drop support for commonjs

* version bump

* cleanup
This commit is contained in:
2022-10-18 15:53:43 +02:00
committed by GitHub
parent f1f5e44b54
commit 56a8103582
58 changed files with 2701 additions and 4705 deletions

View File

@@ -1,18 +1,24 @@
# occulto 🔒
High level wrapper around the [node native crypto API](https://nodejs.org/api/crypto.html).
> Occulto <kbd>/okˈkul.to/</kbd>
>
> _hidden, concealed. secret._
**No Deps & Typescript typings included**
![version badge](https://badgen.net/npm/v/occulto)
![downloads badge](https://badgen.net/npm/dt/occulto)
![dependency count](https://badgen.net/bundlephobia/dependency-count/occulto)
![minzip size badge](https://badgen.net/bundlephobia/minzip/occulto)
![types badge](https://badgen.net/npm/types/occulto)
Supports Hashes, Symmetric AES & ChaCha20 ciphers and Asymmetric RSA.
Isomorphic encryption library that works both in the browser and node with _no dependencies_ and written in Typescript.
[**📒 DOCS HERE 📒**](https://cupcakearmy.github.io/occulto/index.html)
[**📒 API Documentation 📒**](https://occulto.pages.dev)
## Quickstart 🚀
###### Requirements
- Node >= 11 required (ChaCha20)
- Node >= 16 required
###### Install
@@ -20,32 +26,32 @@ Supports Hashes, Symmetric AES & ChaCha20 ciphers and Asymmetric RSA.
npm i occulto
```
### Examples
## Examples
## [RSA](https://cupcakearmy.github.io/occulto/modules/_rsa_.html)
### [RSA](https://occulto.pages.dev/classes/RSA)
```typescript
import { RSA } from 'occulto'
const pair = await RSA.gen()
const encrypted = RSA.encrypt('some text', pair.pub)
const decrypted = RSA.decrypt(encrypted, pair.prv)
const pair = await RSA.generateKeyPair()
const encrypted = await RSA.encrypt('some text', pair.public)
const decrypted = await RSA.decrypt(encrypted, pair.private)
```
## [Symmetric](https://cupcakearmy.github.io/occulto/modules/_symmetric_.html)
### [AES](https://occulto.pages.dev/classes/AES)
[Available Ciphers](https://cupcakearmy.github.io/occulto/enums/_symmetric_.ciphers.html)
[Available Modes](https://occulto.pages.dev/enums/Modes)
```javascript
import { Symmetric } from 'occulto'
const encrypted = Symmetric.encrypt('some string' , 'myPass', Symmetric.Ciphers.AES_128_GCM)
const decrypted = Symmetric.decrypt(encrypted, 'myPadd')
const encrypted = await Symmetric.encryptEasy('some string', 'myPass')
const decrypted = await Symmetric.decryptEasy(encrypted, 'myPass')
```
## [Hash](https://cupcakearmy.github.io/occulto/modules/_hash_.html)
### [Hash](https://occulto.pages.dev/classes/Hash)
[Available hashes](https://cupcakearmy.github.io/occulto/enums/_hash_.hashes.html)
[Available hashes](https://occulto.pages.dev/enums/Hashes)
```typescript
import { Hash } from 'occulto'
@@ -53,5 +59,4 @@ import { Hash } from 'occulto'
const hash = Hash.digest('something')
const h = Hash.digest('something', Hash.Hashes.MD5)
```