Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
b7c294342a
|
+3
-3
@@ -1,6 +1,6 @@
|
||||
.idea/
|
||||
bun.lockb
|
||||
package-lock.json
|
||||
node_modules/
|
||||
._*
|
||||
.idea/
|
||||
.DS_Store
|
||||
node_modules/
|
||||
dist/
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
.woodpecker/
|
||||
test/
|
||||
.gitignore
|
||||
README.md
|
||||
.prettierignore
|
||||
.prettierrc
|
||||
eslint.config.ts
|
||||
@@ -0,0 +1,3 @@
|
||||
.woodpecker
|
||||
node_modules
|
||||
dist
|
||||
+4
-1
@@ -1,8 +1,11 @@
|
||||
{
|
||||
"arrowParens": "avoid",
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"bracketSpacing": false,
|
||||
"printWidth": 120,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": true,
|
||||
"trailingComma": "none"
|
||||
}
|
||||
}
|
||||
|
||||
+36
-7
@@ -1,9 +1,6 @@
|
||||
when:
|
||||
- path:
|
||||
include: [
|
||||
'src/**/*.ts',
|
||||
'index.ts'
|
||||
]
|
||||
include: ['**/*.{js,jsx,ts,tsx}']
|
||||
|
||||
steps:
|
||||
install:
|
||||
@@ -13,10 +10,42 @@ steps:
|
||||
commands:
|
||||
- npm install
|
||||
|
||||
test:
|
||||
image: oven/bun:alpine
|
||||
typecheck:
|
||||
image: node
|
||||
when:
|
||||
- event: [pull_request, push, manual]
|
||||
depends_on: install
|
||||
commands:
|
||||
- bun test
|
||||
- npm run typecheck
|
||||
|
||||
lint:
|
||||
image: node
|
||||
when:
|
||||
- event: [pull_request, push, manual]
|
||||
depends_on: install
|
||||
commands:
|
||||
- npm run lint
|
||||
|
||||
fmt:
|
||||
image: node
|
||||
when:
|
||||
- event: [pull_request, push, manual]
|
||||
depends_on: install
|
||||
commands:
|
||||
- npm run check:fmt
|
||||
|
||||
test:
|
||||
image: node
|
||||
when:
|
||||
- event: [pull_request, push, manual]
|
||||
depends_on: install
|
||||
commands:
|
||||
- npm run test
|
||||
|
||||
check:
|
||||
image: node
|
||||
when:
|
||||
- event: [pull_request, push, manual]
|
||||
depends_on: install
|
||||
commands:
|
||||
- npm run check
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
[test]
|
||||
preload = "./test/init.ts"
|
||||
@@ -0,0 +1,15 @@
|
||||
import js from '@eslint/js'
|
||||
import globals from 'globals'
|
||||
import tseslint from 'typescript-eslint'
|
||||
import {defineConfig, globalIgnores} from 'eslint/config'
|
||||
|
||||
export default defineConfig([
|
||||
tseslint.configs.recommended,
|
||||
{
|
||||
files: ['**/*.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
||||
plugins: {js},
|
||||
extends: ['js/recommended'],
|
||||
languageOptions: {globals: {...globals.browser, ...globals.node}}
|
||||
},
|
||||
globalIgnores(['dist'])
|
||||
])
|
||||
@@ -1,28 +0,0 @@
|
||||
import SecretBox from './src/secret-box'
|
||||
import SecretWrap from './src/secret-wrap'
|
||||
import PrivateBox from './src/private-box'
|
||||
import PrivateWrap from './src/private-wrap'
|
||||
import PwdBox from './src/pwd-box'
|
||||
import PwdWrap from './src/pwd-wrap'
|
||||
import {hash, verify} from './src/pwd'
|
||||
|
||||
export enum Strength {
|
||||
weak,
|
||||
moderate,
|
||||
strong
|
||||
}
|
||||
|
||||
export const set_strength = (new_strength: Strength) => {
|
||||
if (!(new_strength in Strength)) throw 'Invalid strength !'
|
||||
strength = new_strength
|
||||
}
|
||||
let strength = Strength.moderate
|
||||
export let STRENGTH: () => Strength = () => strength
|
||||
|
||||
export * as kdf from './src/kdf'
|
||||
export * as misc from './src/misc'
|
||||
export * as signature from './src/signature'
|
||||
export * as JWT from './src/jwt'
|
||||
export const pwd = {hash, verify}
|
||||
|
||||
export {SecretBox, SecretWrap, PrivateBox, PrivateWrap, PwdBox, PwdWrap}
|
||||
+21
-15
@@ -3,28 +3,34 @@
|
||||
"description": "Various crypto utils for encryption, signature, ...",
|
||||
"version": "1.0.0",
|
||||
"author": "Pascal Perrenoud <pascal@pband.ch>",
|
||||
|
||||
"scripts": {
|
||||
"check": "clear && npm run typecheck && npm run lint && npm run check:fmt && npm run test && clear && echo 'OK'",
|
||||
"check:fmt": "npx prettier -c src/*.ts",
|
||||
"fmt": "prettier --write src/*.ts",
|
||||
"lint": "eslint src/*.ts",
|
||||
"test": "bun test",
|
||||
"fmt": "prettier --config .prettierrc '**/*.ts' --write"
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
|
||||
"dependencies": {
|
||||
"jose": "^5.3.0",
|
||||
"log": "git+https://git.pband.ch/typescript/log.git",
|
||||
"misc": "git+https://git.pband.ch/typescript/misc.git"
|
||||
"misc": "git+ssh://git@git.pband.ch:typescript/misc.git#main",
|
||||
"log": "git+ssh://git@git.pband.ch:typescript/log.git#main"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "^1.1.2",
|
||||
"bun": "^1.1.27",
|
||||
"logger-console": "git+https://git.pband.ch/typescript/logger-console.git",
|
||||
"prettier": "^3.3.3"
|
||||
"@eslint/js": "^9.35.0",
|
||||
"@types/bun": "^1.2.21",
|
||||
"bun": "^1.2.21",
|
||||
"eslint": "^9.35.0",
|
||||
"globals": "^16.4.0",
|
||||
"jiti": "^2.5.1",
|
||||
"logger-console": "git+ssh://git@git.pband.ch:typescript/logger-console.git#main",
|
||||
"prettier": "^3.6.2",
|
||||
"typescript": "^5.9.2",
|
||||
"typescript-eslint": "^8.43.0"
|
||||
},
|
||||
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"index.ts",
|
||||
"src"
|
||||
]
|
||||
"main": "./src/index.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import SecretBox from './secret-box'
|
||||
import SecretWrap from './secret-wrap'
|
||||
import PrivateBox from './private-box'
|
||||
import PrivateWrap from './private-wrap'
|
||||
import PwdBox from './pwd-box'
|
||||
import PwdWrap from './pwd-wrap'
|
||||
import {hash, verify} from './pwd'
|
||||
|
||||
export enum Strength {
|
||||
weak,
|
||||
moderate,
|
||||
strong
|
||||
}
|
||||
|
||||
export const set_strength = (new_strength: Strength) => {
|
||||
if (!(new_strength in Strength)) throw 'Invalid strength !'
|
||||
strength = new_strength
|
||||
}
|
||||
let strength = Strength.moderate
|
||||
export const STRENGTH: () => Strength = () => strength
|
||||
|
||||
export * as kdf from './kdf'
|
||||
export * as misc from './misc'
|
||||
export * as signature from './signature'
|
||||
export * as JWT from './jwt'
|
||||
export const pwd = {hash, verify}
|
||||
|
||||
export {SecretBox, SecretWrap, PrivateBox, PrivateWrap, PwdBox, PwdWrap}
|
||||
@@ -1,6 +1,6 @@
|
||||
import {test, expect} from 'bun:test'
|
||||
|
||||
import {signature} from '../index'
|
||||
import {signature} from '..'
|
||||
import {gen, sign, verify} from '../src/signature'
|
||||
|
||||
test('base case', async () => {
|
||||
|
||||
+8
-27
@@ -1,33 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
// Enable latest features
|
||||
"lib": ["ESNext","dom"],
|
||||
"target": "ESNext",
|
||||
"target": "ES2020",
|
||||
"module": "ESNext",
|
||||
"moduleDetection": "force",
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
|
||||
// Bundler mode
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
|
||||
// Best practices
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"outDir": "dist",
|
||||
"rootDir": "./src",
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
|
||||
// Some stricter flags (disabled by default)
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noPropertyAccessFromIndexSignature": false
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
|
||||
"include": [
|
||||
"index.ts",
|
||||
"src/**/*.ts"
|
||||
]
|
||||
"include": ["src"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user