My own corner of monopam
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-sigstore: defer README example via let run () and pattern Result

[Eio_main.run] at top level executed under mdx; [Sigstore.sign]
returns [(bundle, error) result] but the example used the bundle as
a bare value. Wrap as [run () = ...], [match] both [sign] and
[verify], switch [Format.printf]/[Format.eprintf] to [Fmt.pr]/[Fmt.epr],
and add [eio.core] / [eio.unix] / [requests] / [ptime] / [fmt] mdx
libraries.

+17 -15
+16 -14
ocaml-sigstore/README.md
··· 28 28 ## Quick Start 29 29 30 30 ```ocaml 31 - Eio_main.run @@ fun env -> 32 - Eio.Switch.run @@ fun sw -> 33 - let session = Requests.v ~sw env 34 - let now = Eio.Time.now env#clock |> Ptime.of_float_s |> Option.get 35 - (* Sign an artifact *) 36 - let bundle = 37 - Sigstore.sign session ~now ~id_token:"eyJ..." 38 - ~artifact:(Sigstore.Artifact.of_string "hello world") 39 - in 40 - 41 - (* Verify *) 42 - match Sigstore.verify session ~now bundle with 43 - | Ok identity -> Format.printf "Signed by %s\n" identity.email 44 - | Error e -> Format.eprintf "Verification failed: %a\n" Sigstore.pp_error e 31 + let run () = 32 + Eio_main.run @@ fun env -> 33 + Eio.Switch.run @@ fun sw -> 34 + let session = Requests.v ~sw env in 35 + let now = Eio.Time.now env#clock |> Ptime.of_float_s |> Option.get in 36 + (* Sign an artifact. *) 37 + match 38 + Sigstore.sign session ~now ~id_token:"eyJ..." 39 + ~artifact:(Sigstore.Artifact.of_string "hello world") 40 + with 41 + | Error e -> Fmt.epr "Sign failed: %a@." Sigstore.pp_error e 42 + | Ok bundle -> ( 43 + (* Verify. *) 44 + match Sigstore.verify session ~now bundle with 45 + | Ok identity -> Fmt.pr "Signed by %s@." identity.email 46 + | Error e -> Fmt.epr "Verification failed: %a@." Sigstore.pp_error e) 45 47 ``` 46 48 47 49 ## API Overview
+1 -1
ocaml-sigstore/dune
··· 4 4 5 5 (mdx 6 6 (files README.md) 7 - (libraries sigstore eio_main)) 7 + (libraries sigstore eio_main eio eio.core eio.unix requests ptime fmt))