nx_twin_key.nx
buildroot/runtime/nx_twin_key.nx
about
nx_twin_key.nx -- two-party authorized bypass (Captain Moroni).
Per [[feedback-captain-moroni-doctrine]]: "Twin-key authorized for
any operation that could harm... family-controlled override
mechanism: when genuine self-defense requires non-default capability,
the family (twin-key holders) can authorize a TIME-LIMITED bypass.
All bypass events logged in books. Audit trail accessible to
family."
THE FAMILY OVERRIDE PRIMITIVE. Some operations (e.g., SANCTUARY-
mode emergency cellular activation, drone deployment in extremis,
temporary capability grant beyond cell's default brane) require
TWO party signatures from designated key-holders. Time-limited.
Loud journaling. Captain Moroni's discipline of legitimate
self-defense.
Composes:
nx_intent -- twin-key authorizes Defensive intent in restricted contexts
nx_brane -- post-twin-key grant becomes a time-limited capability
nx_transponder_quiescence -- SANCTUARY emergency authorize_emergency
is the consumer
nx_drone_doctrine -- twin-key required for real-world flight (V2)
nx_evict_journal -- every twin-key event logged loudly
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_substrate_closure_compose_test.nxnx_twin_key_test.nx
structs
| 58 | struct NxTwinKeyRequest |
| 70 | struct NxTwinKeyLedger |
consts
| 28 | const NX_TK_OK: nx_int = 0 |
| 29 | const NX_TK_ERR_FULL: nx_int = 1 |
| 30 | const NX_TK_ERR_BAD_HOLDERS: nx_int = 2 // same key-holder cannot self-sign |
| 31 | const NX_TK_ERR_NOT_PENDING: nx_int = 3 |
| 32 | const NX_TK_ERR_EXPIRED: nx_int = 4 |
| 33 | const NX_TK_ERR_BAD_PURPOSE: nx_int = 5 |
| 34 | const NX_TK_ERR_NOT_FOUND: nx_int = 6 |
| 35 | const NX_TK_GRANTED: nx_int = 7 |
| 39 | const NX_TKP_EMERGENCY_CELLULAR: nx_int = 0 |
| 40 | const NX_TKP_DRONE_DEPLOYMENT: nx_int = 1 |
| 41 | const NX_TKP_SANCTUARY_TEMP_OPEN: nx_int = 2 |
| 42 | const NX_TKP_CAP_GRANT_OVERRIDE: nx_int = 3 |
| 43 | const NX_TKP_FIRMWARE_UPDATE: nx_int = 4 |
| 44 | const NX_TKP_FAMILY_DATA_MIGRATION: nx_int = 5 |
| 45 | const NX_TKP_N_PURPOSES: nx_int = 6 |
| 49 | const NX_TKS_PROPOSED: nx_int = 0 |
| 50 | const NX_TKS_PARTIAL: nx_int = 1 // one signature received |
| 51 | const NX_TKS_AUTHORIZED: nx_int = 2 // both signatures received |
| 52 | const NX_TKS_EXPIRED: nx_int = 3 |
| 53 | const NX_TKS_REVOKED: nx_int = 4 |
| 54 | const NX_TKS_N_STATES: nx_int = 5 |
| 76 | const NX_TK_REQ_BYTES: nx_size = 72 |
functions
| 78 | func nx_tkp_is_valid(p: nx_int) -> nx_int |
| 84 | func nx_tks_is_valid(s: nx_int) -> nx_int |
| 90 | func nx_twin_key_ledger_new(capacity: nx_size) -> *NxTwinKeyLedger |
| 99 | func _tk_at(l: *NxTwinKeyLedger, idx: nx_size) -> *NxTwinKeyRequest |
| 103 | func _tk_find(l: *NxTwinKeyLedger, request_id: nx_int) -> nx_int |
| 115 | func nx_twin_key_propose(l: *NxTwinKeyLedger, |
| 144 | func nx_twin_key_sign(l: *NxTwinKeyLedger, |
| 183 | func nx_twin_key_check(l: *NxTwinKeyLedger, |
| 199 | func nx_twin_key_revoke(l: *NxTwinKeyLedger, request_id: nx_int) -> nx_int |
| 207 | func nx_twin_key_count(l: *NxTwinKeyLedger) -> nx_size |
| 211 | func nx_twin_key_count_by_state(l: *NxTwinKeyLedger, state: nx_int) -> nx_int |