java.lang.Object
com.webauthn4j.converter.AuthenticatorDataConverter
Converter for
AuthenticatorData
This class provides functionality to convert between AuthenticatorData objects and their binary representation
for WebAuthn processing.-
Constructor Summary
ConstructorsConstructorDescriptionAuthenticatorDataConverter(@NotNull ObjectConverter objectConverter) Creates a new AuthenticatorDataConverter instance. -
Method Summary
Modifier and TypeMethodDescription<T extends ExtensionAuthenticatorOutput>
@NotNull AuthenticatorData<T>convert(@org.jetbrains.annotations.NotNull byte[] source) Converts from a byte array toAuthenticatorData.<T extends ExtensionAuthenticatorOutput>
@org.jetbrains.annotations.NotNull byte[]convert(@NotNull AuthenticatorData<T> source) Converts from aAuthenticatorDatato byte[].@org.jetbrains.annotations.NotNull byte[]extractAttestedCredentialData(@org.jetbrains.annotations.NotNull byte[] authenticatorData) Extract attestedCredentialData byte array from an authenticatorData byte array.longextractSignCount(@org.jetbrains.annotations.NotNull byte[] authenticatorData) Extract signCount from an authenticatorData byte array.
-
Constructor Details
-
AuthenticatorDataConverter
Creates a new AuthenticatorDataConverter instance.- Parameters:
objectConverter- converter for data serialization- Throws:
IllegalArgumentException- if objectConverter is null
-
-
Method Details
-
convert
@NotNull public <T extends ExtensionAuthenticatorOutput> @org.jetbrains.annotations.NotNull byte[] convert(@NotNull @NotNull AuthenticatorData<T> source) Converts from aAuthenticatorDatato byte[].- Type Parameters:
T- the type of extension authenticator output- Parameters:
source- the source object to convert- Returns:
- the converted byte array
- Throws:
DataConversionException- if conversion failsUncheckedIOException- if an I/O error occurs
-
convert
@NotNull public <T extends ExtensionAuthenticatorOutput> @NotNull AuthenticatorData<T> convert(@NotNull @org.jetbrains.annotations.NotNull byte[] source) Converts from a byte array toAuthenticatorData.- Type Parameters:
T- the type of extension authenticator output- Parameters:
source- the source byte array to convert- Returns:
- the converted object
- Throws:
DataConversionException- if conversion fails
-
extractAttestedCredentialData
@NotNull public @org.jetbrains.annotations.NotNull byte[] extractAttestedCredentialData(@NotNull @org.jetbrains.annotations.NotNull byte[] authenticatorData) Extract attestedCredentialData byte array from an authenticatorData byte array.- Parameters:
authenticatorData- the authenticatorData byte array- Returns:
- the extracted attestedCredentialData byte array
- Throws:
IllegalArgumentException- if the input format is invalid
-
extractSignCount
public long extractSignCount(@NotNull @org.jetbrains.annotations.NotNull byte[] authenticatorData) Extract signCount from an authenticatorData byte array.- Parameters:
authenticatorData- the authenticatorData byte array- Returns:
- the extracted signCount
-