Skip to content

fido2-lib with android and ios #149

@Elolawyn

Description

@Elolawyn

Hi, I am executing a demo with fido2-lib on the backend with mocked data. The library I am using (react-native-passkey) on the device seems to be working because the passkey generation and usage system dialogs appears and the library is returning the following clientDataObj to be checked by fido2-lib:

On iOS, the PasskeyRegistrationResult the library is returning provided me the following clientDataObj:

{
  type: 'webauthn.create',
  challenge: 'challenge_properly_formed',
  origin: 'https://my-web.com'
}

However, on android, the library returns the following clientDataObj:

{
  type: 'webauthn.create',
  challenge: 'challenge_properly_formed',
  origin: 'android:apk-key-hash:HASH',
  androidPackageName: 'com.org.package'
}

On the server side, the following fido2-lib method is working on iOS:

const f2l = new Fido2Lib({
    timeout: 42,
    rpId: "my-web.com",
    rpName: "Web",
    challengeSize: 64,
    attestation: "direct",
    cryptoParams: [-7, -257],
    authenticatorAttachment: "platform",
    authenticatorRequireResidentKey: true,
    authenticatorUserVerification: "required"
});

const expectedAttestationResult: ExpectedAttestationResult = {
  challenge: 'challenge_properly_formed',
  origin: 'https://my-web.com',
  factor: 'first'
}

const attestationResult: Fido2AttestationResult = await f2l.attestationResult(
  clientAttestationResult, // Returned by react-native-passkey on the phone, provided to server end-point
  expectedAttestationResult
)

How should I configure origins for both apps?

In android's case, attestationResult returns Error: clientData origin did not match expected origin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions