package ledgerwallet

  1. Overview
  2. Docs
type t
type transport_error
type error =
  1. | AppError of {
    1. status : Status.t;
    2. msg : string;
    }
  2. | TransportError of transport_error
type proxy_path
type path =
  1. | Hidapi_path of Hidapi.device_info
  2. | Proxy_path of proxy_path
val enumerate : unit -> path list Lwt.t
val app_error : msg:string -> ('a, Status.t) result -> ('a, error) result
val pp_error : Format.formatter -> error -> unit
val open_id : vendor_id:int -> product_id:int -> t option Lwt.t
val open_path : path -> t option Lwt.t
val close : t -> unit Lwt.t
val with_connection_id : vendor_id:int -> product_id:int -> (t -> 'a Lwt.t) -> 'a option Lwt.t
val with_connection_path : path -> (t -> 'a Lwt.t) -> 'a option Lwt.t
val write_apdu : ?pp:Format.formatter -> ?buf:Cstruct.t -> t -> Apdu.t -> (unit, error) result Lwt.t

write_apdu ?pp ?buf ledger apdu writes apdu to ledger.

val read : ?pp:Format.formatter -> ?buf:Cstruct.t -> t -> (Status.t * Cstruct.t, error) result Lwt.t

read ?pp ?buf ledger reads from ledger a status response and a payload.

val ping : ?pp:Format.formatter -> ?buf:Cstruct.t -> t -> (unit, error) result Lwt.t

ping ?pp ?buf ledger writes a ping packet to ledger, optionally containing buf.

val apdu : ?pp:Format.formatter -> ?msg:string -> ?buf:Cstruct.t -> t -> Apdu.t -> (Cstruct.t, error) result Lwt.t

apdu ?pp ?msg ?buf ledger apdu writes apdu to ledger and returns the response.

val write_payload : ?pp:Format.formatter -> ?msg:string -> ?buf:Cstruct.t -> ?mark_last:bool -> cmd:Apdu.cmd -> ?p1:int -> ?p2:int -> t -> Cstruct.t -> (Cstruct.t, error) result Lwt.t

write_payload ?pp ?msg ?buf ?mark_last ~cmd ?p1 ?p2 ledger payload writes the payload of cmd into ledger and returns the response.

OCaml

Innovation. Community. Security.