init project

This commit is contained in:
2024-06-05 23:17:19 +02:00
commit 891b54034b
7 changed files with 108 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
.idea/
bun.lockb
package-lock.json
node_modules/
._*
.DS_Store
+22
View File
@@ -0,0 +1,22 @@
when:
- path:
include: [
'src/**/*.ts',
'index.ts'
]
steps:
install:
image: node
when:
- event: [pull_request, push, manual]
commands:
- npm install
test:
image: oven/bun:alpine
when:
- event: [pull_request, push, manual]
depends_on: install
commands:
- bun test
+7
View File
@@ -0,0 +1,7 @@
Tests : ![CI status](https://ci.pband.ch/api/badges/11/status.svg "CI status")
# Crypto tools
Various crypto tools used often.
The lib is based as much as possible on the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) !
The JWT part uses [JOSE](https://github.com/panva/jose) as it implements all the JWT functions.
The signature part uses [noble-ed25519](https://github.com/paulmillr/noble-ed25519) instead of the Web Crypto API, so you can derive a KeyPair from a password.
+2
View File
@@ -0,0 +1,2 @@
[test]
preload = "./test/init.ts"
+30
View File
@@ -0,0 +1,30 @@
{
"name": "crypto",
"description": "Various crypto utils for encryption, signature, ...",
"version": "1.0.0",
"author": "Pascal Perrenoud <pascal@pband.ch>",
"module": "index.ts",
"type": "module",
"files": ["index.ts", "src"],
"scripts": {
"test": "bun test"
},
"dependencies": {
"@noble/ed25519": "^2.1.0",
"jose": "^5.3.0",
"log": "git+https://git.pband.ch/typescript/log.git",
"misc": "git+https://git.pband.ch/typescript/misc.git"
},
"devDependencies": {
"@happy-dom/global-registrator": "^14.10.2",
"@types/bun": "^1.1.2",
"logger-console": "git+https://git.pband.ch/typescript/logger-console.git"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
}
+8
View File
@@ -0,0 +1,8 @@
import {GlobalRegistrator} from '@happy-dom/global-registrator'
import {Console} from 'logger-console'
import {writers, Level} from 'log'
GlobalRegistrator.register()
const logger = new Console({ minLevel: Level.DEBUG, with_color: true })
writers.set('console', logger)
+33
View File
@@ -0,0 +1,33 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext","dom"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"allowJs": true,
"checkJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"forceConsistentCasingInFileNames": true,
"noPropertyAccessFromIndexSignature": false
},
"include": [
"index.ts",
"src/**/*.ts"
]
}