Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade simplewebauthn packages #7477

Merged
merged 7 commits into from
Mar 22, 2023
Merged
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
2 changes: 1 addition & 1 deletion packages/auth-providers/dbAuth/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@babel/cli": "7.21.0",
"@babel/core": "7.21.3",
"@redwoodjs/api": "4.0.0",
"@simplewebauthn/server": "6.2.2",
"@simplewebauthn/server": "7.2.0",
"@types/crypto-js": "4.1.1",
"@types/md5": "2.3.2",
"@types/uuid": "9.0.1",
Expand Down
16 changes: 8 additions & 8 deletions packages/auth-providers/dbAuth/api/src/DbAuthHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import type {
VerifiedAuthenticationResponse,
} from '@simplewebauthn/server'
import type {
AuthenticationCredentialJSON,
RegistrationCredentialJSON,
AuthenticationResponseJSON,
RegistrationResponseJSON,
} from '@simplewebauthn/typescript-types'
import type { APIGatewayProxyEvent, Context as LambdaContext } from 'aws-lambda'
import base64url from 'base64url'
Expand Down Expand Up @@ -234,8 +234,8 @@ export type AuthMethodNames =
| 'webAuthnAuthOptions'
| 'webAuthnAuthenticate'

type Params = AuthenticationCredentialJSON &
RegistrationCredentialJSON & {
type Params = AuthenticationResponseJSON &
RegistrationResponseJSON & {
username?: string
password?: string
method: AuthMethodNames
Expand Down Expand Up @@ -722,7 +722,7 @@ export class DbAuthHandler<
let verification: VerifiedAuthenticationResponse
try {
const opts: VerifyAuthenticationResponseOpts = {
credential: this.params,
response: this.params,
expectedChallenge: user[this.options.authFields.challenge as string],
expectedOrigin: webAuthnOptions.origin,
expectedRPID: webAuthnOptions.domain,
Expand Down Expand Up @@ -899,7 +899,7 @@ export class DbAuthHandler<
let verification: VerifiedRegistrationResponse
try {
const options: VerifyRegistrationResponseOpts = {
credential: this.params,
response: this.params,
expectedChallenge: user[this.options.authFields.challenge as string],
expectedOrigin: this.options.webAuthn.origin,
expectedRPID: this.options.webAuthn.domain,
Expand All @@ -915,7 +915,7 @@ export class DbAuthHandler<

if (verified && registrationInfo) {
const { credentialPublicKey, credentialID, counter } = registrationInfo
plainCredentialId = base64url.encode(credentialID)
plainCredentialId = base64url.encode(Buffer.from(credentialID))

const existingDevice = await this.dbCredentialAccessor.findFirst({
where: {
Expand All @@ -931,7 +931,7 @@ export class DbAuthHandler<
[this.options.webAuthn.credentialFields.userId]:
user[this.options.authFields.id],
[this.options.webAuthn.credentialFields.publicKey]:
credentialPublicKey,
Buffer.from(credentialPublicKey),
[this.options.webAuthn.credentialFields.transports]: this.params
.transports
? JSON.stringify(this.params.transports)
Expand Down
4 changes: 2 additions & 2 deletions packages/auth-providers/dbAuth/setup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dependencies": {
"@babel/runtime-corejs3": "7.21.0",
"@redwoodjs/cli-helpers": "4.0.0",
"@simplewebauthn/browser": "6.2.2",
"@simplewebauthn/browser": "7.2.0",
"core-js": "3.29.1",
"prompts": "2.4.2",
"secure-random-password": "0.2.3",
Expand All @@ -33,7 +33,7 @@
"devDependencies": {
"@babel/cli": "7.21.0",
"@babel/core": "7.21.3",
"@simplewebauthn/typescript-types": "6.2.1",
"@simplewebauthn/typescript-types": "7.0.0",
"@types/secure-random-password": "0.2.1",
"@types/yargs": "17.0.23",
"jest": "29.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { functionsPath, libPath } from './setupData'
export { extraTask } from './setupData'

// required packages to install on the web side
export const webPackages = ['@simplewebauthn/browser@^6']
export const webPackages = ['@simplewebauthn/browser@^7']

// required packages to install on the api side
export const apiPackages = ['@simplewebauthn/server@^6']
export const apiPackages = ['@simplewebauthn/server@^7']

// any notes to print out when the job is done
export const notes = [
Expand Down
4 changes: 2 additions & 2 deletions packages/auth-providers/dbAuth/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
"dependencies": {
"@babel/runtime-corejs3": "7.21.0",
"@redwoodjs/auth": "4.0.0",
"@simplewebauthn/browser": "6.2.2",
"@simplewebauthn/browser": "7.2.0",
"core-js": "3.29.1"
},
"devDependencies": {
"@babel/cli": "7.21.0",
"@babel/core": "7.21.3",
"@simplewebauthn/typescript-types": "6.2.1",
"@simplewebauthn/typescript-types": "7.0.0",
"@types/react": "18.0.28",
"jest": "29.5.0",
"react": "18.2.0",
Expand Down
Loading