Refactor PublicKeyCredentialCreationOptions to match WebAuthn spec (#3443)

This commit is contained in:
Patrick Honkonen 2024-07-11 12:43:51 -04:00 committed by GitHub
parent 9205dbef59
commit b2300328e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -30,7 +30,9 @@ data class PublicKeyCredentialCreationOptions(
@SerialName("authenticatorAttachment")
val authenticatorAttachment: AuthenticatorAttachment? = null,
@SerialName("residentKey")
val residentKey: ResidentKeyRequirement? = null,
val residentKeyRequirement: ResidentKeyRequirement? = null,
@SerialName("userVerification")
val userVerification: UserVerificationRequirement? = null,
) {
/**
* Enum class representing the types of attachments associated with selection criteria.
@ -50,13 +52,38 @@ data class PublicKeyCredentialCreationOptions(
@Serializable
enum class ResidentKeyRequirement {
/**
* User verification is preferred during selection, if supported.
* Resident keys are preferred during selection, if supported.
*/
@SerialName("preferred")
PREFERRED,
/**
* User verification is required during selection.
* Resident keys are required during selection.
*/
@SerialName("required")
REQUIRED,
}
/**
* Enum class indicating the type of user verification requested by the relying party.
*/
@Serializable
enum class UserVerificationRequirement {
/**
* User verification should not be performed.
*/
@SerialName("discouraged")
DISCOURAGED,
/**
* User verification is preferred, if supported by the device or application.
*/
@SerialName("preferred")
PREFERRED,
/**
* User verification is required. If is cannot be performed the registration process
* should be terminated.
*/
@SerialName("required")
REQUIRED,