Interface ClientDataProvider


public interface ClientDataProvider
Provides access to WebAuthn clientDataJSON (raw bytes) or only its SHA-256 hash.

If a ClientDataProvider is constructed with only the hash, getClientDataJson() returns an empty array and hasClientDataJson() returns false.

  • Method Summary

    Modifier and Type
    Method
    Description
    fromClientDataJson(byte[] clientDataJson)
    Creates a ClientDataProvider from the provided clientDataJSON byte array.
    fromHash(byte[] hash)
    Creates a ClientDataProvider from an existing SHA-256 hash.
    byte[]
    Returns the raw clientDataJSON bytes, if available.
    byte[]
    Returns the SHA-256 hash (32 bytes) of clientDataJSON.
    boolean
    Indicates whether raw clientDataJSON bytes are present.
  • Method Details

    • getHash

      byte[] getHash()
      Returns the SHA-256 hash (32 bytes) of clientDataJSON.
      Returns:
      SHA-256 hash of clientDataJSON
    • getClientDataJson

      byte[] getClientDataJson()
      Returns the raw clientDataJSON bytes, if available. If only the hash is provided, returns an empty array.
      Returns:
      raw clientDataJSON bytes, or empty array if unavailable
    • hasClientDataJson

      boolean hasClientDataJson()
      Indicates whether raw clientDataJSON bytes are present.
      Returns:
      true if raw clientDataJSON is present, false otherwise
    • fromClientDataJson

      static ClientDataProvider fromClientDataJson(byte[] clientDataJson)
      Creates a ClientDataProvider from the provided clientDataJSON byte array.
      Parameters:
      clientDataJson - raw clientDataJSON byte array
      Returns:
      new ClientDataProvider instance
    • fromHash

      static ClientDataProvider fromHash(byte[] hash)
      Creates a ClientDataProvider from an existing SHA-256 hash. The raw clientDataJSON bytes are not available.
      Parameters:
      hash - SHA-256 hash (32 bytes) of clientDataJSON
      Returns:
      new ClientDataProvider instance