Code Monkey home page Code Monkey logo

passkey-tutorial's People

Contributors

vincentdelitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

passkey-tutorial's Issues

Login ignores userID in Authentication

You must include the user.id in credentialService.getCredentialByCredentialId in handleLoginFinish function.

If you have 2 logins from the same device, you must include the user.id in the database query.

In services/credentialService.ts (line 23)
async getCredentialByCredentialId(credentialId: string, userID: string): Promise<AuthenticatorDevice | null> { try { const [rows] = await promisePool.query( "SELECT * FROM credentials WHERE credential_id = ? AND user_id = ? LIMIT 1", [credentialId, userID] ); ...

In controllers/authentication.ts (line 54)
const dbCredential: AuthenticatorDevice | null = await credentialService.getCredentialByCredentialId( credentialID, loggedInUserId );

Costis

It works on passkeys created in Chrome browser but fail to store in iCloud Keychain using Safari.

I tested this out and notice this error in Safari 17.2.1.

sql: "INSERT INTO credentials (user_id, credential_id, public_key, counter, transports) VALUES ('f04bf801-e185-4061-b233-c183d953c9cf', 'lf5E3aMz9/Z98aX/5+cotUfDfkU=', 'pQECAyYgASFYIIc7bKcJroIFbo0Mc6MhZNAglkJPKdKUoYNcHP4UZodLIlgg84z56dl8QVodbitj03Mrtlkl1po1NCWTuRxX7Aczlwo=', 0, 'internal', 'hybrid')",
app-1 | sqlState: '21S01',
app-1 | sqlMessage: "Column count doesn't match value count at row 1"

I think the issue is the column transports in table credentials did not consider two values returned from iCloud Keychain : internal and hybrid.

on src/controllers/registration.ts/handleRegisterFinish function, body.response.transports is an array of strings. It used to be one of the following: "usb", "nfc", "ble", or "internal", but recently, both "internal" and "hybrid" could be returned at the same time, causing the error above

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.