Open grobarko opened 5 months ago
Hey, Having the same problem here. Is there any solution to this?
I found a solution. To anybody still having this issue it might be your register passkey options check if your user.id is base64 or base64URL (includes '_' or '-') and replace them with '/' and '+' respectively
File causing the error: passkeys_ios/ios/classes/PasskeysPlugin.swift
guard let decodedChallenge = Data.fromBase64Url(challenge) else {
completion(.failure(CustomErrors.decodingChallenge))
return
}
guard let decodedUserId = Data.fromBase64(user.id) else {
completion(.failure(CustomErrors.decodingChallenge))
return
}
Flutter code fixed:
RegisterRequestType(
attestation: result.attestation,
authSelectionType: AuthenticatorSelectionType(
authenticatorAttachment: 'platform',
requireResidentKey:
result.authenticatorSelection.requireResidentKey,
residentKey: result.authenticatorSelection.residentKey,
userVerification: result.authenticatorSelection.userVerification),
challenge: result.challenge,
excludeCredentials: result.excludeCredentials
.map((e) =>
CredentialType(type: 'public-key', id: e.id, transports: []))
.toList(),
pubKeyCredParams: result.pubKeyCredParams
.map((e) => PubKeyCredParamType(type: e.type, alg: e.alg))
.toList(),
relyingParty:
RelyingPartyType(id: result.rp.id, name: result.rp.name),
timeout: result.timeout,
user: UserType(
displayName: result.user.name,
id: result.user.id.replaceAll("-", "+").replaceAll("_", "/"), // this is the fix
name: result.user.name));
Code:
Error:
Some of the RP server data for registration options: