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.

codec: let open Json.Codec in cleanup across 10 more files

slack/{message,file,reminder,team,bin/login}, oci/spec/{index,intoto,
platform}, paseto, agent/todo. 8-14 usages each. slack/team and
slack/reminder records have `id` (and team also `name`); hoisted
`let id (t : t) = t.id` / `name` accessors and used `~enc:id` in
codecs. oci/spec/intoto subject record has `name`; uses `(s :
subject)` annotations on the enc lambdas. The rest are clash-free.

+10 -10
+10 -10
lib/paseto.ml
··· 381 381 382 382 (** JSON codec for claims *) 383 383 let claims_jsont = 384 - Json.Codec.Object.map ~kind:"paseto_claims" 385 - (fun iss sub aud exp nbf iat jti -> 384 + let open Json.Codec in 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 - |> Json.Codec.Object.opt_mem "iss" Json.Codec.string ~enc:(fun c -> c.iss) 388 - |> Json.Codec.Object.opt_mem "sub" Json.Codec.string ~enc:(fun c -> c.sub) 389 - |> Json.Codec.Object.opt_mem "aud" Json.Codec.string ~enc:(fun c -> c.aud) 390 - |> Json.Codec.Object.opt_mem "exp" Json.Codec.string ~enc:(fun c -> c.exp) 391 - |> Json.Codec.Object.opt_mem "nbf" Json.Codec.string ~enc:(fun c -> c.nbf) 392 - |> Json.Codec.Object.opt_mem "iat" Json.Codec.string ~enc:(fun c -> c.iat) 393 - |> Json.Codec.Object.opt_mem "jti" Json.Codec.string ~enc:(fun c -> c.jti) 394 - |> Json.Codec.Object.skip_unknown |> Json.Codec.Object.finish 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 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