Class StoredPasskey

java.lang.Object
com.iizix.server.user.passkey.StoredPasskey

public final class StoredPasskey extends Object
A passkey as the server stores it: one row of IZS.USER_CREDENTIALS (CC-LOGIN-L8-PASSKEYS). Nothing in it is a secret; the public key verifies, it does not sign.
Author:
Christopher Mindus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final String
    The AAGUID of the authenticator in its text form.
    final int
    The COSE algorithm of the public key.
    final String
    The attestation statement format at registration.
    final boolean
    The backup flags: eligible (fixed at registration) and state (as last seen).
    final boolean
    The backup flags: eligible (fixed at registration) and state (as last seen).
    final long
    The registration time and the time of the last use (zero for never), epoch milliseconds.
    final String
    The key of the row: the SHA-256 hash of the credential ID, base64url.
    final long
    The registration time and the time of the last use (zero for never), epoch milliseconds.
    final String
    The name the user gave the passkey.
    final boolean
    Flag for a passkey that was registered through an account recovery (CC-LOGIN-PASSKEY-SECOND-FACTOR, T1-039): for 24 hours from created it is no proof of a second factor (PasskeyService.waitsAfterRecovery).
    final String
    The relying party ID the passkey is scoped to.
    final long
    The signature counter last seen.
    final String
    The transports reported at registration, comma separated.
    final long
    The user ID of the owner.
  • Constructor Summary

    Constructors
    Constructor
    Description
    StoredPasskey(byte[] credentialId, long userID, String rpId, int algorithm, byte[] publicKey, long signCount, String aaguid, String transports, boolean backupEligible, boolean backedUp, String attestationFormat, long created, long lastUsed, String nickname)
    Creates a passkey that was not registered through an account recovery.
    StoredPasskey(byte[] credentialId, long userID, String rpId, int algorithm, byte[] publicKey, long signCount, String aaguid, String transports, boolean backupEligible, boolean backedUp, String attestationFormat, long created, long lastUsed, String nickname, boolean recovery)
    Creates a passkey.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Gets the credential ID.
    byte[]
    Gets the public key in COSE form.
    static String
    keyOf(byte[] credentialId)
    Gets the key of a credential ID: its SHA-256 hash, base64url without padding.
    Gets the passkey as the SignIn module shows it.
  • Field Details

    • key

      public final String key
      The key of the row: the SHA-256 hash of the credential ID, base64url. It is the identifier of the passkey on this server (PasskeyInfo.id).
    • userID

      public final long userID
      The user ID of the owner.
    • rpId

      public final String rpId
      The relying party ID the passkey is scoped to.
    • algorithm

      public final int algorithm
      The COSE algorithm of the public key.
    • signCount

      public final long signCount
      The signature counter last seen.
    • aaguid

      public final String aaguid
      The AAGUID of the authenticator in its text form.
    • transports

      public final String transports
      The transports reported at registration, comma separated.
    • backupEligible

      public final boolean backupEligible
      The backup flags: eligible (fixed at registration) and state (as last seen).
    • backedUp

      public final boolean backedUp
      The backup flags: eligible (fixed at registration) and state (as last seen).
    • attestationFormat

      public final String attestationFormat
      The attestation statement format at registration.
    • created

      public final long created
      The registration time and the time of the last use (zero for never), epoch milliseconds.
    • lastUsed

      public final long lastUsed
      The registration time and the time of the last use (zero for never), epoch milliseconds.
    • nickname

      public final String nickname
      The name the user gave the passkey.
    • recovery

      public final boolean recovery
      Flag for a passkey that was registered through an account recovery (CC-LOGIN-PASSKEY-SECOND-FACTOR, T1-039): for 24 hours from created it is no proof of a second factor (PasskeyService.waitsAfterRecovery).
  • Constructor Details

    • StoredPasskey

      public StoredPasskey(byte[] credentialId, long userID, String rpId, int algorithm, byte[] publicKey, long signCount, String aaguid, String transports, boolean backupEligible, boolean backedUp, String attestationFormat, long created, long lastUsed, String nickname)
      Creates a passkey that was not registered through an account recovery.
      Parameters:
      credentialId - The credential ID, 1 to 1023 bytes.
      userID - The user ID of the owner.
      rpId - The relying party ID.
      algorithm - The COSE algorithm of the public key.
      publicKey - The public key in COSE form.
      signCount - The signature counter.
      aaguid - The AAGUID in its text form.
      transports - The transports, comma separated.
      backupEligible - Flag for a passkey that may be synchronized.
      backedUp - Flag for a passkey that is synchronized.
      attestationFormat - The attestation statement format.
      created - The registration time, epoch milliseconds.
      lastUsed - The time of the last use, epoch milliseconds, zero for never.
      nickname - The name the user gave the passkey.
      Throws:
      NullPointerException - If a parameter is null.
      IllegalArgumentException - If the credential ID is empty or longer than 1023 bytes.
    • StoredPasskey

      public StoredPasskey(byte[] credentialId, long userID, String rpId, int algorithm, byte[] publicKey, long signCount, String aaguid, String transports, boolean backupEligible, boolean backedUp, String attestationFormat, long created, long lastUsed, String nickname, boolean recovery)
      Creates a passkey.
      Parameters:
      credentialId - The credential ID, 1 to 1023 bytes.
      userID - The user ID of the owner.
      rpId - The relying party ID.
      algorithm - The COSE algorithm of the public key.
      publicKey - The public key in COSE form.
      signCount - The signature counter.
      aaguid - The AAGUID in its text form.
      transports - The transports, comma separated.
      backupEligible - Flag for a passkey that may be synchronized.
      backedUp - Flag for a passkey that is synchronized.
      attestationFormat - The attestation statement format.
      created - The registration time, epoch milliseconds.
      lastUsed - The time of the last use, epoch milliseconds, zero for never.
      nickname - The name the user gave the passkey.
      recovery - Flag for a passkey that was registered through an account recovery.
      Throws:
      NullPointerException - If a parameter is null.
      IllegalArgumentException - If the credential ID is empty or longer than 1023 bytes.
  • Method Details

    • keyOf

      public static String keyOf(byte[] credentialId)
      Gets the key of a credential ID: its SHA-256 hash, base64url without padding.
      Parameters:
      credentialId - The credential ID.
      Returns:
      The 43 characters.
      Throws:
      NullPointerException - If credentialId is null.
    • getCredentialId

      public byte[] getCredentialId()
      Gets the credential ID.
      Returns:
      A copy of the bytes.
    • getPublicKey

      public byte[] getPublicKey()
      Gets the public key in COSE form.
      Returns:
      A copy of the bytes.
    • toInfo

      public PasskeyInfo toInfo()
      Gets the passkey as the SignIn module shows it.
      Returns:
      The passkey information, without key material.