Hi @peterferguson,
Appreciate the work on this plugin!
I'm using https://github.com/better-auth/better-auth/ (which uses https://github.com/MasterKale/SimpleWebAuthn under the hood) to facilitate passkey usage on my website, and wanted to add the same functionality to my expo app, and so I was very happy to find this repo 🥳
I'm still in the PoC phase so I tried the following setup:
import * as ReactNativePasskeys from 'react-native-passkeys'
// Pass SimpleWebAuthn checks
globalThis.PublicKeyCredential = () => {}
// Initialize global credentials API
navigator.credentials = {
get: ReactNativePasskeys.get,
create: ReactNativePasskeys.create
}
This succeeds in the basic task of letting my use existing better-auth/simplewebauthn code along with this plugin, however upon actually trying to create a passkey, the app crashes.
From what I can tell, the reason is that the API options don't exactly match up. I looked up the types and it's pretty clear:
export declare function create(request: Omit<PublicKeyCredentialCreationOptionsJSON, 'extensions'> & {
extensions?: {
largeBlob?: AuthenticationExtensionsLargeBlobInputs;
};
} & Pick<CredentialCreationOptions, 'signal'>): Promise<RegistrationResponseJSON | null>;
It seems like this plugin "flattens" CredentialCreationOptions.publicKey.
Is there a particular reason for it? Are you open to amending the API to conform to the web standard?
P.S. the actual crash comes from
|
let crossPlatformCredentialProvider = ASAuthorizationSecurityKeyPublicKeyCredentialProvider(relyingPartyIdentifier: request.rp.id!) |
but in general some argument validation is probably not a bad idea, if you'd be open to it I can try to add a PR to add it.
Hi @peterferguson,
Appreciate the work on this plugin!
I'm using https://github.com/better-auth/better-auth/ (which uses https://github.com/MasterKale/SimpleWebAuthn under the hood) to facilitate passkey usage on my website, and wanted to add the same functionality to my expo app, and so I was very happy to find this repo 🥳
I'm still in the PoC phase so I tried the following setup:
This succeeds in the basic task of letting my use existing better-auth/simplewebauthn code along with this plugin, however upon actually trying to create a passkey, the app crashes.
From what I can tell, the reason is that the API options don't exactly match up. I looked up the types and it's pretty clear:
It seems like this plugin "flattens"
CredentialCreationOptions.publicKey.Is there a particular reason for it? Are you open to amending the API to conform to the web standard?
P.S. the actual crash comes from
react-native-passkeys/ios/ReactNativePasskeysModule.swift
Line 151 in 16570e8