Module libu2f_host

Types

U2FHostCtx* = object of RootObj
  devs: pointer
  pdevs: ptr u2fh_devs
  Source Edit
u2fh_rc* {.
pure, size: sizeof(cint)
.} = enum SIZE_ERROR = - 8, TIMEOUT_ERROR = - 7, AUTHENTICATOR_ERROR = - 6, NO_U2F_DEVICE = - 5, BASE64_ERROR = - 4, JSON_ERROR = - 3, TRANSPORT_ERROR = - 2, MEMORY_ERROR = - 1, OK = 0
  Source Edit
U2FHostError* = object of Exception
  Source Edit

Consts

lib_fn* = "libu2f-host.so.0"
  Source Edit

Procs

proc u2fh_global_init*(flags: u2fh_initflags): u2fh_rc {.
cdecl, importc: "u2fh_global_init", dynlib: lib_fn
.}
  Source Edit
proc u2fh_global_done*() {.
cdecl, importc: "u2fh_global_done", dynlib: lib_fn
.}
  Source Edit
proc u2fh_strerror*(err: u2fh_rc): cstring {.
cdecl, importc: "u2fh_strerror", dynlib: lib_fn
.}
  Source Edit
proc u2fh_strerror_name*(err: u2fh_rc): cstring {.
cdecl, importc: "u2fh_strerror_name", dynlib: lib_fn
.}
  Source Edit
proc u2fh_devs_init*(devs: ptr ptr u2fh_devs): u2fh_rc {.
cdecl, importc: "u2fh_devs_init", dynlib: lib_fn
.}
  Source Edit
proc u2fh_devs_discover*(devs: ptr u2fh_devs; max_index: ptr cuint): u2fh_rc {.
cdecl, importc: "u2fh_devs_discover", dynlib: lib_fn
.}
  Source Edit
proc u2fh_devs_done*(devs: ptr u2fh_devs) {.
cdecl, importc: "u2fh_devs_done", dynlib: lib_fn
.}
  Source Edit
proc u2fh_register*(devs: ptr u2fh_devs; challenge: cstring; origin: cstring;
                   response: cstringArray; flags: u2fh_cmdflags): u2fh_rc {.
cdecl, importc: "u2fh_register", dynlib: lib_fn
.}
  Source Edit
proc u2fh_register2*(devs: ptr u2fh_devs; challenge: cstring; origin: cstring;
                    response: cstring; response_len: ptr csize; flags: u2fh_cmdflags): u2fh_rc {.
cdecl, importc: "u2fh_register2", dynlib: lib_fn
.}
  Source Edit
proc u2fh_authenticate*(devs: ptr u2fh_devs; challenge: cstring; origin: cstring;
                       response: cstringArray; flags: u2fh_cmdflags): u2fh_rc {.
cdecl, importc: "u2fh_authenticate", dynlib: lib_fn
.}
  Source Edit
proc u2fh_authenticate2*(devs: ptr u2fh_devs; challenge: cstring; origin: cstring;
                        response: cstring; response_len: ptr csize;
                        flags: u2fh_cmdflags): u2fh_rc {.
cdecl, importc: "u2fh_authenticate2", dynlib: lib_fn
.}
  Source Edit
proc u2fh_sendrecv*(devs: ptr u2fh_devs; index: cuint; cmd: uint8; send: ptr cuchar;
                   sendlen: uint16; recv: ptr cuchar; recvlen: ptr csize): u2fh_rc {.
cdecl, importc: "u2fh_sendrecv", dynlib: lib_fn
.}
  Source Edit
proc u2fh_get_device_description*(devs: ptr u2fh_devs; index: cuint; `out`: cstring;
                                 len: ptr csize): u2fh_rc {.
cdecl, importc: "u2fh_get_device_description", dynlib: lib_fn
.}
  Source Edit
proc u2fh_is_alive*(devs: ptr u2fh_devs; index: cuint): cint {.
cdecl, importc: "u2fh_is_alive", dynlib: lib_fn
.}
  Source Edit
proc newU2FHostCtx*(): U2FHostCtx
Initialize U2F host context   Source Edit
proc register*(ctx: U2FHostCtx; challenge, origin: string): string
Register token   Source Edit
proc authenticate*(ctx: U2FHostCtx; challenge, origin: string): string
Authenticate   Source Edit
proc done*(ctx: U2FHostCtx)
U2F host context destructor   Source Edit