5 Commits

Author SHA1 Message Date
5e811edbc5 changelog 2023-04-25 00:07:31 +02:00
66b54dd27d 2.0.1 2023-04-25 00:06:41 +02:00
2d23b95605 update deps 2023-04-25 00:06:36 +02:00
1ab82a78fe readme 2023-01-14 18:49:31 +01:00
5babec20ce stable version 2023-01-14 18:42:49 +01:00
7 changed files with 472 additions and 426 deletions

View File

@@ -1,9 +1,9 @@
name: "Publish to NPM" name: 'Publish to NPM'
on: on:
push: push:
tags: tags:
- "v*" - 'v*'
jobs: jobs:
build: build:
@@ -16,13 +16,13 @@ jobs:
- name: Install Node - name: Install Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
registry-url: "https://registry.npmjs.org" registry-url: 'https://registry.npmjs.org'
- name: Setup PNPM - name: Setup PNPM
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v2
with: with:
version: 7 version: 8
- name: Install dependencies - name: Install dependencies
run: pnpm install run: pnpm install

View File

@@ -1,4 +1,4 @@
name: "Run Tests" name: 'Run Tests'
on: on:
pull_request: pull_request:
@@ -17,12 +17,12 @@ jobs:
- name: Install Node - name: Install Node
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
- name: Setup PNPM - name: Setup PNPM
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v2
with: with:
version: 7 version: 8
- name: Install dependencies - name: Install dependencies
run: pnpm install run: pnpm install

1
.npmrc
View File

@@ -1 +0,0 @@
engine-strict=true

View File

@@ -5,6 +5,12 @@ 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/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.1]
### Changed
- Updated dependencies.
## [2.0.0] ## [2.0.0]
### Added ### Added

View File

@@ -33,8 +33,10 @@ npm i occulto
```typescript ```typescript
import { RSA } from 'occulto' import { RSA } from 'occulto'
const pair = await RSA.generateKeyPair() const pair = await RSA.generateKeyPair(2 ** 11)
const encrypted = await RSA.encrypt('some text', pair.public) const bytes = Bytes.encode(message)
const encrypted = await RSA.encrypt(bytes, pair.public)
const decrypted = await RSA.decrypt(encrypted, pair.private) 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) [Available Modes](https://occulto.pages.dev/enums/Modes)
```javascript There is an _easy_ API, that will take care of everything for you.
import { Symmetric } from 'occulto'
const encrypted = await Symmetric.encryptEasy('some string', 'myPass') ```typescript
const decrypted = await Symmetric.decryptEasy(encrypted, 'myPass') 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) ### [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) [Available hashes](https://occulto.pages.dev/enums/Hashes)
```typescript ```typescript
import { Hash } from 'occulto' import { Hash, Hashes } from 'occulto'
const hash = Hash.digest('something') const hashed = await Hash.hash('Some value', Hashes.SHA_512)
const h = Hash.digest('something', Hash.Hashes.MD5)
``` ```

View File

@@ -1,6 +1,6 @@
{ {
"name": "occulto", "name": "occulto",
"version": "2.0.0-rc.10", "version": "2.0.1",
"license": "MIT", "license": "MIT",
"description": "crypt utility", "description": "crypt utility",
"keywords": [ "keywords": [
@@ -13,7 +13,7 @@
"node": ">=16", "node": ">=16",
"npm": "please-use-pnpm", "npm": "please-use-pnpm",
"yarn": "please-use-pnpm", "yarn": "please-use-pnpm",
"pnpm": "7" "pnpm": ">=8"
}, },
"type": "module", "type": "module",
"types": "./dist/index.d.ts", "types": "./dist/index.d.ts",
@@ -41,15 +41,15 @@
}, },
"devDependencies": { "devDependencies": {
"@endyjasmi/karma-playwright-launcher": "^0.0.4", "@endyjasmi/karma-playwright-launcher": "^0.0.4",
"@types/node": "^16.18.11", "@types/node": "^16.18.24",
"chai": "^4.3.7", "chai": "^4.3.7",
"karma": "^6.4.1", "karma": "^6.4.2",
"karma-mocha": "^2.0.1", "karma-mocha": "^2.0.1",
"mocha": "^10.2.0", "mocha": "^10.2.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"playwright": "^1.29.2", "playwright": "^1.32.3",
"typedoc": "^0.23.24", "typedoc": "^0.24.6",
"typescript": "^4.9.4" "typescript": "^5.0.4"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

823
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff