2019-03-30 20:50:04 +01:00
|
|
|
|
# occulto 🔒
|
|
|
|
|
|
2022-10-18 15:53:43 +02:00
|
|
|
|
> Occulto <kbd>/okˈkul.to/</kbd>
|
|
|
|
|
>
|
|
|
|
|
> _hidden, concealed. secret._
|
2019-07-07 21:20:42 +02:00
|
|
|
|
|
2022-10-18 15:53:43 +02: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)
|
2019-03-30 20:50:04 +01:00
|
|
|
|
|
2022-10-18 15:53:43 +02:00
|
|
|
|
Isomorphic encryption library that works both in the browser and node with _no dependencies_ and written in Typescript.
|
2019-03-30 20:50:04 +01:00
|
|
|
|
|
2022-10-18 15:53:43 +02:00
|
|
|
|
[**📒 API Documentation 📒**](https://occulto.pages.dev)
|
2019-07-07 21:47:57 +02:00
|
|
|
|
|
2019-03-30 20:50:04 +01:00
|
|
|
|
## Quickstart 🚀
|
|
|
|
|
|
2019-07-10 10:35:00 +02:00
|
|
|
|
###### Requirements
|
|
|
|
|
|
2022-10-18 15:53:43 +02:00
|
|
|
|
- Node >= 16 required
|
2019-07-10 10:35:00 +02:00
|
|
|
|
|
2019-03-30 20:50:04 +01:00
|
|
|
|
###### Install
|
|
|
|
|
|
|
|
|
|
```
|
2019-07-10 10:35:42 +02:00
|
|
|
|
npm i occulto
|
2019-03-30 20:50:04 +01:00
|
|
|
|
```
|
|
|
|
|
|
2022-10-18 15:53:43 +02:00
|
|
|
|
## Examples
|
2019-03-30 20:50:04 +01:00
|
|
|
|
|
2022-10-18 15:53:43 +02:00
|
|
|
|
### [RSA](https://occulto.pages.dev/classes/RSA)
|
2019-03-30 20:50:04 +01:00
|
|
|
|
|
2019-07-07 21:44:18 +02:00
|
|
|
|
```typescript
|
2019-07-07 21:48:49 +02:00
|
|
|
|
import { RSA } from 'occulto'
|
|
|
|
|
|
2022-10-18 15:53:43 +02:00
|
|
|
|
const pair = await RSA.generateKeyPair()
|
|
|
|
|
const encrypted = await RSA.encrypt('some text', pair.public)
|
|
|
|
|
const decrypted = await RSA.decrypt(encrypted, pair.private)
|
2019-03-30 20:50:04 +01:00
|
|
|
|
```
|
|
|
|
|
|
2022-10-18 15:53:43 +02:00
|
|
|
|
### [AES](https://occulto.pages.dev/classes/AES)
|
2019-07-07 21:47:57 +02:00
|
|
|
|
|
2022-10-18 15:53:43 +02:00
|
|
|
|
[Available Modes](https://occulto.pages.dev/enums/Modes)
|
2019-03-30 20:50:04 +01:00
|
|
|
|
|
|
|
|
|
```javascript
|
2019-07-07 21:39:31 +02:00
|
|
|
|
import { Symmetric } from 'occulto'
|
2019-03-30 20:50:04 +01:00
|
|
|
|
|
2022-10-18 15:53:43 +02:00
|
|
|
|
const encrypted = await Symmetric.encryptEasy('some string', 'myPass')
|
|
|
|
|
const decrypted = await Symmetric.decryptEasy(encrypted, 'myPass')
|
2019-03-30 20:50:04 +01:00
|
|
|
|
```
|
|
|
|
|
|
2022-10-18 15:53:43 +02:00
|
|
|
|
### [Hash](https://occulto.pages.dev/classes/Hash)
|
2019-07-07 21:46:09 +02:00
|
|
|
|
|
2022-10-18 15:53:43 +02:00
|
|
|
|
[Available hashes](https://occulto.pages.dev/enums/Hashes)
|
2019-07-07 21:46:09 +02:00
|
|
|
|
|
2019-07-07 21:44:18 +02:00
|
|
|
|
```typescript
|
2019-07-07 21:39:31 +02:00
|
|
|
|
import { Hash } from 'occulto'
|
|
|
|
|
|
2019-07-07 21:20:42 +02:00
|
|
|
|
const hash = Hash.digest('something')
|
|
|
|
|
|
2019-07-07 21:44:18 +02:00
|
|
|
|
const h = Hash.digest('something', Hash.Hashes.MD5)
|
2019-03-30 20:50:04 +01:00
|
|
|
|
```
|