Module Ledgerwallet.Apdu

type cmd =
| Apdu_command : {
cmd : 'a;
cla_of_cmd : 'a -> int;
ins_of_cmd : 'a -> int;
} -> cmd

Arbitrary type of a command, with its converters.

val create_cmd : cmd:'a -> cla_of_cmd:('a -> int) -> ins_of_cmd:('a -> int) -> cmd
type t = {
cmd : cmd;
p1 : int;
p2 : int;
lc : int;
le : int;
data : Cstruct.t;
}

Type of an ADPU.

val max_data_length : int

max_data_length is the maximum data length of an APDU.

val create : ?⁠p1:int -> ?⁠p2:int -> ?⁠lc:int -> ?⁠le:int -> ?⁠data:Cstruct.t -> cmd -> t
val create_string : ?⁠p1:int -> ?⁠p2:int -> ?⁠lc:int -> ?⁠le:int -> ?⁠data:string -> cmd -> t
val length : t -> int

length t is the size of t in bytes.

val write : Cstruct.t -> t -> Cstruct.t

write cs t writes t at cs and returns cs shifted by length t bytes.