Starting the Library

November 18, 2023 ยท View on GitHub

In order to do anything with FIDOk, you need to initialize the library.

One you have it installed, create an instance of FIDOkLibrary:

import us.q3q.fidok.ctap.FIDOkLibrary

val library = FIDOkLibrary.init(
    cryptoProvider = PureJVMCryptoProvider(),
    authenticatorAccessors = listOf(
        BlessedBluezDeviceListing
    )
)

In order to do this you need two things:

  • A CryptoProvider instance, to provide the cryptographic operations the FIDO standard requires
  • If you want to be able to discover any Authenticators via the library, you also need at least one AuthenticatorListing instance

Both of these things depend on the platform you're on. If you don't care about having any support for things like PIN protocols, you can always use the NullCryptoProvider, but this will render the library half-functional.

Receiving Callbacks

Users can connect and disconnect Authenticators, and whether a PIN is necessary or not can depend on the circumstance. To handle these events, create an instance of FIDOkCallbacks and pass it to the library initializer.

By overriding the collectPin method, you can request a PIN from the user and return it to the library for use in CTAP protocols.

Included Crypto Providers

Runtime PlatformAvailable Crypto Provider(s)
JVMPureJVMCryptoProvider, NativeBackedCryptoProvider (which then uses BotanCryptoProvider)
LinuxBotanCryptoProvider
WindowsBotanCryptoProvider
Mac OSBotanCryptoProvider
Android (JVM)PureJVMCryptoProvider
iOSNone

Included Authenticator Accessors

Runtime PlatformAvailable Crypto Provider(s)
JVMBlessedBluezDeviceListing (Linux only)
LinuxLibHIDDevice, LibPCSCLiteDevice
WindowsLibHIDDevice, PCSCDevice
Mac OSLibHIDDevice, MacPCSCLiteDevice
Android (JVM)AndroidUSBHIDListing
iOSNone