diff --git a/.github/workflows/bunhono_ci.yml b/.github/workflows/bunhono_ci.yml index 1406665..daa5cda 100644 --- a/.github/workflows/bunhono_ci.yml +++ b/.github/workflows/bunhono_ci.yml @@ -23,4 +23,7 @@ jobs: bun run lint bun run test env: - APP_PORT: 3000 + APP_PORT: ${{ variables.APP_PORT }} + DATABASE_URL: ${{ secrets.DATABASE_URL }} + ACCESS_TOKEN_AGE: ${{ variables.ACCESS_TOKEN_AGE }} + ACCESS_TOKEN_SECRET: ${{ secrets.ACCESS_TOKEN_SECRET }} diff --git a/src/Infrastructures/container.ts b/src/Infrastructures/container.ts index 93cdc42..a574452 100644 --- a/src/Infrastructures/container.ts +++ b/src/Infrastructures/container.ts @@ -1,10 +1,7 @@ /* istanbul ignore file */ - import { createContainer } from 'instances-container'; // external agency -import { password } from 'bun'; -import { sign, verify } from 'hono/jwt'; import prismaClient from '@infrastructures/database/prismaClient'; @@ -44,22 +41,10 @@ container.register([ { key: PasswordHash.name, Class: BunBCryptPasswordHash, - parameter: { - injectType: 'parameter', - dependencies: [ - { concrete: password } - ] - } }, { key: AuthenticationTokenManager.name, Class: HonoJwtTokenManager, - parameter: { - injectType: 'parameter', - dependencies: [ - { concrete: { sign, verify } } - ] - } } ]); diff --git a/src/Infrastructures/security/BunBCryptPasswordHash.ts b/src/Infrastructures/security/BunBCryptPasswordHash.ts index 814a567..3e93e41 100644 --- a/src/Infrastructures/security/BunBCryptPasswordHash.ts +++ b/src/Infrastructures/security/BunBCryptPasswordHash.ts @@ -1,4 +1,4 @@ -import type { password } from 'bun'; +import { password } from 'bun'; import AuthenticationError from '@commons/exceptions/AuthenticationError'; import PasswordHash from '@applications/security/PasswordHash'; @@ -6,9 +6,9 @@ import PasswordHash from '@applications/security/PasswordHash'; class BunBCryptPasswordHash extends PasswordHash { private readonly password; private readonly saltRound; - constructor(bunpassword: typeof password, saltRound: number = 10) { + constructor(saltRound: number = 10) { super(); - this.password = bunpassword; + this.password = password; this.saltRound = saltRound; } diff --git a/src/Infrastructures/security/HonoJwtTokenManager.ts b/src/Infrastructures/security/HonoJwtTokenManager.ts index 35b544d..21f260a 100644 --- a/src/Infrastructures/security/HonoJwtTokenManager.ts +++ b/src/Infrastructures/security/HonoJwtTokenManager.ts @@ -1,13 +1,15 @@ -import type { sign, verify } from 'hono/jwt'; -import type { JWTPayload } from 'hono/utils/jwt/types'; +import { sign, verify } from 'hono/jwt'; +import { JWTPayload } from 'hono/utils/jwt/types'; import AuthenticationTokenManager from '@applications/security/AuthenticationTokenManager'; import InvariantError from '@commons/exceptions/InvariantError'; class HonoJwtTokenManager extends AuthenticationTokenManager { - constructor(public readonly honoJwt: { sign: typeof sign, verify: typeof verify }) { + public readonly honoJwt; + constructor() { super(); + this.honoJwt = { sign, verify }; } public async generateAccessToken(payload: object): Promise {