quickfix fpath in secmod
This commit is contained in:
parent
2361fa13e1
commit
e8d7b413ad
3 changed files with 29 additions and 7 deletions
|
|
@ -80,21 +80,25 @@ let key_fpath k =
|
|||
|
||||
let read_eddsa fs fpath =
|
||||
Log.debug (fun m -> m "reading key file `%a`" Fpath.pp fpath);
|
||||
let fpath = Fpath.to_string fpath in
|
||||
let* data = Fat.read fs fpath |> unwrap_msg in
|
||||
EddsaPrivateKey.of_octets data
|
||||
|
||||
let read_rsa fs fpath =
|
||||
Log.debug (fun m -> m "reading key file `%a`" Fpath.pp fpath);
|
||||
let fpath = Fpath.to_string fpath in
|
||||
let* data = Fat.read fs fpath |> unwrap_msg in
|
||||
RsaPrivateKey.of_octets data
|
||||
|
||||
let write_eddsa fs fpath priv =
|
||||
Log.debug (fun m -> m "writing key file `%a`" Fpath.pp fpath);
|
||||
let data = EddsaPrivateKey.to_octets priv in
|
||||
let fpath = Fpath.to_string fpath in
|
||||
Fat.write fs fpath data |> unwrap_msg
|
||||
|
||||
let write_rsa fs fpath priv =
|
||||
let data = RsaPrivateKey.to_octets priv in
|
||||
let fpath = Fpath.to_string fpath in
|
||||
Fat.write fs fpath data |> unwrap_msg
|
||||
|
||||
let write_key fs k = write_rsa fs (key_fpath k) k.priv
|
||||
|
|
@ -109,14 +113,19 @@ let delete_file fs fpath =
|
|||
Fpath.pp fpath
|
||||
in
|
||||
Log.debug (fun m -> m "delete key file `%a`" Fpath.pp fpath);
|
||||
let fpath = Fpath.to_string fpath in
|
||||
let+ () = Fat.remove fs fpath |> unwrap_msg in
|
||||
()
|
||||
|
||||
let get_key_dir_contents fs dir_fpath =
|
||||
let* b = Fat.mkdir fs dir_fpath |> unwrap_msg in
|
||||
if b then Log.info (fun m -> m "created directory `%a`" Fpath.pp dir_fpath);
|
||||
let dir_fpath = Fpath.to_string dir_fpath in
|
||||
let* () = Fat.mkdir fs dir_fpath |> unwrap_msg in
|
||||
Log.info (fun m -> m "created directory `%s`" dir_fpath);
|
||||
let+ l = Fat.ls fs dir_fpath |> unwrap_msg in
|
||||
List.map Fpath.normalize l
|
||||
(* List.map Fpath.normalize l *)
|
||||
let l = List.map (fun entry -> entry.Fat.name) l in
|
||||
let l = List.map Fpath.v l in
|
||||
l
|
||||
|
||||
(* -- *)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue