HomeKit Accessory Protocol (HAP) for OCaml
0
fork

Configure Feed

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

WIP: sprawling dune build fixes across packages

Fixes for:
- Xml.Value.element -> Xml.Value.t (xtce).
- Xml.Error.t to_string wrap (xtce.of_string).
- Json.to_string now plain; drop result patterns across sbom, runc, cdm,
freebox, gauth, gdocs, hap, sigstore, space, meross, stix.
- Loc.Error.t is a record now; read e.meta directly (rego, sbom).
- 'Err' submodule renamed to 'Error' in claude; update refs + test.ml suite list.
- Yaml_jsont -> Yaml_json (space-dtn, space).
- Move sw from Monitor.S.create to Monitor.S.start.
- Drop unused sw, bundle fields from Runc.Command records.
- Drop orphan Compact.rebuild in scitt.Vds; drop 'mutable' from levels (field
content is mutated via array write, not field reassignment).
- Claude Code test: Alcotest.fail e where e is Json.Error.t -> wrap with
Json.Error.to_string.
- toml.jsont dune refs had broken '... loc))' merger in many test/bin dunes.

Toml.ml/Codec.ml and ocaml-http/lib/Xtce.ml xtce have pending mli
mismatches from concurrent linter reshape.

+8 -14
+8 -14
lib/hap.ml
··· 208 208 paired : bool; 209 209 } 210 210 211 - (* HAP session state *) 211 + (* HAP session state. Carries only what the encrypted transport needs — 212 + the long-term [pairing] keys used to derive the per-session keys live 213 + with the caller, not in the session. *) 212 214 type session = { 213 - pairing : pairing; 214 215 ip : string; 215 216 port : int; 216 217 encrypt_key : string; ··· 424 425 |> encode) 425 426 426 427 (* Derive session keys from shared secret *) 427 - let derive_session_keys ~pairing ~ip ~port ~shared = 428 + let derive_session_keys ~ip ~port ~shared = 428 429 let enc_key = 429 430 hkdf_sha512 ~salt:"Control-Salt" ~ikm:shared 430 431 ~info:"Control-Write-Encryption-Key" ~length:32 ··· 436 437 Log.info (fun f -> f "Pair verify successful, session established"); 437 438 Ok 438 439 { 439 - pairing; 440 440 ip; 441 441 port; 442 442 encrypt_key = enc_key; ··· 456 456 let m4 = Tlv.decode m4_body in 457 457 match Tlv.get Tlv_type.error m4 with 458 458 | Some e -> err_pair_verify_m4 e 459 - | None -> derive_session_keys ~pairing ~ip ~port ~shared 459 + | None -> derive_session_keys ~ip ~port ~shared 460 460 461 461 (* Verify M2 response: decrypt, check identity and signature *) 462 462 let verify_m2 ~pairing ~kp ~enc_key ~enc_data ~accessory_pk = ··· 677 677 (* Save/load pairing to file *) 678 678 let save_pairing ~fs ~path (pairing : pairing) = 679 679 let stored = Pairing_json.of_pairing pairing in 680 - match Json.to_string ~format:Json.Indent Pairing_json.stored stored with 681 - | Ok json -> 682 - Eio.Path.save ~create:(`Or_truncate 0o600) Eio.Path.(fs / path) json 683 - | Error _ -> () 680 + let json = Json.to_string ~format:Json.Indent Pairing_json.stored stored in 681 + Eio.Path.save ~create:(`Or_truncate 0o600) Eio.Path.(fs / path) json 684 682 685 683 let load_pairing ~fs ~path = 686 684 let full_path = Eio.Path.(fs / path) in ··· 931 929 end 932 930 933 931 (* Decode Json.t via codec *) 934 - let decode codec json = 935 - match Json.Value.to_string json with 936 - | Error e -> Error e 937 - | Ok str -> ( 938 - match Json.of_string codec str with Ok v -> Ok v | Error e -> Error e) 932 + let decode codec json = Json.of_string codec (Json.Value.to_string json) 939 933 940 934 (* Find the On characteristic IID from accessories JSON *) 941 935 let on_characteristic_iid json =