PASETO tokens for OCaml - v3.local (AES-256-CTR) and v4.local (XChaCha20)
0
fork

Configure Feed

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

json: rename mem -> member / finish -> seal across the codec + value API

Object combinators: [Object.mem] -> [Object.member], [Object.opt_mem]
-> [Object.opt_member], [Object.case_mem] -> [Object.case_member]. The
sibling submodules [Object.Mem] / [Object.Mems] become
[Object.Member] / [Object.Members]. RFC 8259 §4 calls these
"name/value pairs, referred to as the members", so mirror the spec
name rather than the shortened [mem].

[Object.finish] -> [Object.seal]. "Seal" reads as "close the map, no
more members added", which is what the operation does.

Value constructors/queries: [Value.mem] (function) -> [Value.member];
[Value.mem_find] -> [Value.member_key]; [Value.mem_names] ->
[Value.member_names]; [Value.mem_keys] -> [Value.member_keys].
[type mem = ...] -> [type member = ...]; [type object'] still points
at [member list].

Downstream (~80 files across slack, sbom, stripe, sigstore, requests,
claude, irmin, freebox) updated via perl-pie. dune build clean,
dune test ocaml-json clean.

+13 -13
+3 -3
dune-project
··· 16 16 (depends 17 17 (ocaml (>= 5.1)) 18 18 (dune (>= 3.0)) 19 - (bytesrw (>= 0.1)) 20 19 (crypto (>= 1.0)) 21 20 (crypto-rng (>= 1.0)) 22 21 (digestif (>= 1.0)) ··· 25 24 (base64 (>= 3.0)) 26 25 (json (>= 0.1.0)) 27 26 (alcotest :with-test) 28 - (crowbar :with-test) 29 - (odoc :with-doc))) 27 + (alcobar :with-test) 28 + (odoc :with-doc) 29 + loc))
+8 -8
lib/paseto.ml
··· 384 384 let open Json.Codec in 385 385 Object.map ~kind:"paseto_claims" (fun iss sub aud exp nbf iat jti -> 386 386 { iss; sub; aud; exp; nbf; iat; jti; custom = [] }) 387 - |> Object.opt_mem "iss" string ~enc:(fun c -> c.iss) 388 - |> Object.opt_mem "sub" string ~enc:(fun c -> c.sub) 389 - |> Object.opt_mem "aud" string ~enc:(fun c -> c.aud) 390 - |> Object.opt_mem "exp" string ~enc:(fun c -> c.exp) 391 - |> Object.opt_mem "nbf" string ~enc:(fun c -> c.nbf) 392 - |> Object.opt_mem "iat" string ~enc:(fun c -> c.iat) 393 - |> Object.opt_mem "jti" string ~enc:(fun c -> c.jti) 394 - |> Object.skip_unknown |> Object.finish 387 + |> Object.opt_member "iss" string ~enc:(fun c -> c.iss) 388 + |> Object.opt_member "sub" string ~enc:(fun c -> c.sub) 389 + |> Object.opt_member "aud" string ~enc:(fun c -> c.aud) 390 + |> Object.opt_member "exp" string ~enc:(fun c -> c.exp) 391 + |> Object.opt_member "nbf" string ~enc:(fun c -> c.nbf) 392 + |> Object.opt_member "iat" string ~enc:(fun c -> c.iat) 393 + |> Object.opt_member "jti" string ~enc:(fun c -> c.jti) 394 + |> Object.skip_unknown |> Object.seal 395 395 396 396 let encode_claims claims = Json.to_string claims_jsont claims 397 397 let decode_claims s = Json.of_string claims_jsont s
+2 -2
paseto.opam
··· 12 12 depends: [ 13 13 "ocaml" {>= "5.1"} 14 14 "dune" {>= "3.21" & >= "3.0"} 15 - "bytesrw" {>= "0.1"} 16 15 "crypto" {>= "1.0"} 17 16 "crypto-rng" {>= "1.0"} 18 17 "digestif" {>= "1.0"} ··· 21 20 "base64" {>= "3.0"} 22 21 "json" {>= "0.1.0"} 23 22 "alcotest" {with-test} 24 - "crowbar" {with-test} 23 + "alcobar" {with-test} 25 24 "odoc" {with-doc} 25 + "loc" 26 26 ] 27 27 build: [ 28 28 ["dune" "subst"] {dev}