Class AuthenticatorDataConverter

java.lang.Object
com.webauthn4j.converter.AuthenticatorDataConverter

public class AuthenticatorDataConverter extends Object
Converter for AuthenticatorData This class provides functionality to convert between AuthenticatorData objects and their binary representation for WebAuthn processing.
  • Constructor Details

    • AuthenticatorDataConverter

      public AuthenticatorDataConverter(@NotNull @NotNull ObjectConverter objectConverter)
      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 a AuthenticatorData to 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 fails
      UncheckedIOException - 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 to AuthenticatorData.
      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