#[allow(unused_imports)]
use crate::prelude::*;
use base64::{engine::general_purpose::STANDARD, Engine};
use serde_json::Value;
use zeroize::Zeroizing;
use crate::error::{CoreError, Result};
use crate::robotics_json as rj;
pub const MAX_REQUEST_BYTES: usize = rj::MAX_INPUT_BYTES + 64 * 1024;
pub const LONG_REQUEST_ROOM: usize = rj::MAX_INPUT_BYTES;
pub const MAX_LONG_REQUEST_BYTES: usize = crate::robotics::MAX_LOG_BYTES + LONG_REQUEST_ROOM;
fn field<'a>(req: &'a Value, k: &str) -> Option<&'a Value> {
req.get(k).filter(|v| !v.is_null())
}
fn missing(k: &str) -> CoreError {
CoreError::Json(format!("{k} is required"))
}
fn json_arg(req: &Value, k: &str) -> Result<String> {
field(req, k)
.map(Value::to_string)
.ok_or_else(|| missing(k))
}
fn opt_json_arg(req: &Value, k: &str) -> Result<Option<String>> {
Ok(field(req, k).map(Value::to_string))
}
fn str_arg(req: &Value, k: &str) -> Result<String> {
opt_str_arg(req, k)?.ok_or_else(|| missing(k))
}
fn history_arg(req: &Value) -> Result<Option<String>> {
match req.get("historyId") {
None => Ok(None),
Some(Value::String(s)) if !s.is_empty() => Ok(Some(s.clone())),
Some(_) => Err(CoreError::Json(
"historyId must be a non-empty string; leave it out for no history".into(),
)),
}
}
fn opt_str_arg(req: &Value, k: &str) -> Result<Option<String>> {
match field(req, k) {
None => Ok(None),
Some(Value::String(s)) => Ok(Some(s.clone())),
Some(_) => Err(CoreError::Json(format!("{k} must be a string"))),
}
}
fn bytes_arg(req: &Value, k: &str) -> Result<Zeroizing<Vec<u8>>> {
Ok(opt_bytes_arg(req, k)?.unwrap_or_else(|| Zeroizing::new(Vec::new())))
}
fn opt_bytes_arg(req: &Value, k: &str) -> Result<Option<Zeroizing<Vec<u8>>>> {
match field(req, k) {
None => Ok(None),
Some(Value::String(s)) => STANDARD
.decode(s)
.map(|b| Some(Zeroizing::new(b)))
.map_err(|_| CoreError::Json(format!("{k} must be standard base64"))),
Some(_) => Err(CoreError::Json(format!("{k} must be a base64 string"))),
}
}
fn u64_arg(req: &Value, k: &str) -> Result<u64> {
field(req, k)
.ok_or_else(|| missing(k))?
.as_u64()
.ok_or_else(|| CoreError::Json(format!("{k} must be a whole number from 0")))
}
fn i64_arg(req: &Value, k: &str) -> Result<i64> {
opt_i64_arg(req, k)?.ok_or_else(|| missing(k))
}
fn opt_i64_arg(req: &Value, k: &str) -> Result<Option<i64>> {
match field(req, k) {
None => Ok(None),
Some(v) => v
.as_i64()
.map(Some)
.ok_or_else(|| CoreError::Json(format!("{k} must be a whole number"))),
}
}
pub const NAMES: &[&str] = &[
"mint_robot_identity",
"verify_robot_identity",
"config_hash",
"build_provenance_attestation",
"verify_provenance_attestation",
"build_physical_scope_credential",
"check_physical_action",
"check_physical_action_scope",
"attenuates",
"build_hello",
"build_accept",
"verify_accept",
"build_confirm",
"verify_confirm",
"genesis_prev_hash",
"blackbox_append_entry",
"blackbox_open_entry",
"verify_blackbox_chain",
"build_killswitch_credential",
"verify_killswitch_credential",
"verify_blackbox_head",
"build_blackbox_head",
"build_safety_evidence",
"verify_safety_evidence",
"build_passport",
"encode_passport",
"decode_passport",
"verify_passport",
"verify_passport_uri",
"motion_digest",
"validate_motion_digest",
"build_robot_heartbeat",
"verify_robot_heartbeat",
"is_live",
"build_status_list_entry",
"attach_credential_status",
"check_credential_status",
"safety_append_entry",
"verify_safety_log",
"summarize_entries",
"build_safety_record",
"verify_safety_record",
"hash_frame",
"perception_record_entry",
"verify_perception_log",
"build_perception_attestation",
"verify_perception_attestation",
"verify_perception_segment",
"build_delegation_lease",
"verify_delegation_lease",
"verify_lease_chain",
"lease_permits",
"build_action_approval",
"verify_action_authorization",
"build_ownership_transfer",
"verify_ownership_transfer",
"verify_custody_chain",
"build_key_rotation",
"verify_key_rotation",
"verify_key_history",
"build_decommission",
"verify_decommission",
"check_conformance",
"report_digest",
"build_conformance_attestation",
"verify_conformance_attestation",
"sign_pq",
"is_pq",
"verify_pq",
"verify_robot_credential",
"migrate_to_pq",
"build_embodiment",
"verify_embodiment",
"verify_continuity_chain",
"check_no_fork",
"build_handoff",
"build_release",
"verify_handoff",
"verify_handoff_chain",
"holder_at",
"locate_condition_change",
"build_access_grant",
"verify_access_grant",
"build_access_request",
"authorize_access",
"attenuates_grant",
"fusion_inputs_digest",
"hash_fused_output",
"build_fused_attestation",
"verify_fused_attestation",
"verify_fusion_inputs",
"build_wear_attestation",
"verify_wear_attestation",
"verify_wear_chain",
"attenuate_for_wear",
"hash_capture",
"build_consent_token",
"verify_consent_token",
"build_consent_evidence",
"verify_consent_evidence",
"build_odd_credential",
"verify_odd_credential",
"check_in_domain",
"build_odd_conformance",
"verify_odd_conformance",
"build_human_handover",
"verify_human_handover",
"build_handover_ack",
"verify_handover_ack",
"build_validity_root",
"build_validity_witness",
"verify_validity_witness",
"evaluate_snapshot_freshness",
"check_credential_status_signed",
"verify_passport_summary",
"build_swarm_membership",
"verify_swarm_membership",
"build_collective_action",
"verify_collective_action",
"build_control_handoff",
"verify_control_handoff",
"verify_control_chain",
"controller_at",
"check_control_continuity",
"sparse_merkle_root",
"build_non_revocation_proof",
"verify_non_revocation_proof",
"build_revocation_accumulator_root",
"build_conditional_revocation",
"build_revocation_renewal",
"verify_conditional_revocation",
"conditional_revocation_active",
"verify_non_revocation",
"bind_credential_to_bundle",
"build_custody_transfer",
"verify_bundle_trust",
"verify_custody_transfer",
"custody_chain_ok",
"build_time_quality_attestation",
"verify_time_quality_attestation",
"time_quality_permits",
"schedule_problem",
"build_autonomy_schedule",
"verify_autonomy_schedule",
"select_envelope",
"autonomy_permits",
"integrity_attestation_hash",
"build_integrity_risk_attestation",
"verify_integrity_risk_attestation",
"verify_integrity_chain",
"integrity_authority_level",
"build_freshness_token",
"verify_freshness_token",
"epoch_gap_budget",
"epoch_acceptable",
"nonce_acceptable",
"decay_weight",
"decay_permits",
"region_contains",
"region_attenuates",
"build_geoscoped_grant",
"verify_geoscoped_grant",
"geoscope_permits",
"build_range_observation",
"verify_range_observation",
"count_consistent",
"location_confirmed",
"build_proof_of_location",
"kinematically_reachable",
"within_beam",
"build_beam_presence",
"verify_beam_presence",
"propagate_two_body",
"reachable_two_body",
"build_perception_claim",
"verify_perception_claim",
"cross_check_perception",
"build_interaction_attestation",
"verify_interaction_attestation",
"node_standing",
"expected_range_m",
"radial_velocity_mps",
"expected_doppler_hz",
"check_presence",
"build_presence_attestation",
"verify_presence_attestation",
"provenance_attestation_id",
"verify_provenance_chain",
"build_distress_attestation",
"verify_distress_attestation",
"is_quarantined",
"build_trust_state_update",
"verify_trust_state_update",
"accept_trust_state_update",
"build_key_continuity_predelegation",
"build_continuity_approval",
"verify_key_continuity",
"preserves_or_narrows",
"build_robot_identity",
"verify_robot_identity_chain",
"verify_chain_against_head",
"validate_safety_summary",
"verify_robotics_credential",
"collect_verified",
"verify_safety_record_params",
"verify_conformance_attestation_params",
"verify_delegation_lease_params",
"verify_decommission_params",
"verify_embodiment_params",
"verify_handoff_params",
"verify_accept_params",
"trust_policy_is_trusted",
"is_live_params",
"motion_digest_problem",
"blackbox_append",
"scope_problems",
"parse_hm",
"handover_in_envelope",
"tier_defaults",
"evaluate_freshness",
"verify_status_list_signature",
"conformance_profile",
"verify_log_segment",
"finish_log_segments",
"finish_log_segments_head",
"check_no_fork_segment",
];
pub fn call(name: &str, request_json: &str, host_now: &str) -> Result<String> {
call_limited(name, request_json, host_now, rj::LogLimits::DEFAULT)
}
pub fn call_limited(
name: &str,
request_json: &str,
host_now: &str,
limits: rj::LogLimits,
) -> Result<String> {
if let Some(builder) = name.strip_prefix("prepare:") {
return crate::robotics_prepare::prepare(builder, request_json, host_now);
}
if name == "finish" {
return crate::robotics_prepare::finish(request_json);
}
facade(name, request_json, host_now, limits)
}
fn facade(name: &str, request_json: &str, host_now: &str, limits: rj::LogLimits) -> Result<String> {
let limit = if LONG_FACADES.contains(&name) {
limits.max_bytes.saturating_add(LONG_REQUEST_ROOM)
} else {
MAX_REQUEST_BYTES
};
if request_json.len() > limit {
return Err(CoreError::Json(format!(
"json: input is larger than {limit} bytes"
)));
}
crate::nesting::check_text(request_json.as_bytes())?;
let req_value: Value =
serde_json::from_str(request_json).map_err(|e| CoreError::Json(format!("json: {e}")))?;
if !req_value.is_object() {
return Err(CoreError::Json("the request must be a JSON object".into()));
}
let now = match field(&req_value, "now") {
None => host_now.to_string(),
Some(Value::String(s)) => s.clone(),
Some(_) => return Err(CoreError::Json("now must be a string".into())),
};
let req = &req_value;
let _ = (&now, &limits);
match name {
"mint_robot_identity" => {
let robot_seed = bytes_arg(req, "robotSeed")?;
let params_json = json_arg(req, "params")?;
rj::mint_robot_identity(&robot_seed, ¶ms_json)
}
"verify_robot_identity" => {
let credential_json = json_arg(req, "credential")?;
let robot_pub = bytes_arg(req, "robotPub")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
let hardware_root_mb = opt_str_arg(req, "hardwareRootMb")?;
rj::verify_robot_identity(
&credential_json,
&robot_pub,
issuer_did.as_deref(),
hardware_root_mb.as_deref(),
&now,
)
}
"config_hash" => {
let config_json = json_arg(req, "config")?;
Ok(Value::String(rj::config_hash(&config_json)?).to_string())
}
"build_provenance_attestation" => {
let signer_seed = bytes_arg(req, "signerSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_provenance_attestation(&signer_seed, ¶ms_json)
}
"verify_provenance_attestation" => {
let attestation_json = json_arg(req, "attestation")?;
let public_key = bytes_arg(req, "publicKey")?;
let config_json = opt_json_arg(req, "config")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_provenance_attestation(
&attestation_json,
&public_key,
config_json.as_deref(),
issuer_did.as_deref(),
&now,
)
}
"build_physical_scope_credential" => {
let signer_seed = bytes_arg(req, "signerSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_physical_scope_credential(&signer_seed, ¶ms_json)
}
"check_physical_action" => {
let scope_credential_json = json_arg(req, "scopeCredential")?;
let action_json = json_arg(req, "action")?;
let public_key = bytes_arg(req, "publicKey")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
let robot_did = opt_str_arg(req, "robotDid")?;
rj::check_physical_action(
&scope_credential_json,
&action_json,
&public_key,
issuer_did.as_deref(),
robot_did.as_deref(),
&now,
)
}
"check_physical_action_scope" => {
let scope_json = json_arg(req, "scope")?;
let action_json = json_arg(req, "action")?;
rj::check_physical_action_scope(&scope_json, &action_json)
}
"attenuates" => {
let parent_json = json_arg(req, "parent")?;
let child_json = json_arg(req, "child")?;
Ok(Value::Bool(rj::attenuates(&parent_json, &child_json)?).to_string())
}
"build_hello" => {
let signer_seed = bytes_arg(req, "signerSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_hello(&signer_seed, ¶ms_json)
}
"build_accept" => {
let signer_seed = bytes_arg(req, "signerSeed")?;
let hello_json = json_arg(req, "hello")?;
let hello_public_key = bytes_arg(req, "helloPublicKey")?;
let policy_json = json_arg(req, "policy")?;
let params_json = json_arg(req, "params")?;
rj::build_accept(
&signer_seed,
&hello_json,
&hello_public_key,
&policy_json,
¶ms_json,
)
}
"verify_accept" => {
let accept_json = json_arg(req, "accept")?;
let accept_public_key = bytes_arg(req, "acceptPublicKey")?;
let hello_json = json_arg(req, "hello")?;
let expected_nonce = opt_str_arg(req, "expectedNonce")?;
let policy_json = opt_json_arg(req, "policy")?;
let responder_did = opt_str_arg(req, "responderDid")?;
rj::verify_accept(
&accept_json,
&accept_public_key,
&hello_json,
expected_nonce.as_deref(),
policy_json.as_deref(),
responder_did.as_deref(),
&now,
)
}
"build_confirm" => {
let signer_seed = bytes_arg(req, "signerSeed")?;
let from_did = str_arg(req, "fromDid")?;
let session_json = json_arg(req, "session")?;
let created = str_arg(req, "created")?;
rj::build_confirm(&signer_seed, &from_did, &session_json, &created)
}
"verify_confirm" => {
let confirm_json = json_arg(req, "confirm")?;
let confirm_public_key = bytes_arg(req, "confirmPublicKey")?;
let accept_json = json_arg(req, "accept")?;
let initiator_did = opt_str_arg(req, "initiatorDid")?;
Ok(Value::Bool(rj::verify_confirm(
&confirm_json,
&confirm_public_key,
&accept_json,
initiator_did.as_deref(),
&now,
)?)
.to_string())
}
"genesis_prev_hash" => Ok(Value::String(rj::genesis_prev_hash()).to_string()),
"blackbox_append_entry" => {
let key = bytes_arg(req, "key")?;
let seq = u64_arg(req, "seq")?;
let event = str_arg(req, "event")?;
let payload_json = json_arg(req, "payload")?;
let timestamp = str_arg(req, "timestamp")?;
let prev_hash = str_arg(req, "prevHash")?;
rj::blackbox_append_entry(&key, seq, &event, &payload_json, ×tamp, &prev_hash)
}
"blackbox_open_entry" => {
let entry_json = json_arg(req, "entry")?;
let key = bytes_arg(req, "key")?;
rj::blackbox_open_entry(&entry_json, &key)
}
"verify_blackbox_chain" => {
let entries_json = json_arg(req, "entries")?;
let genesis_prev_hash = opt_str_arg(req, "genesisPrevHash")?;
drop(req_value);
rj::verify_blackbox_chain_with(&entries_json, genesis_prev_hash.as_deref(), limits)
}
"build_killswitch_credential" => {
let authority_seed = bytes_arg(req, "authoritySeed")?;
let params_json = json_arg(req, "params")?;
rj::build_killswitch_credential(&authority_seed, ¶ms_json)
}
"verify_killswitch_credential" => {
let credential_json = json_arg(req, "credential")?;
let public_key = bytes_arg(req, "publicKey")?;
let trusted_authorities_json = opt_json_arg(req, "trustedAuthorities")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_killswitch_credential(
&credential_json,
&public_key,
trusted_authorities_json.as_deref(),
issuer_did.as_deref(),
&now,
)
}
"verify_blackbox_head" => {
let params_json = json_arg(req, "params")?;
let robot_pub = bytes_arg(req, "robotPub")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
drop(req_value);
rj::verify_blackbox_head_with(
¶ms_json,
&robot_pub,
issuer_did.as_deref(),
&now,
limits,
)
}
"build_blackbox_head" => {
let robot_seed = bytes_arg(req, "robotSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_blackbox_head(&robot_seed, ¶ms_json)
}
"build_safety_evidence" => {
let signer_seed = bytes_arg(req, "signerSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_safety_evidence(&signer_seed, ¶ms_json)
}
"verify_safety_evidence" => {
let credential_json = json_arg(req, "credential")?;
let robot_pub = bytes_arg(req, "robotPub")?;
let entries_json = opt_json_arg(req, "entries")?.unwrap_or_else(|| "null".into());
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_safety_evidence(
&credential_json,
&robot_pub,
&entries_json,
issuer_did.as_deref(),
&now,
)
}
"build_passport" => {
let signer_seed = bytes_arg(req, "signerSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_passport(&signer_seed, ¶ms_json)
}
"encode_passport" => {
let passport_json = json_arg(req, "passport")?;
Ok(Value::String(rj::encode_passport(&passport_json)?).to_string())
}
"decode_passport" => {
let uri = str_arg(req, "uri")?;
rj::decode_passport(&uri)
}
"verify_passport" => {
let passport_json = json_arg(req, "passport")?;
let public_key = bytes_arg(req, "publicKey")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_passport(&passport_json, &public_key, &now, issuer_did.as_deref())
}
"verify_passport_uri" => {
let uri = str_arg(req, "uri")?;
let public_key = bytes_arg(req, "publicKey")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_passport_uri(&uri, &public_key, &now, issuer_did.as_deref())
}
"motion_digest" => {
let params_json = json_arg(req, "params")?;
rj::motion_digest(¶ms_json)
}
"validate_motion_digest" => {
let digest_json = json_arg(req, "digest")?;
Ok(Value::Bool(rj::validate_motion_digest(&digest_json)?).to_string())
}
"build_robot_heartbeat" => {
let robot_seed = bytes_arg(req, "robotSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_robot_heartbeat(&robot_seed, ¶ms_json)
}
"verify_robot_heartbeat" => {
let credential_json = json_arg(req, "credential")?;
let robot_public_key = bytes_arg(req, "robotPublicKey")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_robot_heartbeat(
&credential_json,
&robot_public_key,
issuer_did.as_deref(),
&now,
)
}
"is_live" => {
let credential_json = json_arg(req, "credential")?;
let interval_seconds = opt_i64_arg(req, "intervalSeconds")?;
let grace_intervals = i64_arg(req, "graceIntervals")?;
Ok(Value::Bool(rj::is_live(
&credential_json,
&now,
interval_seconds,
grace_intervals,
)?)
.to_string())
}
"build_status_list_entry" => {
let status_list_credential = str_arg(req, "statusListCredential")?;
let status_list_index = i64_arg(req, "statusListIndex")?;
let status_purpose = str_arg(req, "statusPurpose")?;
let entry_id = opt_str_arg(req, "entryId")?;
rj::build_status_list_entry(
&status_list_credential,
status_list_index,
&status_purpose,
entry_id.as_deref(),
)
}
"attach_credential_status" => {
let credential_json = json_arg(req, "credential")?;
let signer_seed = bytes_arg(req, "signerSeed")?;
let params_json = json_arg(req, "params")?;
rj::attach_credential_status(&credential_json, &signer_seed, ¶ms_json)
}
"check_credential_status" => {
let credential_json = json_arg(req, "credential")?;
let status_list_credential_json = json_arg(req, "statusListCredential")?;
let status_purpose = str_arg(req, "statusPurpose")?;
Ok(Value::Bool(rj::check_credential_status(
&credential_json,
&status_list_credential_json,
&status_purpose,
)?)
.to_string())
}
"safety_append_entry" => {
let params_json = json_arg(req, "params")?;
rj::safety_append_entry(¶ms_json)
}
"verify_safety_log" => {
let entries_json = json_arg(req, "entries")?;
let genesis_prev_hash = opt_str_arg(req, "genesisPrevHash")?;
drop(req_value);
rj::verify_safety_log_with(&entries_json, genesis_prev_hash.as_deref(), limits)
}
"summarize_entries" => {
let entries_json = json_arg(req, "entries")?;
let head = opt_str_arg(req, "head")?;
rj::summarize_entries(&entries_json, head.as_deref())
}
"build_safety_record" => {
let signer_seed = bytes_arg(req, "signerSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_safety_record(&signer_seed, ¶ms_json)
}
"verify_safety_record" => {
let credential_json = json_arg(req, "credential")?;
let public_key = bytes_arg(req, "publicKey")?;
let entries_json = opt_json_arg(req, "entries")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_safety_record(
&credential_json,
&public_key,
entries_json.as_deref(),
issuer_did.as_deref(),
&now,
)
}
"hash_frame" => {
let frame = bytes_arg(req, "frame")?;
Ok(Value::String(rj::hash_frame(&frame)).to_string())
}
"perception_record_entry" => {
let params_json = json_arg(req, "params")?;
rj::perception_record_entry(¶ms_json)
}
"verify_perception_log" => {
let entries_json = json_arg(req, "entries")?;
let genesis_prev_hash = opt_str_arg(req, "genesisPrevHash")?;
drop(req_value);
rj::verify_perception_log_with(&entries_json, genesis_prev_hash.as_deref(), limits)
}
"build_perception_attestation" => {
let robot_seed = bytes_arg(req, "robotSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_perception_attestation(&robot_seed, ¶ms_json)
}
"verify_perception_attestation" => {
let credential_json = json_arg(req, "credential")?;
let public_key = bytes_arg(req, "publicKey")?;
let frame_mb = opt_str_arg(req, "frameMb")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_perception_attestation(
&credential_json,
&public_key,
frame_mb.as_deref(),
issuer_did.as_deref(),
&now,
)
}
"verify_perception_segment" => {
let params_json = json_arg(req, "params")?;
let public_key = bytes_arg(req, "publicKey")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_perception_segment(¶ms_json, &public_key, issuer_did.as_deref(), &now)
}
"build_delegation_lease" => {
let signer_seed = bytes_arg(req, "signerSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_delegation_lease(&signer_seed, ¶ms_json)
}
"verify_delegation_lease" => {
let credential_json = json_arg(req, "credential")?;
let public_key = bytes_arg(req, "publicKey")?;
let parent_scope_json = opt_json_arg(req, "parentScope")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
let expected_robot = str_arg(req, "expectedRobot")?;
rj::verify_delegation_lease(
&credential_json,
&public_key,
&now,
parent_scope_json.as_deref(),
issuer_did.as_deref(),
&expected_robot,
)
}
"verify_lease_chain" => {
let params_json = json_arg(req, "params")?;
rj::verify_lease_chain(¶ms_json, &now)
}
"lease_permits" => {
let params_json = json_arg(req, "params")?;
Ok(Value::Bool(rj::lease_permits(¶ms_json, &now)?).to_string())
}
"build_action_approval" => {
let approver_seed = bytes_arg(req, "approverSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_action_approval(&approver_seed, ¶ms_json)
}
"verify_action_authorization" => {
let params_json = json_arg(req, "params")?;
rj::verify_action_authorization(¶ms_json, &now)
}
"build_ownership_transfer" => {
let current_owner_seed = bytes_arg(req, "currentOwnerSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_ownership_transfer(¤t_owner_seed, ¶ms_json)
}
"verify_ownership_transfer" => {
let credential_json = json_arg(req, "credential")?;
let public_key = bytes_arg(req, "publicKey")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
let robot_did = opt_str_arg(req, "robotDid")?;
rj::verify_ownership_transfer(
&credential_json,
&public_key,
issuer_did.as_deref(),
robot_did.as_deref(),
&now,
)
}
"verify_custody_chain" => {
let params_json = json_arg(req, "params")?;
rj::verify_custody_chain(¶ms_json, &now)
}
"build_key_rotation" => {
let old_key_seed = bytes_arg(req, "oldKeySeed")?;
let params_json = json_arg(req, "params")?;
rj::build_key_rotation(&old_key_seed, ¶ms_json)
}
"verify_key_rotation" => {
let credential_json = json_arg(req, "credential")?;
let old_public_key = bytes_arg(req, "oldPublicKey")?;
let robot_did = opt_str_arg(req, "robotDid")?;
rj::verify_key_rotation(
&credential_json,
&old_public_key,
robot_did.as_deref(),
&now,
)
}
"verify_key_history" => {
let params_json = json_arg(req, "params")?;
rj::verify_key_history(¶ms_json, &now)
}
"build_decommission" => {
let signer_seed = bytes_arg(req, "signerSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_decommission(&signer_seed, ¶ms_json)
}
"verify_decommission" => {
let credential_json = json_arg(req, "credential")?;
let public_key = bytes_arg(req, "publicKey")?;
let trusted_authorities_json = opt_json_arg(req, "trustedAuthorities")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_decommission(
&credential_json,
&public_key,
trusted_authorities_json.as_deref(),
issuer_did.as_deref(),
&now,
)
}
"check_conformance" => {
let credentials_json = json_arg(req, "credentials")?;
let profile_id = str_arg(req, "profileId")?;
rj::check_conformance(&credentials_json, &profile_id)
}
"report_digest" => {
let report_json = json_arg(req, "report")?;
Ok(Value::String(rj::report_digest(&report_json)?).to_string())
}
"build_conformance_attestation" => {
let signer_seed = bytes_arg(req, "signerSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_conformance_attestation(&signer_seed, ¶ms_json)
}
"verify_conformance_attestation" => {
let credential_json = json_arg(req, "credential")?;
let public_key = bytes_arg(req, "publicKey")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_conformance_attestation(
&credential_json,
&public_key,
issuer_did.as_deref(),
&now,
)
}
"sign_pq" => {
let credential_json = json_arg(req, "credential")?;
let ed25519_seed = bytes_arg(req, "ed25519Seed")?;
let mldsa_secret = bytes_arg(req, "mldsaSecret")?;
let mldsa_public = bytes_arg(req, "mldsaPublic")?;
let created = str_arg(req, "created")?;
rj::sign_pq(
&credential_json,
&ed25519_seed,
&mldsa_secret,
&mldsa_public,
&created,
)
}
"is_pq" => {
let credential_json = json_arg(req, "credential")?;
Ok(Value::Bool(rj::is_pq(&credential_json)?).to_string())
}
"verify_pq" => {
let credential_json = json_arg(req, "credential")?;
let ed25519_public = bytes_arg(req, "ed25519Public")?;
let mldsa44_public = bytes_arg(req, "mldsa44Public")?;
Ok(Value::Bool(rj::verify_pq(
&credential_json,
&ed25519_public,
&mldsa44_public,
)?)
.to_string())
}
"verify_robot_credential" => {
let credential_json = json_arg(req, "credential")?;
let ed25519_public = bytes_arg(req, "ed25519Public")?;
let mldsa44_public = opt_bytes_arg(req, "mldsa44Public")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
Ok(Value::Bool(rj::verify_robot_credential(
&credential_json,
&ed25519_public,
mldsa44_public.as_deref().map(|b| &b[..]),
issuer_did.as_deref(),
&now,
)?)
.to_string())
}
"migrate_to_pq" => {
let credential_json = json_arg(req, "credential")?;
let ed25519_seed = bytes_arg(req, "ed25519Seed")?;
let mldsa_secret = bytes_arg(req, "mldsaSecret")?;
let mldsa_public = bytes_arg(req, "mldsaPublic")?;
let created = str_arg(req, "created")?;
rj::migrate_to_pq(
&credential_json,
&ed25519_seed,
&mldsa_secret,
&mldsa_public,
&created,
)
}
"build_embodiment" => {
let agent_seed = bytes_arg(req, "agentSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_embodiment(&agent_seed, ¶ms_json)
}
"verify_embodiment" => {
let credential_json = json_arg(req, "credential")?;
let agent_public_key = bytes_arg(req, "agentPublicKey")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_embodiment(
&credential_json,
&agent_public_key,
issuer_did.as_deref(),
&now,
)
}
"verify_continuity_chain" => {
let params_json = json_arg(req, "params")?;
let agent_public_key = bytes_arg(req, "agentPublicKey")?;
rj::verify_continuity_chain(¶ms_json, &agent_public_key, &now)
}
"check_no_fork" => {
let params_json = json_arg(req, "params")?;
drop(req_value);
rj::check_no_fork_with(¶ms_json, limits)
}
"build_handoff" => {
let receiver_seed = bytes_arg(req, "receiverSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_handoff(&receiver_seed, ¶ms_json)
}
"build_release" => {
let releaser_seed = bytes_arg(req, "releaserSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_release(&releaser_seed, ¶ms_json)
}
"verify_handoff" => {
let credential_json = json_arg(req, "credential")?;
let receiver_public_key = bytes_arg(req, "receiverPublicKey")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_handoff(
&credential_json,
&receiver_public_key,
issuer_did.as_deref(),
&now,
)
}
"verify_handoff_chain" => {
let params_json = json_arg(req, "params")?;
rj::verify_handoff_chain(¶ms_json, &now)
}
"holder_at" => {
let params_json = json_arg(req, "params")?;
rj::holder_at(¶ms_json)
}
"locate_condition_change" => {
let params_json = json_arg(req, "params")?;
rj::locate_condition_change(¶ms_json)
}
"build_access_grant" => {
let operator_seed = bytes_arg(req, "operatorSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_access_grant(&operator_seed, ¶ms_json)
}
"verify_access_grant" => {
let credential_json = json_arg(req, "credential")?;
let operator_public_key = bytes_arg(req, "operatorPublicKey")?;
rj::verify_access_grant(&credential_json, &operator_public_key, &now)
}
"build_access_request" => {
let robot_seed = bytes_arg(req, "robotSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_access_request(&robot_seed, ¶ms_json)
}
"authorize_access" => {
let params_json = json_arg(req, "params")?;
let operator_public_key = bytes_arg(req, "operatorPublicKey")?;
let robot_public_key = bytes_arg(req, "robotPublicKey")?;
rj::authorize_access(¶ms_json, &operator_public_key, &robot_public_key, &now)
}
"attenuates_grant" => {
let params_json = json_arg(req, "params")?;
rj::attenuates_grant(¶ms_json)
}
"fusion_inputs_digest" => {
let params_json = json_arg(req, "params")?;
Ok(Value::String(rj::fusion_inputs_digest(¶ms_json)?).to_string())
}
"hash_fused_output" => {
let output = bytes_arg(req, "output")?;
Ok(Value::String(rj::hash_fused_output(&output)).to_string())
}
"build_fused_attestation" => {
let robot_seed = bytes_arg(req, "robotSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_fused_attestation(&robot_seed, ¶ms_json)
}
"verify_fused_attestation" => {
let credential_json = json_arg(req, "credential")?;
let public_key = bytes_arg(req, "publicKey")?;
let fused_output_mb = opt_str_arg(req, "fusedOutputMb")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_fused_attestation(
&credential_json,
&public_key,
fused_output_mb.as_deref(),
issuer_did.as_deref(),
&now,
)
}
"verify_fusion_inputs" => {
let params_json = json_arg(req, "params")?;
rj::verify_fusion_inputs(¶ms_json)
}
"build_wear_attestation" => {
let robot_seed = bytes_arg(req, "robotSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_wear_attestation(&robot_seed, ¶ms_json)
}
"verify_wear_attestation" => {
let credential_json = json_arg(req, "credential")?;
let public_key = bytes_arg(req, "publicKey")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
rj::verify_wear_attestation(&credential_json, &public_key, issuer_did.as_deref(), &now)
}
"verify_wear_chain" => {
let params_json = json_arg(req, "params")?;
let public_key = bytes_arg(req, "publicKey")?;
rj::verify_wear_chain(¶ms_json, &public_key, &now)
}
"attenuate_for_wear" => {
let params_json = json_arg(req, "params")?;
rj::attenuate_for_wear(¶ms_json)
}
"hash_capture" => {
let capture = bytes_arg(req, "capture")?;
Ok(Value::String(rj::hash_capture(&capture)).to_string())
}
"build_consent_token" => {
let bystander_seed = bytes_arg(req, "bystanderSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_consent_token(&bystander_seed, ¶ms_json)
}
"verify_consent_token" => {
let params_json = json_arg(req, "params")?;
let bystander_public_key = bytes_arg(req, "bystanderPublicKey")?;
rj::verify_consent_token(¶ms_json, &bystander_public_key, &now)
}
"build_consent_evidence" => {
let robot_seed = bytes_arg(req, "robotSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_consent_evidence(&robot_seed, ¶ms_json)
}
"verify_consent_evidence" => {
let params_json = json_arg(req, "params")?;
let robot_public_key = bytes_arg(req, "robotPublicKey")?;
rj::verify_consent_evidence(¶ms_json, &robot_public_key, &now)
}
"build_odd_credential" => {
let operator_seed = bytes_arg(req, "operatorSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_odd_credential(&operator_seed, ¶ms_json)
}
"verify_odd_credential" => {
let params_json = json_arg(req, "params")?;
rj::verify_odd_credential(¶ms_json, &now)
}
"check_in_domain" => {
let params_json = json_arg(req, "params")?;
rj::check_in_domain(¶ms_json)
}
"build_odd_conformance" => {
let robot_seed = bytes_arg(req, "robotSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_odd_conformance(&robot_seed, ¶ms_json)
}
"verify_odd_conformance" => {
let params_json = json_arg(req, "params")?;
rj::verify_odd_conformance(¶ms_json, &now)
}
"build_human_handover" => {
let robot_seed = bytes_arg(req, "robotSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_human_handover(&robot_seed, ¶ms_json)
}
"verify_human_handover" => {
let params_json = json_arg(req, "params")?;
rj::verify_human_handover(¶ms_json, &now)
}
"build_handover_ack" => {
let recipient_seed = bytes_arg(req, "recipientSeed")?;
let params_json = json_arg(req, "params")?;
rj::build_handover_ack(&recipient_seed, ¶ms_json)
}
"verify_handover_ack" => {
let params_json = json_arg(req, "params")?;
rj::verify_handover_ack(¶ms_json, &now)
}
"build_validity_root" => {
let authority_seed = bytes_arg(req, "authoritySeed")?;
let params_json = json_arg(req, "params")?;
rj::build_validity_root(&authority_seed, ¶ms_json)
}
"build_validity_witness" => {
let params_json = json_arg(req, "params")?;
rj::build_validity_witness(¶ms_json)
}
"verify_validity_witness" => {
let params_json = json_arg(req, "params")?;
rj::verify_validity_witness(¶ms_json, &now)
}
"evaluate_snapshot_freshness" => {
let params_json = json_arg(req, "params")?;
rj::evaluate_snapshot_freshness(¶ms_json, &now)
}
"check_credential_status_signed" => {
let params_json = json_arg(req, "params")?;
rj::check_credential_status_signed(¶ms_json, &now)
}
"verify_passport_summary" => {
let params_json = json_arg(req, "params")?;
rj::verify_passport_summary(¶ms_json, &now)
}
"build_swarm_membership" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_swarm_membership(&seed, ¶ms_json)
}
"verify_swarm_membership" => {
let params_json = json_arg(req, "params")?;
rj::verify_swarm_membership(¶ms_json, &now)
}
"build_collective_action" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_collective_action(&seed, ¶ms_json)
}
"verify_collective_action" => {
let params_json = json_arg(req, "params")?;
rj::verify_collective_action(¶ms_json, &now)
}
"build_control_handoff" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_control_handoff(&seed, ¶ms_json)
}
"verify_control_handoff" => {
let params_json = json_arg(req, "params")?;
rj::verify_control_handoff(¶ms_json, &now)
}
"verify_control_chain" => {
let params_json = json_arg(req, "params")?;
rj::verify_control_chain(¶ms_json, &now)
}
"controller_at" => {
let params_json = json_arg(req, "params")?;
rj::controller_at(¶ms_json)
}
"check_control_continuity" => {
let params_json = json_arg(req, "params")?;
rj::check_control_continuity(¶ms_json)
}
"sparse_merkle_root" => {
let params_json = json_arg(req, "params")?;
rj::sparse_merkle_root(¶ms_json, &now)
}
"build_non_revocation_proof" => {
let params_json = json_arg(req, "params")?;
rj::build_non_revocation_proof(¶ms_json, &now)
}
"verify_non_revocation_proof" => {
let params_json = json_arg(req, "params")?;
rj::verify_non_revocation_proof(¶ms_json, &now)
}
"build_revocation_accumulator_root" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_revocation_accumulator_root(&seed, ¶ms_json, &now)
}
"build_conditional_revocation" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_conditional_revocation(&seed, ¶ms_json, &now)
}
"build_revocation_renewal" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_revocation_renewal(&seed, ¶ms_json, &now)
}
"verify_conditional_revocation" => {
let params_json = json_arg(req, "params")?;
rj::verify_conditional_revocation(¶ms_json, &now)
}
"conditional_revocation_active" => {
let params_json = json_arg(req, "params")?;
rj::conditional_revocation_active(¶ms_json, &now)
}
"verify_non_revocation" => {
let params_json = json_arg(req, "params")?;
rj::verify_non_revocation(¶ms_json, &now)
}
"bind_credential_to_bundle" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::bind_credential_to_bundle(&seed, ¶ms_json, &now)
}
"build_custody_transfer" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_custody_transfer(&seed, ¶ms_json, &now)
}
"verify_bundle_trust" => {
let params_json = json_arg(req, "params")?;
rj::verify_bundle_trust(¶ms_json, &now)
}
"verify_custody_transfer" => {
let params_json = json_arg(req, "params")?;
rj::verify_custody_transfer(¶ms_json, &now)
}
"custody_chain_ok" => {
let params_json = json_arg(req, "params")?;
rj::custody_chain_ok(¶ms_json, &now)
}
"build_time_quality_attestation" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_time_quality_attestation(&seed, ¶ms_json, &now)
}
"verify_time_quality_attestation" => {
let params_json = json_arg(req, "params")?;
rj::verify_time_quality_attestation(¶ms_json, &now)
}
"time_quality_permits" => {
let params_json = json_arg(req, "params")?;
rj::time_quality_permits(¶ms_json, &now)
}
"schedule_problem" => {
let params_json = json_arg(req, "params")?;
rj::schedule_problem(¶ms_json, &now)
}
"build_autonomy_schedule" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_autonomy_schedule(&seed, ¶ms_json, &now)
}
"verify_autonomy_schedule" => {
let params_json = json_arg(req, "params")?;
rj::verify_autonomy_schedule(¶ms_json, &now)
}
"select_envelope" => {
let params_json = json_arg(req, "params")?;
rj::select_envelope(¶ms_json, &now)
}
"autonomy_permits" => {
let params_json = json_arg(req, "params")?;
rj::autonomy_permits(¶ms_json, &now)
}
"integrity_attestation_hash" => {
let params_json = json_arg(req, "params")?;
rj::integrity_attestation_hash(¶ms_json, &now)
}
"build_integrity_risk_attestation" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_integrity_risk_attestation(&seed, ¶ms_json, &now)
}
"verify_integrity_risk_attestation" => {
let params_json = json_arg(req, "params")?;
rj::verify_integrity_risk_attestation(¶ms_json, &now)
}
"verify_integrity_chain" => {
let params_json = json_arg(req, "params")?;
rj::verify_integrity_chain(¶ms_json, &now)
}
"integrity_authority_level" => {
let params_json = json_arg(req, "params")?;
rj::integrity_authority_level(¶ms_json, &now)
}
"build_freshness_token" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_freshness_token(&seed, ¶ms_json, &now)
}
"verify_freshness_token" => {
let params_json = json_arg(req, "params")?;
rj::verify_freshness_token(¶ms_json, &now)
}
"epoch_gap_budget" => {
let params_json = json_arg(req, "params")?;
rj::epoch_gap_budget(¶ms_json, &now)
}
"epoch_acceptable" => {
let params_json = json_arg(req, "params")?;
rj::epoch_acceptable(¶ms_json, &now)
}
"nonce_acceptable" => {
let params_json = json_arg(req, "params")?;
rj::nonce_acceptable(¶ms_json, &now)
}
"decay_weight" => {
let params_json = json_arg(req, "params")?;
rj::decay_weight(¶ms_json, &now)
}
"decay_permits" => {
let params_json = json_arg(req, "params")?;
rj::decay_permits(¶ms_json, &now)
}
"region_contains" => {
let params_json = json_arg(req, "params")?;
rj::region_contains(¶ms_json, &now)
}
"region_attenuates" => {
let params_json = json_arg(req, "params")?;
rj::region_attenuates(¶ms_json, &now)
}
"build_geoscoped_grant" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_geoscoped_grant(&seed, ¶ms_json, &now)
}
"verify_geoscoped_grant" => {
let params_json = json_arg(req, "params")?;
rj::verify_geoscoped_grant(¶ms_json, &now)
}
"geoscope_permits" => {
let params_json = json_arg(req, "params")?;
rj::geoscope_permits(¶ms_json, &now)
}
"build_range_observation" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_range_observation(&seed, ¶ms_json, &now)
}
"verify_range_observation" => {
let params_json = json_arg(req, "params")?;
rj::verify_range_observation(¶ms_json, &now)
}
"count_consistent" => {
let params_json = json_arg(req, "params")?;
rj::count_consistent(¶ms_json, &now)
}
"location_confirmed" => {
let params_json = json_arg(req, "params")?;
rj::location_confirmed(¶ms_json, &now)
}
"build_proof_of_location" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_proof_of_location(&seed, ¶ms_json, &now)
}
"kinematically_reachable" => {
let params_json = json_arg(req, "params")?;
rj::kinematically_reachable(¶ms_json, &now)
}
"within_beam" => {
let params_json = json_arg(req, "params")?;
rj::within_beam(¶ms_json, &now)
}
"build_beam_presence" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_beam_presence(&seed, ¶ms_json, &now)
}
"verify_beam_presence" => {
let params_json = json_arg(req, "params")?;
rj::verify_beam_presence(¶ms_json, &now)
}
"propagate_two_body" => {
let params_json = json_arg(req, "params")?;
rj::propagate_two_body(¶ms_json, &now)
}
"reachable_two_body" => {
let params_json = json_arg(req, "params")?;
rj::reachable_two_body(¶ms_json, &now)
}
"build_perception_claim" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_perception_claim(&seed, ¶ms_json, &now)
}
"verify_perception_claim" => {
let params_json = json_arg(req, "params")?;
rj::verify_perception_claim(¶ms_json, &now)
}
"cross_check_perception" => {
let params_json = json_arg(req, "params")?;
rj::cross_check_perception(¶ms_json, &now)
}
"build_interaction_attestation" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_interaction_attestation(&seed, ¶ms_json, &now)
}
"verify_interaction_attestation" => {
let params_json = json_arg(req, "params")?;
rj::verify_interaction_attestation(¶ms_json, &now)
}
"node_standing" => {
let params_json = json_arg(req, "params")?;
rj::node_standing(¶ms_json, &now)
}
"expected_range_m" => {
let params_json = json_arg(req, "params")?;
rj::expected_range_m(¶ms_json, &now)
}
"radial_velocity_mps" => {
let params_json = json_arg(req, "params")?;
rj::radial_velocity_mps(¶ms_json, &now)
}
"expected_doppler_hz" => {
let params_json = json_arg(req, "params")?;
rj::expected_doppler_hz(¶ms_json, &now)
}
"check_presence" => {
let params_json = json_arg(req, "params")?;
rj::check_presence(¶ms_json, &now)
}
"build_presence_attestation" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_presence_attestation(&seed, ¶ms_json, &now)
}
"verify_presence_attestation" => {
let params_json = json_arg(req, "params")?;
rj::verify_presence_attestation(¶ms_json, &now)
}
"provenance_attestation_id" => {
let params_json = json_arg(req, "params")?;
rj::provenance_attestation_id(¶ms_json, &now)
}
"verify_provenance_chain" => {
let params_json = json_arg(req, "params")?;
rj::verify_provenance_chain(¶ms_json, &now)
}
"build_distress_attestation" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_distress_attestation(&seed, ¶ms_json, &now)
}
"verify_distress_attestation" => {
let params_json = json_arg(req, "params")?;
rj::verify_distress_attestation(¶ms_json, &now)
}
"is_quarantined" => {
let params_json = json_arg(req, "params")?;
rj::is_quarantined(¶ms_json, &now)
}
"build_trust_state_update" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_trust_state_update(&seed, ¶ms_json, &now)
}
"verify_trust_state_update" => {
let params_json = json_arg(req, "params")?;
rj::verify_trust_state_update(¶ms_json, &now)
}
"accept_trust_state_update" => {
let params_json = json_arg(req, "params")?;
rj::accept_trust_state_update(¶ms_json, &now)
}
"build_key_continuity_predelegation" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_key_continuity_predelegation(&seed, ¶ms_json, &now)
}
"build_continuity_approval" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_continuity_approval(&seed, ¶ms_json, &now)
}
"verify_key_continuity" => {
let params_json = json_arg(req, "params")?;
rj::verify_key_continuity(¶ms_json, &now)
}
"preserves_or_narrows" => {
let params_json = json_arg(req, "params")?;
rj::preserves_or_narrows(¶ms_json, &now)
}
"build_robot_identity" => {
let seed = bytes_arg(req, "seed")?;
let params_json = json_arg(req, "params")?;
rj::build_robot_identity(&seed, ¶ms_json, &now)
}
"verify_robot_identity_chain" => {
let params_json = json_arg(req, "params")?;
rj::verify_robot_identity_chain(¶ms_json, &now)
}
"verify_chain_against_head" => {
let params_json = json_arg(req, "params")?;
drop(req_value);
rj::verify_chain_against_head_with(¶ms_json, &now, limits)
}
"validate_safety_summary" => {
let params_json = json_arg(req, "params")?;
rj::validate_safety_summary(¶ms_json, &now)
}
"verify_robotics_credential" => {
let params_json = json_arg(req, "params")?;
let public_key = bytes_arg(req, "publicKey")?;
rj::verify_robotics_credential(¶ms_json, &public_key, &now)
}
"collect_verified" => {
let params_json = json_arg(req, "params")?;
let public_key = bytes_arg(req, "publicKey")?;
rj::collect_verified(¶ms_json, &public_key, &now)
}
"verify_safety_record_params" => {
let params_json = json_arg(req, "params")?;
let public_key = bytes_arg(req, "publicKey")?;
rj::verify_safety_record_params(¶ms_json, &public_key, &now)
}
"verify_conformance_attestation_params" => {
let params_json = json_arg(req, "params")?;
let public_key = bytes_arg(req, "publicKey")?;
rj::verify_conformance_attestation_params(¶ms_json, &public_key, &now)
}
"verify_delegation_lease_params" => {
let params_json = json_arg(req, "params")?;
let public_key = bytes_arg(req, "publicKey")?;
rj::verify_delegation_lease_params(¶ms_json, &public_key, &now)
}
"verify_decommission_params" => {
let params_json = json_arg(req, "params")?;
let public_key = bytes_arg(req, "publicKey")?;
rj::verify_decommission_params(¶ms_json, &public_key, &now)
}
"verify_embodiment_params" => {
let params_json = json_arg(req, "params")?;
let public_key = bytes_arg(req, "publicKey")?;
rj::verify_embodiment_params(¶ms_json, &public_key, &now)
}
"verify_handoff_params" => {
let params_json = json_arg(req, "params")?;
let public_key = bytes_arg(req, "publicKey")?;
rj::verify_handoff_params(¶ms_json, &public_key, &now)
}
"verify_accept_params" => {
let params_json = json_arg(req, "params")?;
let accept_public_key = bytes_arg(req, "acceptPublicKey")?;
rj::verify_accept_params(¶ms_json, &accept_public_key, &now)
}
"trust_policy_is_trusted" => {
let params_json = json_arg(req, "params")?;
Ok(Value::Bool(rj::trust_policy_is_trusted(¶ms_json)?).to_string())
}
"is_live_params" => {
let params_json = json_arg(req, "params")?;
Ok(Value::Bool(rj::is_live_params(¶ms_json, &now)?).to_string())
}
"motion_digest_problem" => {
let params_json = json_arg(req, "params")?;
rj::motion_digest_problem(¶ms_json)
}
"blackbox_append" => {
let key = bytes_arg(req, "key")?;
let nonce = opt_bytes_arg(req, "nonce")?;
let params_json = json_arg(req, "params")?;
rj::blackbox_append(&key, nonce.as_deref().map(|b| &b[..]), ¶ms_json)
}
"scope_problems" => {
let params_json = json_arg(req, "params")?;
rj::scope_problems(¶ms_json)
}
"parse_hm" => {
let params_json = json_arg(req, "params")?;
rj::parse_hm(¶ms_json)
}
"handover_in_envelope" => {
let params_json = json_arg(req, "params")?;
Ok(Value::Bool(rj::handover_in_envelope(¶ms_json)?).to_string())
}
"tier_defaults" => {
let params_json = json_arg(req, "params")?;
rj::tier_defaults(¶ms_json)
}
"evaluate_freshness" => {
let params_json = json_arg(req, "params")?;
rj::evaluate_freshness(¶ms_json, &now)
}
"verify_status_list_signature" => {
let params_json = json_arg(req, "params")?;
Ok(Value::Bool(rj::verify_status_list_signature(¶ms_json, &now)?).to_string())
}
"conformance_profile" => {
let params_json = json_arg(req, "params")?;
rj::conformance_profile(¶ms_json)
}
"verify_log_segment" => {
let entries_json = json_arg(req, "entries")?;
let state_json = opt_json_arg(req, "state")?;
let genesis_prev_hash = opt_str_arg(req, "genesisPrevHash")?;
let state_key = opt_bytes_arg(req, "stateKey")?;
let history = history_arg(req)?;
drop(req_value);
rj::verify_log_segment_with(
&entries_json,
state_json.as_deref(),
genesis_prev_hash.as_deref(),
state_key.as_deref().map(|b| &b[..]),
history.as_deref(),
limits,
)
}
"finish_log_segments" => {
let state_json = json_arg(req, "state")?;
let head_json = opt_json_arg(req, "head")?;
let count_json = opt_json_arg(req, "count")?;
let state_key = opt_bytes_arg(req, "stateKey")?;
let history = history_arg(req)?;
drop(req_value);
rj::finish_log_segments_with(
&state_json,
head_json.as_deref(),
count_json.as_deref(),
state_key.as_deref().map(|b| &b[..]),
history.as_deref(),
limits,
)
}
"finish_log_segments_head" => {
let state_json = json_arg(req, "state")?;
let head_json = json_arg(req, "head")?;
let robot_pub = bytes_arg(req, "robotPub")?;
let issuer_did = opt_str_arg(req, "issuerDid")?;
let state_key = opt_bytes_arg(req, "stateKey")?;
let history = history_arg(req)?;
drop(req_value);
rj::finish_log_segments_head_with(
&state_json,
&head_json,
&robot_pub,
issuer_did.as_deref(),
state_key.as_deref().map(|b| &b[..]),
history.as_deref(),
&now,
limits,
)
}
"check_no_fork_segment" => {
let embodiments_json = json_arg(req, "embodiments")?;
let state_json = opt_json_arg(req, "state")?;
let state_key = opt_bytes_arg(req, "stateKey")?;
let history = history_arg(req)?;
drop(req_value);
rj::check_no_fork_segment_with(
&embodiments_json,
state_json.as_deref(),
state_key.as_deref().map(|b| &b[..]),
history.as_deref(),
limits,
)
}
_ => Err(CoreError::Json(format!(
"no robotics entry point named {name:?}"
))),
}
}
pub const LONG_FACADES: &[&str] = &[
"check_no_fork",
"verify_blackbox_chain",
"verify_blackbox_head",
"verify_chain_against_head",
"verify_perception_log",
"verify_safety_log",
"verify_log_segment",
"finish_log_segments",
"finish_log_segments_head",
"check_no_fork_segment",
];
pub const SEED_FIELDS: &[(&str, &str)] = &[
("mint_robot_identity", "robotSeed"),
("build_provenance_attestation", "signerSeed"),
("build_physical_scope_credential", "signerSeed"),
("build_hello", "signerSeed"),
("build_accept", "signerSeed"),
("build_confirm", "signerSeed"),
("build_killswitch_credential", "authoritySeed"),
("build_blackbox_head", "robotSeed"),
("build_safety_evidence", "signerSeed"),
("build_passport", "signerSeed"),
("build_robot_heartbeat", "robotSeed"),
("attach_credential_status", "signerSeed"),
("build_safety_record", "signerSeed"),
("build_perception_attestation", "robotSeed"),
("build_delegation_lease", "signerSeed"),
("build_action_approval", "approverSeed"),
("build_ownership_transfer", "currentOwnerSeed"),
("build_key_rotation", "oldKeySeed"),
("build_decommission", "signerSeed"),
("build_conformance_attestation", "signerSeed"),
("build_embodiment", "agentSeed"),
("build_handoff", "receiverSeed"),
("build_release", "releaserSeed"),
("build_access_grant", "operatorSeed"),
("build_access_request", "robotSeed"),
("build_fused_attestation", "robotSeed"),
("build_wear_attestation", "robotSeed"),
("build_consent_token", "bystanderSeed"),
("build_consent_evidence", "robotSeed"),
("build_odd_credential", "operatorSeed"),
("build_odd_conformance", "robotSeed"),
("build_human_handover", "robotSeed"),
("build_handover_ack", "recipientSeed"),
("build_validity_root", "authoritySeed"),
("build_swarm_membership", "seed"),
("build_collective_action", "seed"),
("build_control_handoff", "seed"),
("build_revocation_accumulator_root", "seed"),
("build_conditional_revocation", "seed"),
("build_revocation_renewal", "seed"),
("bind_credential_to_bundle", "seed"),
("build_custody_transfer", "seed"),
("build_time_quality_attestation", "seed"),
("build_autonomy_schedule", "seed"),
("build_integrity_risk_attestation", "seed"),
("build_freshness_token", "seed"),
("build_geoscoped_grant", "seed"),
("build_range_observation", "seed"),
("build_proof_of_location", "seed"),
("build_beam_presence", "seed"),
("build_perception_claim", "seed"),
("build_interaction_attestation", "seed"),
("build_presence_attestation", "seed"),
("build_distress_attestation", "seed"),
("build_trust_state_update", "seed"),
("build_key_continuity_predelegation", "seed"),
("build_continuity_approval", "seed"),
("build_robot_identity", "seed"),
];