package pkcs11

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file p11_slot_info.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
type t =
  { slotDescription : string
  ; manufacturerID : string
  ; flags : P11_flags.t
  ; hardwareVersion : P11_version.t
  ; firmwareVersion : P11_version.t
  }
[@@deriving of_yojson]

let flags_to_string = P11_flags.(to_pretty_string Slot_info_domain)

let to_strings info =
  [ "Slot Description", P11_helpers.trim_and_quote info.slotDescription
  ; "Manufacturer ID", P11_helpers.trim_and_quote info.manufacturerID
  ; "Flags", flags_to_string info.flags
  ; "Firmware Version", P11_version.to_string info.firmwareVersion
  ; "Hardware Version", P11_version.to_string info.hardwareVersion
  ]

let to_string ?newlines ?indent info =
  P11_helpers.string_of_record ?newlines ?indent (to_strings info)

let to_strings info = P11_helpers.strings_of_record @@ to_strings info

let to_yojson info =
  `Assoc
    [ "slotDescription", `String info.slotDescription
    ; "manufacturerID", `String info.manufacturerID
    ; "flags", P11_flags.to_json ~pretty:flags_to_string info.flags
    ; "hardwareVersion", P11_version.to_yojson info.hardwareVersion
    ; "firmwareVersion", P11_version.to_yojson info.firmwareVersion
    ]