Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 9 additions & 27 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,10 @@
{
"root": true,
"extends": ["standard", "plugin:n/recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"rules": {
"curly": ["error", "all"],
"brace-style": ["error", "1tbs", { "allowSingleLine": false }],
"guard-for-in": "error",
"no-console": "error",
"no-debugger": "error",
"radix": "error",
"n/no-deprecated-api": "warn",
"n/no-process-exit": "off",
"no-process-exit": "off",
"n/shebang": "off",
"no-empty-function": "error",
"no-shadow": "warn",
"n/no-unpublished-import": "off"
},
"env": {
"commonjs": true,
"es6": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module"
}
}
"root": true,
"extends": ["plugin:@typescript-eslint/recommended", "prettier"],
"rules": {
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-empty-function": "error",
"@typescript-eslint/explicit-function-return-type": "error"
},
"parser": "@typescript-eslint/parser"
}
2 changes: 1 addition & 1 deletion .github/workflows/yarn-vitest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '22'
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn test
Expand Down
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
Timestamp
=============
# Timestamp

Trustedtimestamp service implements the generate and verification of timestamps.

* [Install](#install)
* [Usage](#usage)
* [Params](#params)
* [Default config](#default-config)
* [Config provider options](#config-provider-options)
* [Required fields](#required-fields)
* [Optional fields](#optional-fields)
* [Config example](#config-example)
* [Public methods](#public-methods)

- [Timestamp](#timestamp)
- [Install](#install)
- [Usage](#usage)
- [Params](#params)
- [Default config](#default-config)
- [Config provider options](#config-provider-options)
- [Required fields](#required-fields)
- [Optional fields](#optional-fields)
- [Config example](#config-example)
- [Public methods](#public-methods)

## Install

Expand Down
32 changes: 32 additions & 0 deletions docs/proxy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Proxy configuration

## Configure local proxy

```shell
cd proxy
docker-compose up
```

## Application usage

```json
{
"trustedTimestamp": {
"certsLocation": "/etc/ssl/certs/",
"providers": [
{
"name": "bteszt",
"url": "https://bteszt.e-szigno.hu/tsa",
"auth": {
"user": "<username>",
"pass": "<password>"
},
"proxy": {
"url": "http://localhost:8080",
"allowUnauthorized": true
}
}
]
}
}
```
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@techteamer/timestamp",
"version": "1.0.6",
"version": "2.0.1",
"description": "This package contains a TimestampService, which can create and verity timestamps",
"main": "src/index.ts",
"author": "Techteamer",
Expand All @@ -21,42 +21,40 @@
"url": "https://github.com/TechTeamer/timestamp"
},
"engines": {
"node": ">=16.20.1"
"node": ">=22.0.0"
},
"scripts": {
"vitest": "vitest run --config test/vitest.config.js",
"vitest": "vitest run --config test/vitest.config.ts",
"build": "rollup -c",
"vitest:unit": "yarn vitest unit/",
"vitest:feature": "yarn vitest feature/",
"lint": "eslint . && echo 'npm run lint: OK'",
"lint": "eslint ./src ./test && echo 'npm run lint: OK'",
"lint:fix": "eslint . --fix",
"format": "prettier -w .",
"test": "npm run lint --silent && echo 'npm test: OK'"
},
"type": "module",
"dependencies": {
"@techteamer/cert-utils": "^1.1.3",
"node-fetch": "^2.7.0",
"node-fetch": "^3",
"proxy-agent": "^6.5.0",
"tmp": "^0.2.1"
},
"devDependencies": {
"@rollup/plugin-typescript": "^12.1.4",
"@types/node": "^20.14.6",
"@types/tmp": "^0.2.6",
"@typescript-eslint/eslint-plugin": "^7.16.0",
"@typescript-eslint/parser": "^7.13.1",
"@vitest/coverage-v8": "^2.0.2",
"eslint": "^8.19.0",
"eslint-config-prettier": "^10.1.8",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-n": "^16.3.1",
"eslint-plugin-promise": "^6.0.0",
"nock": "^13.5.4",
"prettier": "^3.6.2",
"rollup": "^4.18.0",
"rollup-plugin-esbuild": "^6.1.1",
"typescript": "^5.5.3",
"typescript": "~5.5",
"vitest": "^2.0.2"
},
"resolutions": {
Expand Down
16 changes: 16 additions & 0 deletions proxy/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
proxy:
image: mitmproxy/mitmproxy
command:
- 'mitmweb'
- '--no-web-open-browser'
- '--listen-port'
- '8080'
- '--web-host'
- '0.0.0.0'
# - '--set'
# - 'web_password=test'
tty: true
ports:
- 8080:8080
- 127.0.0.1:8081:8081
1 change: 1 addition & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const name = './build/timestamp_config'
const bundle = config => ({
...config,
input: 'src/index.ts',
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
external: id => !/^[./]/.test(id)
})

Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './trustedTimestamp/TrustedTimestampService.js'
export * from './trustedTimestamp/TrustedTimestampService'

export * from './trustedTimestamp/error/create-timestamp-token.error.js'
export * from './trustedTimestamp/error/create-timestamp-token.error'
6 changes: 6 additions & 0 deletions src/patch/node-fetch.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { RequestInfo, RequestInit, Response } from 'node-fetch'

export const fetch = async (url: URL | RequestInfo, init?: RequestInit): Promise<Response> => {
const { default: fetch } = await import('node-fetch')
return fetch(url, init)
}
Loading