| Top |
| u2fh_rc | u2fh_global_init () |
| void | u2fh_global_done () |
| const char * | u2fh_strerror () |
| const char * | u2fh_strerror_name () |
| u2fh_rc | u2fh_devs_init () |
| u2fh_rc | u2fh_devs_discover () |
| void | u2fh_devs_done () |
| u2fh_rc | u2fh_register () |
| u2fh_rc | u2fh_authenticate () |
| u2fh_rc | u2fh_sendrecv () |
| u2fh_rc | u2fh_get_device_description () |
| int | u2fh_is_alive () |
u2fh_rc
u2fh_global_init (u2fh_initflags flags);
Initialize the library. This function is not guaranteed to be thread safe and must be invoked on application startup.
void
u2fh_global_done (void);
Release all resources from the library. Call this function when no further use of the library is needed.
const char *
u2fh_strerror (int err);
Convert return code to human readable string explanation of the reason for the particular error code.
This string can be used to output a diagnostic message to the user.
This function is one of few in the library that can be used without
a successful call to u2fh_global_init().
const char *
u2fh_strerror_name (int err);
Convert return code to human readable string representing the error
code symbol itself. For example, u2fh_strerror_name(U2FH_OK)
returns the string "U2FH_OK".
This string can be used to output a diagnostic message to the user.
This function is one of few in the library that can be used without
a successful call to u2fh_global_init().
u2fh_rc
u2fh_devs_init (u2fh_devs **devs);
Initialize device handle.
On success U2FH_OK (integer 0) is returned, on memory
allocation errors U2FH_MEMORY_ERROR is returned, or another
u2fh_rc error code is returned.
u2fh_rc u2fh_devs_discover (u2fh_devs *devs,unsigned *max_index);
Discover and open new devices. This function can safely be called several times and will free resources associated with unplugged devices and open new.
devs |
device handle, from |
|
max_index |
will on return be set to the maximum index, may be NULL; if there is 1 device this will be 0, if there are 2 devices this will be 1, and so on. |
On success, U2FH_OK (integer 0) is returned, when no U2F
device could be found U2FH_NO_U2F_DEVICE is returned, or another
u2fh_rc error code.
void
u2fh_devs_done (u2fh_devs *devs);
Release all resources associated with devs
. This function must be
called when you are finished with a device handle.
u2fh_rc u2fh_register (u2fh_devs *devs,const char *challenge,const char *origin,char **response,u2fh_cmdflags flags);
Perform the U2F Register operation.
devs |
a device set handle, from |
|
challenge |
string with JSON data containing the challenge. |
|
origin |
U2F origin URL. |
|
response |
pointer to output string with JSON data. |
|
flags |
set of ORed u2fh_cmdflags values. |
u2fh_rc u2fh_authenticate (u2fh_devs *devs,const char *challenge,const char *origin,char **response,u2fh_cmdflags flags);
Perform the U2F Authenticate operation.
devs |
a device handle, from |
|
challenge |
string with JSON data containing the challenge. |
|
origin |
U2F origin URL. |
|
response |
pointer to output string with JSON data. |
|
flags |
set of ORed u2fh_cmdflags values. |
u2fh_rc u2fh_sendrecv (u2fh_devs *devs,unsigned index,uint8_t cmd,const unsigned char *send,uint16_t sendlen,unsigned char *recv,size_t *recvlen);
Send a command with data to the device at index
.
devs |
device handle, from |
|
index |
index of device |
|
cmd |
command to run |
|
send |
buffer of data to send |
|
sendlen |
length of data to send |
|
recv |
buffer of data to receive |
|
recvlen |
length of data to receive |
u2fh_rc u2fh_get_device_description (u2fh_devs *devs,unsigned index,char *out,size_t *len);
Get the device description of the device at index
. Stores the
string in out
.
devs |
device_handle, from |
|
index |
index of device |
|
out |
buffer for storing device description |
|
len |
maximum amount of data to store in |
int u2fh_is_alive (u2fh_devs *devs,unsigned index);
Get the liveliness of the device index
.