From 2adc86e60f83eaf8dbe10b53cb2dde5320808aad Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Thu, 6 Mar 2025 22:47:45 +0700 Subject: [PATCH] chore(deps): bump simplewebauthn to v10 --- apps/api/src/app/auth/web-auth.service.ts | 13 +++++----- package-lock.json | 30 +++++++++++------------ package.json | 6 ++--- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/apps/api/src/app/auth/web-auth.service.ts b/apps/api/src/app/auth/web-auth.service.ts index 2f8dd1018..e33bd19ee 100644 --- a/apps/api/src/app/auth/web-auth.service.ts +++ b/apps/api/src/app/auth/web-auth.service.ts @@ -24,6 +24,7 @@ import { verifyRegistrationResponse, VerifyRegistrationResponseOpts } from '@simplewebauthn/server'; +import { isoBase64URL, isoUint8Array } from '@simplewebauthn/server/helpers'; import { AssertionCredentialJSON, @@ -54,7 +55,7 @@ export class WebAuthService { const opts: GenerateRegistrationOptionsOpts = { rpName: 'Ghostfolio', rpID: this.rpID, - userID: user.id, + userID: isoUint8Array.fromUTF8String(user.id), userName: '', timeout: 60000, attestationType: 'indirect', @@ -114,7 +115,8 @@ export class WebAuthService { const { counter, credentialID, credentialPublicKey } = registrationInfo; let existingDevice = devices.find( - (device) => device.credentialId === credentialID + (device) => + isoBase64URL.fromBuffer(device.credentialId) === credentialID ); if (!existingDevice) { @@ -148,9 +150,8 @@ export class WebAuthService { const opts: GenerateAuthenticationOptionsOpts = { allowCredentials: [ { - id: device.credentialId, - transports: ['internal'], - type: 'public-key' + id: isoBase64URL.fromBuffer(device.credentialId), + transports: ['internal'] } ], rpID: this.rpID, @@ -188,7 +189,7 @@ export class WebAuthService { try { const opts: VerifyAuthenticationResponseOpts = { authenticator: { - credentialID: device.credentialId, + credentialID: isoBase64URL.fromBuffer(device.credentialId), credentialPublicKey: device.credentialPublicKey, counter: device.counter }, diff --git a/package-lock.json b/package-lock.json index 11e1b6ebd..6b1c60bfa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,8 +41,8 @@ "@nestjs/schedule": "4.1.2", "@nestjs/serve-static": "4.0.2", "@prisma/client": "6.4.1", - "@simplewebauthn/browser": "9.0.1", - "@simplewebauthn/server": "9.0.3", + "@simplewebauthn/browser": "10.0.0", + "@simplewebauthn/server": "10.0.1", "@stripe/stripe-js": "5.4.0", "alphavantage": "2.2.0", "big.js": "6.2.2", @@ -120,7 +120,7 @@ "@nx/web": "20.3.2", "@nx/workspace": "20.3.2", "@schematics/angular": "19.0.6", - "@simplewebauthn/types": "9.0.1", + "@simplewebauthn/types": "10.0.0", "@storybook/addon-essentials": "8.4.7", "@storybook/addon-interactions": "8.4.7", "@storybook/angular": "8.4.7", @@ -9225,18 +9225,18 @@ } }, "node_modules/@simplewebauthn/browser": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@simplewebauthn/browser/-/browser-9.0.1.tgz", - "integrity": "sha512-wD2WpbkaEP4170s13/HUxPcAV5y4ZXaKo1TfNklS5zDefPinIgXOpgz1kpEvobAsaLPa2KeH7AKKX/od1mrBJw==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@simplewebauthn/browser/-/browser-10.0.0.tgz", + "integrity": "sha512-hG0JMZD+LiLUbpQcAjS4d+t4gbprE/dLYop/CkE01ugU/9sKXflxV5s0DRjdz3uNMFecatRfb4ZLG3XvF8m5zg==", "license": "MIT", "dependencies": { - "@simplewebauthn/types": "^9.0.1" + "@simplewebauthn/types": "^10.0.0" } }, "node_modules/@simplewebauthn/server": { - "version": "9.0.3", - "resolved": "https://registry.npmjs.org/@simplewebauthn/server/-/server-9.0.3.tgz", - "integrity": "sha512-FMZieoBosrVLFxCnxPFD9Enhd1U7D8nidVDT4MsHc6l4fdVcjoeHjDueeXCloO1k5O/fZg1fsSXXPKbY2XTzDA==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@simplewebauthn/server/-/server-10.0.1.tgz", + "integrity": "sha512-djNWcRn+H+6zvihBFJSpG3fzb0NQS9c/Mw5dYOtZ9H+oDw8qn9Htqxt4cpqRvSOAfwqP7rOvE9rwqVaoGGc3hg==", "license": "MIT", "dependencies": { "@hexagon/base64": "^1.1.27", @@ -9246,11 +9246,11 @@ "@peculiar/asn1-rsa": "^2.3.8", "@peculiar/asn1-schema": "^2.3.8", "@peculiar/asn1-x509": "^2.3.8", - "@simplewebauthn/types": "^9.0.1", + "@simplewebauthn/types": "^10.0.0", "cross-fetch": "^4.0.0" }, "engines": { - "node": ">=16.0.0" + "node": ">=20.0.0" } }, "node_modules/@simplewebauthn/server/node_modules/cross-fetch": { @@ -9263,9 +9263,9 @@ } }, "node_modules/@simplewebauthn/types": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/@simplewebauthn/types/-/types-9.0.1.tgz", - "integrity": "sha512-tGSRP1QvsAvsJmnOlRQyw/mvK9gnPtjEc5fg2+m8n+QUa+D7rvrKkOYyfpy42GTs90X3RDOnqJgfHt+qO67/+w==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@simplewebauthn/types/-/types-10.0.0.tgz", + "integrity": "sha512-SFXke7xkgPRowY2E+8djKbdEznTVnD5R6GO7GPTthpHrokLvNKw8C3lFZypTxLI7KkCfGPfhtqB3d7OVGGa9jQ==", "license": "MIT" }, "node_modules/@sinclair/typebox": { diff --git a/package.json b/package.json index 9df5e1172..a94bd9374 100644 --- a/package.json +++ b/package.json @@ -87,8 +87,8 @@ "@nestjs/schedule": "4.1.2", "@nestjs/serve-static": "4.0.2", "@prisma/client": "6.4.1", - "@simplewebauthn/browser": "9.0.1", - "@simplewebauthn/server": "9.0.3", + "@simplewebauthn/browser": "10.0.0", + "@simplewebauthn/server": "10.0.1", "@stripe/stripe-js": "5.4.0", "alphavantage": "2.2.0", "big.js": "6.2.2", @@ -166,7 +166,7 @@ "@nx/web": "20.3.2", "@nx/workspace": "20.3.2", "@schematics/angular": "19.0.6", - "@simplewebauthn/types": "9.0.1", + "@simplewebauthn/types": "10.0.0", "@storybook/addon-essentials": "8.4.7", "@storybook/addon-interactions": "8.4.7", "@storybook/angular": "8.4.7",