Class StaticPasswordSlotConfiguration

java.lang.Object
com.yubico.yubikit.yubiotp.StaticPasswordSlotConfiguration
All Implemented Interfaces:
SlotConfiguration

public class StaticPasswordSlotConfiguration extends Object
Configures YubiKey to return static password on touch.
  • Field Details

    • FIXED_SIZE

      protected static final int FIXED_SIZE
      See Also:
    • UID_SIZE

      protected static final int UID_SIZE
      See Also:
    • KEY_SIZE

      protected static final int KEY_SIZE
      See Also:
    • fixed

      protected byte[] fixed
    • uid

      protected final byte[] uid
    • key

      protected final byte[] key
  • Constructor Details

    • StaticPasswordSlotConfiguration

      public StaticPasswordSlotConfiguration(byte[] scanCodes)
      Creates a Static Password configuration with default settings.
      Parameters:
      scanCodes - the password to store on YubiKey as an array of keyboard scan codes.
  • Method Details

    • getThis

      protected StaticPasswordSlotConfiguration getThis()
    • appendCr

      public StaticPasswordSlotConfiguration appendCr(boolean appendCr)
      Appends a Carriage Return (Enter key press) at the end of the output.
      Parameters:
      appendCr - if true, the output of the slot will end with a CR (default: true)
      Returns:
      the configuration for chaining
    • fastTrigger

      public StaticPasswordSlotConfiguration fastTrigger(boolean fastTrigger)
      Faster triggering when only slot 1 is configured. This option is always in effect on firmware versions 3.0 and above.
      Parameters:
      fastTrigger - if true, trigger slot 1 quicker when slot 2 is not configured (default: true)
      Returns:
      the configuration for chaining
    • pacing

      public StaticPasswordSlotConfiguration pacing(boolean pacing10Ms, boolean pacing20Ms)
      Adds a delay between each key press when sending output. This may sometimes be needed if the host system isn't able to handle the default speed at which keystrokes are sent.

      NOTE: These two flags can be combined to maximize the delay.

      Parameters:
      pacing10Ms - Adds a ~10ms delay between keystrokes (default: false)
      pacing20Ms - Adds a ~20ms delay between keystrokes (default: false)
      Returns:
      the configuration for chaining
    • useNumeric

      public StaticPasswordSlotConfiguration useNumeric(boolean useNumeric)
      Send scancodes for numeric keypad key presses when sending digits - helps with some keyboard layouts.
      Parameters:
      useNumeric - true to use the numeric keypad (default: false)
      Returns:
      the configuration for chaining
    • getFlags

      protected final byte getFlags(SlotConfiguration.FlagType type)
    • updateFlags

      protected StaticPasswordSlotConfiguration updateFlags(SlotConfiguration.Flag flag, boolean value)
    • isSupportedBy

      public boolean isSupportedBy(com.yubico.yubikit.core.Version version)
      Description copied from interface: SlotConfiguration
      Checks the configuration against a YubiKey firmware version to see if it is supported
      Specified by:
      isSupportedBy in interface SlotConfiguration
      Parameters:
      version - the firmware version to check against
      Returns:
      true if the given YubiKey version supports this configuration
    • getConfig

      public byte[] getConfig(@Nullable byte[] accCode)
      Specified by:
      getConfig in interface SlotConfiguration
    • serialApiVisible

      public StaticPasswordSlotConfiguration serialApiVisible(boolean serialApiVisible)
    • serialUsbVisible

      public StaticPasswordSlotConfiguration serialUsbVisible(boolean serialUsbVisible)
    • allowUpdate

      public StaticPasswordSlotConfiguration allowUpdate(boolean allowUpdate)
    • dormant

      public StaticPasswordSlotConfiguration dormant(boolean dormant)
      Makes the configuration dormant (hidden from use). A dormant configuration needs to be updated and the dormant bit removed to be used.
      Parameters:
      dormant - if true, the configuration cannot be used
      Returns:
      the configuration for chaining
    • invertLed

      public StaticPasswordSlotConfiguration invertLed(boolean invertLed)
      Inverts the behaviour of the led on the YubiKey.
      Parameters:
      invertLed - if true, the LED behavior is inverted
      Returns:
      the configuration for chaining
    • protectSlot2

      public StaticPasswordSlotConfiguration protectSlot2(boolean protectSlot2)
      When set for slot 1, access to modify slot 2 is blocked (even if slot 2 is empty).
      Parameters:
      protectSlot2 - If true, slot 2 cannot be modified.
      Returns:
      the configuration for chaining