mirror of
https://github.com/cupcakearmy/occulto.git
synced 2025-09-06 16:30:40 +00:00
Compare commits
15 Commits
v2.0.0-rc.
...
v2.0.3
Author | SHA1 | Date | |
---|---|---|---|
629e3af60d | |||
bfc4ca3c48 | |||
0798993f84 | |||
bac19fa91d | |||
|
6bbc5979ae | ||
|
be04f9c546 | ||
f4503bbf2b | |||
69c444a204 | |||
ffc6e62f7c | |||
dcfd25c823 | |||
5e811edbc5 | |||
66b54dd27d | |||
2d23b95605 | |||
1ab82a78fe | |||
5babec20ce |
14
.github/workflows/release.yaml
vendored
14
.github/workflows/release.yaml
vendored
@@ -1,9 +1,9 @@
|
||||
name: "Publish to NPM"
|
||||
name: 'Publish to NPM'
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -16,18 +16,18 @@ jobs:
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
node-version-file: '.nvmrc'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 7
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Install Playwright
|
||||
- name: Install Playwright Dependencies
|
||||
run: pnpm exec playwright install-deps
|
||||
- name: Install Playwright Browsers
|
||||
run: pnpm exec playwright install
|
||||
- name: Run tests
|
||||
run: pnpm run test
|
||||
|
||||
|
10
.github/workflows/test.yaml
vendored
10
.github/workflows/test.yaml
vendored
@@ -1,4 +1,4 @@
|
||||
name: "Run Tests"
|
||||
name: 'Run Tests'
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -17,16 +17,16 @@ jobs:
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Setup PNPM
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 7
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Install Playwright
|
||||
- name: Install Playwright Dependencies
|
||||
run: pnpm exec playwright install-deps
|
||||
- name: Install Playwright Browsers
|
||||
run: pnpm exec playwright install
|
||||
- name: Run tests
|
||||
run: pnpm run test
|
||||
|
12
CHANGELOG.md
12
CHANGELOG.md
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2.0.2]
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated dependencies.
|
||||
|
||||
## [2.0.1]
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated dependencies.
|
||||
|
||||
## [2.0.0]
|
||||
|
||||
### Added
|
||||
|
38
README.md
38
README.md
@@ -33,8 +33,10 @@ npm i occulto
|
||||
```typescript
|
||||
import { RSA } from 'occulto'
|
||||
|
||||
const pair = await RSA.generateKeyPair()
|
||||
const encrypted = await RSA.encrypt('some text', pair.public)
|
||||
const pair = await RSA.generateKeyPair(2 ** 11)
|
||||
const bytes = Bytes.encode(message)
|
||||
|
||||
const encrypted = await RSA.encrypt(bytes, pair.public)
|
||||
const decrypted = await RSA.decrypt(encrypted, pair.private)
|
||||
```
|
||||
|
||||
@@ -42,11 +44,29 @@ const decrypted = await RSA.decrypt(encrypted, pair.private)
|
||||
|
||||
[Available Modes](https://occulto.pages.dev/enums/Modes)
|
||||
|
||||
```javascript
|
||||
import { Symmetric } from 'occulto'
|
||||
There is an _easy_ API, that will take care of everything for you.
|
||||
|
||||
const encrypted = await Symmetric.encryptEasy('some string', 'myPass')
|
||||
const decrypted = await Symmetric.decryptEasy(encrypted, 'myPass')
|
||||
```typescript
|
||||
import { AES } from 'occulto'
|
||||
|
||||
const password = 'foobar'
|
||||
const message = 'this is a secret'
|
||||
|
||||
const encrypted = await AES.encryptEasy(message, password)
|
||||
const decrypted = await AES.decryptEasy(encrypted, password)
|
||||
```
|
||||
|
||||
The low level API is also exposed for advanced usages.
|
||||
|
||||
```typescript
|
||||
import { AES } from 'occulto'
|
||||
|
||||
const message = 'this is a secret'
|
||||
const key = await AES.generateKey()
|
||||
const data = Bytes.encode(message)
|
||||
|
||||
const ciphertext = await AES.encrypt(data, key)
|
||||
const plaintext = await AES.decrypt(ciphertext, key)
|
||||
```
|
||||
|
||||
### [Hash](https://occulto.pages.dev/classes/Hash)
|
||||
@@ -54,9 +74,7 @@ const decrypted = await Symmetric.decryptEasy(encrypted, 'myPass')
|
||||
[Available hashes](https://occulto.pages.dev/enums/Hashes)
|
||||
|
||||
```typescript
|
||||
import { Hash } from 'occulto'
|
||||
import { Hash, Hashes } from 'occulto'
|
||||
|
||||
const hash = Hash.digest('something')
|
||||
|
||||
const h = Hash.digest('something', Hash.Hashes.MD5)
|
||||
const hashed = await Hash.hash('Some value', Hashes.SHA_512)
|
||||
```
|
||||
|
47
package.json
47
package.json
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "occulto",
|
||||
"version": "2.0.0-rc.10",
|
||||
"license": "MIT",
|
||||
"version": "2.0.3",
|
||||
"description": "crypt utility",
|
||||
"keywords": [
|
||||
"isomorphic",
|
||||
@@ -9,20 +8,24 @@
|
||||
"aes",
|
||||
"rsa"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=16",
|
||||
"npm": "please-use-pnpm",
|
||||
"yarn": "please-use-pnpm",
|
||||
"pnpm": "7"
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cupcakearmy/occulto"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Niccolo Borgioli",
|
||||
"email": "opensource@nicco.io",
|
||||
"url": "https://nicco.io"
|
||||
},
|
||||
"type": "module",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"import": "./dist/index.js"
|
||||
}
|
||||
},
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
@@ -41,23 +44,21 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@endyjasmi/karma-playwright-launcher": "^0.0.4",
|
||||
"@types/node": "^16.18.11",
|
||||
"chai": "^4.3.7",
|
||||
"karma": "^6.4.1",
|
||||
"@types/node": "^20.11.17",
|
||||
"chai": "^4.4.1",
|
||||
"karma": "^6.4.2",
|
||||
"karma-mocha": "^2.0.1",
|
||||
"mocha": "^10.2.0",
|
||||
"mocha": "^10.3.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"playwright": "^1.29.2",
|
||||
"typedoc": "^0.23.24",
|
||||
"typescript": "^4.9.4"
|
||||
"playwright": "^1.41.2",
|
||||
"typedoc": "^0.25.7",
|
||||
"typescript": "^5.3.3"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/cupcakearmy/occulto"
|
||||
},
|
||||
"author": {
|
||||
"name": "Niccolo Borgioli",
|
||||
"email": "opensource@nicco.io",
|
||||
"url": "https://nicco.io"
|
||||
"packageManager": "pnpm@8.15.1",
|
||||
"engines": {
|
||||
"node": ">=16",
|
||||
"npm": "please-use-pnpm",
|
||||
"pnpm": ">=8",
|
||||
"yarn": "please-use-pnpm"
|
||||
}
|
||||
}
|
||||
|
1223
pnpm-lock.yaml
generated
1223
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user