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 TypeMethodDescriptionstatic ClientDataProviderfromClientDataJson(byte[] clientDataJson) Creates aClientDataProviderfrom the providedclientDataJSONbyte array.static ClientDataProviderfromHash(byte[] hash) Creates aClientDataProviderfrom an existing SHA-256 hash.byte[]Returns the rawclientDataJSONbytes, if available.byte[]getHash()Returns the SHA-256 hash (32 bytes) ofclientDataJSON.booleanIndicates whether rawclientDataJSONbytes are present.
-
Method Details
-
getHash
byte[] getHash()Returns the SHA-256 hash (32 bytes) ofclientDataJSON.- Returns:
- SHA-256 hash of
clientDataJSON
-
getClientDataJson
byte[] getClientDataJson()Returns the rawclientDataJSONbytes, if available. If only the hash is provided, returns an empty array.- Returns:
- raw
clientDataJSONbytes, or empty array if unavailable
-
hasClientDataJson
boolean hasClientDataJson()Indicates whether rawclientDataJSONbytes are present.- Returns:
- true if raw
clientDataJSONis present, false otherwise
-
fromClientDataJson
Creates aClientDataProviderfrom the providedclientDataJSONbyte array.- Parameters:
clientDataJson- rawclientDataJSONbyte array- Returns:
- new
ClientDataProviderinstance
-
fromHash
Creates aClientDataProviderfrom an existing SHA-256 hash. The rawclientDataJSONbytes are not available.- Parameters:
hash- SHA-256 hash (32 bytes) ofclientDataJSON- Returns:
- new
ClientDataProviderinstance
-