From 7a229cec7972884ec46701b7212b678283c8a723 Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sat, 15 Nov 2025 11:10:55 +0700 Subject: [PATCH] feat(lib): move simplewebauthn interfaces to common lib This includes AssertionCredentialJSON, AttestationCredentialJSON, PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON. --- apps/api/src/app/auth/auth.controller.ts | 10 +++++----- apps/api/src/app/auth/web-auth.service.ts | 9 ++++----- apps/client/src/app/services/web-authn.service.ts | 7 +++---- libs/common/src/lib/interfaces/index.ts | 10 ++++++++++ .../src/lib/interfaces/simplewebauthn.interface.ts | 0 5 files changed, 22 insertions(+), 14 deletions(-) rename apps/api/src/app/auth/interfaces/simplewebauthn.ts => libs/common/src/lib/interfaces/simplewebauthn.interface.ts (100%) diff --git a/apps/api/src/app/auth/auth.controller.ts b/apps/api/src/app/auth/auth.controller.ts index 57fd04bc7..b45e7b97b 100644 --- a/apps/api/src/app/auth/auth.controller.ts +++ b/apps/api/src/app/auth/auth.controller.ts @@ -2,7 +2,11 @@ import { WebAuthService } from '@ghostfolio/api/app/auth/web-auth.service'; import { HasPermissionGuard } from '@ghostfolio/api/guards/has-permission.guard'; import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config'; -import { OAuthResponse } from '@ghostfolio/common/interfaces'; +import { + AssertionCredentialJSON, + AttestationCredentialJSON, + OAuthResponse +} from '@ghostfolio/common/interfaces'; import { Body, @@ -22,10 +26,6 @@ import { Request, Response } from 'express'; import { getReasonPhrase, StatusCodes } from 'http-status-codes'; import { AuthService } from './auth.service'; -import { - AssertionCredentialJSON, - AttestationCredentialJSON -} from './interfaces/simplewebauthn'; @Controller('auth') export class AuthController { diff --git a/apps/api/src/app/auth/web-auth.service.ts b/apps/api/src/app/auth/web-auth.service.ts index 9e70bf6ad..6cffcd244 100644 --- a/apps/api/src/app/auth/web-auth.service.ts +++ b/apps/api/src/app/auth/web-auth.service.ts @@ -2,6 +2,10 @@ import { AuthDeviceService } from '@ghostfolio/api/app/auth-device/auth-device.s import { UserService } from '@ghostfolio/api/app/user/user.service'; import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { AuthDeviceDto } from '@ghostfolio/common/dtos'; +import { + AssertionCredentialJSON, + AttestationCredentialJSON +} from '@ghostfolio/common/interfaces'; import type { RequestWithUser } from '@ghostfolio/common/types'; import { @@ -27,11 +31,6 @@ import { import { isoBase64URL, isoUint8Array } from '@simplewebauthn/server/helpers'; import ms from 'ms'; -import { - AssertionCredentialJSON, - AttestationCredentialJSON -} from './interfaces/simplewebauthn'; - @Injectable() export class WebAuthService { public constructor( diff --git a/apps/client/src/app/services/web-authn.service.ts b/apps/client/src/app/services/web-authn.service.ts index c03bda746..95c264310 100644 --- a/apps/client/src/app/services/web-authn.service.ts +++ b/apps/client/src/app/services/web-authn.service.ts @@ -1,10 +1,9 @@ -/* eslint-disable @nx/enforce-module-boundaries */ +import { SettingsStorageService } from '@ghostfolio/client/services/settings-storage.service'; +import { AuthDeviceDto } from '@ghostfolio/common/dtos'; import { PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON -} from '@ghostfolio/api/app/auth/interfaces/simplewebauthn'; -import { SettingsStorageService } from '@ghostfolio/client/services/settings-storage.service'; -import { AuthDeviceDto } from '@ghostfolio/common/dtos'; +} from '@ghostfolio/common/interfaces'; import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; diff --git a/libs/common/src/lib/interfaces/index.ts b/libs/common/src/lib/interfaces/index.ts index 45a0073f5..e3822334b 100644 --- a/libs/common/src/lib/interfaces/index.ts +++ b/libs/common/src/lib/interfaces/index.ts @@ -78,6 +78,12 @@ import type { QuotesResponse } from './responses/quotes-response.interface'; import type { WatchlistResponse } from './responses/watchlist-response.interface'; import type { RuleSettings } from './rule-settings.interface'; import type { ScraperConfiguration } from './scraper-configuration.interface'; +import type { + AssertionCredentialJSON, + AttestationCredentialJSON, + PublicKeyCredentialCreationOptionsJSON, + PublicKeyCredentialRequestOptionsJSON +} from './simplewebauthn.interface'; import type { Statistics } from './statistics.interface'; import type { SubscriptionOffer } from './subscription-offer.interface'; import type { SymbolItem } from './symbol-item.interface'; @@ -110,9 +116,11 @@ export { AdminUsersResponse, AiPromptResponse, ApiKeyResponse, + AssertionCredentialJSON, AssetClassSelectorOption, AssetProfileIdentifier, AssetResponse, + AttestationCredentialJSON, Benchmark, BenchmarkMarketDataDetailsResponse, BenchmarkProperty, @@ -161,6 +169,8 @@ export { PortfolioSummary, Position, Product, + PublicKeyCredentialCreationOptionsJSON, + PublicKeyCredentialRequestOptionsJSON, PublicPortfolioResponse, QuotesResponse, ResponseError, diff --git a/apps/api/src/app/auth/interfaces/simplewebauthn.ts b/libs/common/src/lib/interfaces/simplewebauthn.interface.ts similarity index 100% rename from apps/api/src/app/auth/interfaces/simplewebauthn.ts rename to libs/common/src/lib/interfaces/simplewebauthn.interface.ts