Skip to content

Commit af2a8f8

Browse files
committed
Merge remote-tracking branch 'origin' into mDL-age-verification-demo
2 parents 1b993c8 + ba8afb1 commit af2a8f8

31 files changed

Lines changed: 1791 additions & 2541 deletions

.github/workflows/heka-identity-service-verify.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,16 @@ jobs:
6565
- name: Run ESLint
6666
run: yarn lint
6767

68-
# TODO - re-enable tests after we add proper support for ESM packages in tests configuration
69-
# - name: Run unit tests
70-
# run: env FORCE_COLOR=1 yarn test ./src --config=./src/jest.config.ts --ci --reporters=default
71-
72-
# - name: Run integration tests
73-
# env:
74-
# MIKRO_ORM_HOST: postgres
75-
# MIKRO_ORM_PORT: 5432
76-
# MIKRO_ORM_USER: heka
77-
# MIKRO_ORM_PASSWORD: heka1
78-
# WALLET_POSTGRES_HOST: postgres
79-
# EXPRESS_HOST: localhost
80-
# FILE_STORAGE_FS_URL: http://localhost:3000
81-
# APP_ENDPOINT: http://localhost:3000
82-
# run: yarn test --ci --reporters=default
68+
- name: Run tests
69+
env:
70+
FORCE_COLOR: 1
71+
NODE_OPTIONS: --max-old-space-size=6144
72+
MIKRO_ORM_HOST: localhost
73+
MIKRO_ORM_PORT: 5432
74+
MIKRO_ORM_USER: heka
75+
MIKRO_ORM_PASSWORD: heka1
76+
WALLET_POSTGRES_HOST: localhost
77+
EXPRESS_HOST: localhost
78+
FILE_STORAGE_FS_URL: http://localhost:3000
79+
APP_ENDPOINT: http://localhost:3000
80+
run: yarn test

heka-auth-service/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ Authentication service for [Heka Identity Service](https://github.com/hiero-ledg
99
#### Locally
1010

1111
1. Run local Postgres database with the following command:
12-
```
13-
bash
12+
```bash
1413
$ docker run --name heka-auth-service-postgres -e POSTGRES_DB=heka-auth-service -e POSTGRES_USER=heka -e POSTGRES_PASSWORD=heka1 -p 5433:5432 -d postgres
1514
```
1615
2. Install dependencies:

heka-auth-service/src/oauth/oauth.service.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,18 @@ export class OAuthService {
4242
}
4343

4444
public async refreshToken(accessToken: string, refreshToken: string): Promise<RefreshResponse> {
45-
// parse refresh token
46-
const refresh = await this.jwtService.decode(refreshToken)
45+
let refresh: { exp?: number; jti?: string }
46+
try {
47+
refresh = await this.jwtService.verifyAsync(refreshToken, {
48+
secret: this.configService.jwtConfig.secret,
49+
issuer: this.configService.jwtConfig.issuer,
50+
audience: this.configService.jwtConfig.audience,
51+
})
52+
} catch {
53+
throw new UnauthorizedException('Refresh token is incorrect.')
54+
}
4755

48-
// check expiration of the refresh token
49-
if (SecondsToDate(refresh.exp) <= new Date()) {
56+
if (!refresh.jti) {
5057
throw new UnauthorizedException('Refresh token is incorrect.')
5158
}
5259

heka-identity-service/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20-bullseye-slim
1+
FROM node:22-bullseye-slim
22

33
ARG EXPRESS_PORT
44

heka-identity-service/docs/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Heka Identity Service - API
1+
# Heka Identity Service - API
22

33
The Identity Service provides a REST API (by default, it is available at <http://localhost:3000> for the locally running application). This API can be explored and accessed via Swagger UI which is available at `/docs` path (<http://localhost:3000/docs> for the case above).
44
Since API methods often initiate asynchronous processes, the Generic Agency server provides notification events to inform clients of any updates to the process. These notifications can be received through a webhook URL or a WebSocket connection, you can choose your preferred method for receiving notification using `/user` endpoint.

heka-identity-service/docs/setup.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ To run Heka Identity Service locally, follow these steps:
3232
Identity Service endpoints are protected with JWT Authentication and require integration with OAuth 2.0 Authorization Server.
3333

3434
You can modify JWT verification options by setting the following environment variables:
35+
3536
- `JWT_SECRET` - secret used to sign and verify tokens, defaults to `test`
3637
- `JWT_VERIFY_OPTIONS_ISSUER` - required value of `iss` claim, defaults to `Heka`
37-
- `JWT_VERIFY_OPTIONS_AUDIENCE` - required value of `aud` claim, defaults to `Heka Identity Platform`
38+
- `JWT_VERIFY_OPTIONS_AUDIENCE` - required value of `aud` claim, defaults to `Heka Identity Service`
3839

3940
While integration with external auth providers is supported, it's recommended to use [Heka Auth Service](https://github.com/hiero-ledger/heka-identity-platform/tree/main/heka-auth-service) for basic deployments.
4041

heka-identity-service/jest.config.ts

Lines changed: 0 additions & 44 deletions
This file was deleted.

heka-identity-service/package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"start": "ts-node -r tsconfig-paths/register -r @openwallet-foundation/askar-nodejs src/main.ts",
1111
"watch": "nodemon --config nodemon.json",
1212
"debug": "nodemon --config nodemon-debug.json",
13-
"test": "node --experimental-vm-modules node_modules/.bin/jest --runInBand --forceExit",
13+
"test": "vitest run",
14+
"test:watch": "vitest",
1415
"check-types": "yarn check-types:src && yarn check-types:test",
1516
"check-types:src": "tsc -p tsconfig.src.json --noEmit",
1617
"check-types:test": "tsc -p tsconfig.test.json --noEmit",
@@ -89,14 +90,12 @@
8990
"zstd-napi": "^0.0.10"
9091
},
9192
"devDependencies": {
92-
"@golevelup/ts-jest": "^0.3.7",
93+
"@golevelup/ts-vitest": "^0.5.2",
9394
"@mikro-orm/cli": "^5.7.12",
9495
"@mikro-orm/sqlite": "^5.7.12",
9596
"@nestjs/testing": "^11.1.5",
9697
"@types/express": "^5.0.0",
9798
"@types/fs-extra": "^11.0.2",
98-
"@types/jest": "^29.5.1",
99-
"@types/jest-when": "^3.5.2",
10099
"@types/jsonwebtoken": "^9.0.10",
101100
"@types/multer": "^1.4.11",
102101
"@types/node": "^18.15.12",
@@ -111,19 +110,19 @@
111110
"eslint-import-resolver-typescript": "^3.5.5",
112111
"eslint-plugin-import": "^2.27.5",
113112
"eslint-plugin-prettier": "^5.1.3",
114-
"jest": "^29.5.0",
115-
"jest-when": "^3.5.2",
116113
"jsonwebtoken": "^9.0.0",
117114
"nodemon": "^2.0.22",
118115
"patch-package": "^8.0.0",
119116
"postinstall-postinstall": "^2.1.0",
120117
"prettier": "^3.1.0",
121118
"supertest": "^6.3.3",
122119
"superwstest": "^2.0.3",
123-
"ts-jest": "^29.1.0",
124120
"ts-loader": "^9.4.2",
125121
"ts-node": "^10.9.1",
126122
"tsconfig-paths": "^4.2.0",
123+
"vite-tsconfig-paths": "^5.1.4",
124+
"vitest": "^2.1.8",
125+
"vitest-when": "0.5.0",
127126
"ws": "^8.13.0"
128127
},
129128
"mikro-orm": {
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import type { MockedFunction } from 'vitest'
2+
13
export { pino as testLogger } from 'pino'
24

3-
export function mockFunction<T extends (...args: any[]) => any>(fn: T): jest.MockedFunction<T> {
4-
return fn as jest.MockedFunction<T>
5+
export function mockFunction<T extends (...args: any[]) => any>(fn: T): MockedFunction<T> {
6+
return fn as MockedFunction<T>
57
}

heka-identity-service/src/common/entities/schema.entity.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Use type-only imports to break ESM circular dependency TDZ with schema-field and schema-registration.
22
// The @OneToMany decorators use string entity names so there is no runtime reference to these modules.
3-
43
import type { SchemaField } from './schema-field.entity'
54
import type { SchemaRegistration } from './schema-registration.entity'
65

0 commit comments

Comments
 (0)