occulto/README.md

63 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2022-10-14 11:31:52 +00:00
# occulto 🔒
2022-10-14 13:10:46 +00:00
> Occulto <kbd>/okˈkul.to/</kbd>
>
> _hidden, concealed. secret._
2022-10-16 01:27:08 +00:00
![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)
2022-10-14 11:31:52 +00:00
2022-10-16 01:27:08 +00:00
Isomorphic encryption library that works both in the browser and node with _no dependencies_ and written in Typescript.
2022-10-14 11:31:52 +00:00
2022-10-16 01:27:08 +00:00
[**📒 API Documentation 📒**](https://occulto.pages.dev)
2022-10-14 11:31:52 +00:00
## Quickstart 🚀
###### Requirements
- Node >= 16 required
###### Install
```
npm i occulto
```
2022-10-16 01:27:08 +00:00
## Examples
2022-10-14 11:31:52 +00:00
2022-10-16 01:27:08 +00:00
### [RSA](https://occulto.pages.dev/classes/RSA)
2022-10-14 11:31:52 +00:00
```typescript
import { RSA } from 'occulto'
2022-10-16 01:27:08 +00:00
const pair = await RSA.generateKeyPair()
const encrypted = await RSA.encrypt('some text', pair.public)
const decrypted = await RSA.decrypt(encrypted, pair.private)
2022-10-14 11:31:52 +00:00
```
2022-10-16 01:27:08 +00:00
### [AES](https://occulto.pages.dev/classes/AES)
2022-10-14 11:31:52 +00:00
2022-10-16 01:27:08 +00:00
[Available Modes](https://occulto.pages.dev/enums/Modes)
2022-10-14 11:31:52 +00:00
```javascript
import { Symmetric } from 'occulto'
2022-10-16 01:27:08 +00:00
const encrypted = await Symmetric.encryptEasy('some string', 'myPass')
const decrypted = await Symmetric.decryptEasy(encrypted, 'myPass')
2022-10-14 11:31:52 +00:00
```
2022-10-16 01:27:08 +00:00
### [Hash](https://occulto.pages.dev/classes/Hash)
2022-10-14 11:31:52 +00:00
2022-10-16 01:27:08 +00:00
[Available hashes](https://occulto.pages.dev/enums/Hashes)
2022-10-14 11:31:52 +00:00
```typescript
import { Hash } from 'occulto'
const hash = Hash.digest('something')
const h = Hash.digest('something', Hash.Hashes.MD5)
```