Class PublicKeyCredentialRequestOptions

java.lang.Object
com.codename1.backend.security.webauthn.PublicKeyCredentialRequestOptions

public final class PublicKeyCredentialRequestOptions extends Object

What a client is given to sign in with a passkey: a challenge, the relying party, and -- when the user said who they are first -- which credentials may answer.

toMap() is the WebAuthn JSON form, PublicKeyCredentialRequestOptionsJSON, which a browser's PublicKeyCredential.parseRequestOptionsFromJSON and the Codename One client's PublicKeyCredentialRequestOptions.fromJson take as it is:

{"challenge": "9zV1...", "timeout": 300000, "rpId": "example.com",
 "allowCredentials": [], "userVerification": "preferred"}

An empty allowCredentials asks the authenticator for any passkey it holds for this relying party; its answer then names the user.

Made by WebAuthnRelyingPartyOperations.createCredentialRequestOptions(String).

  • Method Details

    • getChallenge

      public byte[] getChallenge()
      The challenge the authenticator's answer must sign.
    • getTimeout

      public long getTimeout()
      How long the client may take, in milliseconds: a hint to it.
    • getRpId

      public String getRpId()
    • getUserVerification

      public String getUserVerification()
      required, preferred or discouraged.
    • getAllowCredentials

      public List<byte[]> getAllowCredentials()
      The ids of the credentials that may answer; empty for any the authenticator holds.
    • getUserId

      public byte[] getUserId()
      The handle of the user who said who they are before the ceremony, whose credential the answer must then be; null when nobody did. Kept with the pending ceremony and not sent to the client.
    • toMap

      public Map<String,Object> toMap()
      The options as the JSON a client takes; see the class.
    • toStoredMap

      public Map<String,Object> toStoredMap()
      toMap() and, beside it, what the server alone keeps: for where a ceremony's pending state is stored.
    • fromMap

      public static PublicKeyCredentialRequestOptions fromMap(Map stored)
      The options toStoredMap() wrote, read back; null when stored is not that.