Skip to content

product: implement the stubbed jk_* internals in ffi/zig/src/main.zig (follow-up to #61) #155

Open

Description

@hyperpolymath

#61 was closed by #63, which made ffi/zig/src/main.zig match include/januskey.h. The lifecycle, transaction-state and null-guard behaviour that ffi/zig/test/integration_test.zig exercises is implemented. The cryptographic and CNO product internals are still stubs; each is marked in the source. This issue tracks those stubs. The markers now read TODO(#<this issue>) so the estate code-hygiene gate (hyperpolymath/cicd-suite code-hygiene-check, run by main-estate-audit.yml) treats them as tracked debt rather than untracked debt.

Function Marker What is missing
jk_init main.zig:186 Create the on-disk .januskey/ layout: content store, metadata log and transaction directory (mirrors crates/reversible-core JanusKey::init).
jk_open main.zig:206 Require an existing repository and load its state, instead of creating one.
jk_execute main.zig:246 Dispatch on op and run the reversible operation (copy, move, delete, modify, obliterate, key-*), recording inverse metadata through the reversible-core executor.
jk_undo main.zig:256 Pop the last logged operation and apply its stored inverse (Theorem 3.4, Sequential Reversibility).
jk_obliterate main.zig:272 DoD 5220.22-M overwrite passes and the real commitment H(content_hash ‖ nonce ‖ timestamp) (mirrors crates/januskey-cli/src/obliteration.rs).
jk_generate_key main.zig:299 Argon2id KDF plus AEAD, persist the wrapped key, return its UUID.
jk_rotate_key main.zig:316 Re-wrap content under the new key and retire the old one.
jk_revoke_key main.zig:326 Mark the key revoked in the key store and audit log.
jk_tx_commit main.zig:362 Commit the staged operations durably.
jk_tx_rollback main.zig:374 Undo the staged operations in reverse order.

Relation to the proof work: JNK-01 states reversibility through the Janus bridge as one obligation, "the FFI wrapper of a grade-𝟙 operation is grade-𝟙". The real jk_execute / jk_undo pair is what that obligation will be checked against, so it stays OPEN in PROOF-NEEDS.adoc until these land.

Done when every TODO(#…) in ffi/zig/src/main.zig is gone, each function has a test in ffi/zig/test/ that fails against the stub, and the Zig FFI job in e2e.yml is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bindingsABI, FFI, WASM, and cross-language interop surfacestech-debtKnown shortcut, drift, or hygiene owed - includes cleanup

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions