[repo] Undo cargo fmt churn in files this branch does not change; CLAUDE.md: the trap
This commit is contained in:
@@ -48,21 +48,11 @@ const PHONE_APPROVAL: &[u8] = b"custos phone approval v1";
|
||||
#[derive(Deserialize)]
|
||||
#[serde(tag = "kind", rename_all = "snake_case", rename_all_fields = "camelCase")]
|
||||
enum FactorIn {
|
||||
Password {
|
||||
password: SecretString,
|
||||
},
|
||||
Password { password: SecretString },
|
||||
/// A factor service's or a device's answer, sealed to a key from `recipient` (`pub`) for `context`.
|
||||
Sealed {
|
||||
factor: FactorKind,
|
||||
r#pub: String,
|
||||
sealed: String,
|
||||
context: String,
|
||||
},
|
||||
Sealed { factor: FactorKind, r#pub: String, sealed: String, context: String },
|
||||
/// Material the page holds itself: a passkey's PRF output (base64).
|
||||
Material {
|
||||
factor: FactorKind,
|
||||
material: SecretString,
|
||||
},
|
||||
Material { factor: FactorKind, material: SecretString },
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@@ -436,12 +426,8 @@ pub fn handle(request: &[u8]) -> Value {
|
||||
}
|
||||
Request::DomiPair { r#pub, id, label, device } => {
|
||||
let device_ok = data_encoding::BASE64URL_NOPAD.decode(device.as_bytes()).is_ok_and(|d| d.len() == 32);
|
||||
let id_ok = !id.is_empty()
|
||||
&& id.len() <= 64
|
||||
&& id.bytes().all(|b| b.is_ascii_alphanumeric() || b == b'-' || b == b'_');
|
||||
let (Some(public), true, true) = (b64(&r#pub), device_ok, id_ok) else {
|
||||
return err("A malformed request.");
|
||||
};
|
||||
let id_ok = !id.is_empty() && id.len() <= 64 && id.bytes().all(|b| b.is_ascii_alphanumeric() || b == b'-' || b == b'_');
|
||||
let (Some(public), true, true) = (b64(&r#pub), device_ok, id_ok) else { return err("A malformed request.") };
|
||||
let label: String = label.trim().chars().filter(|c| !c.is_control()).take(40).collect();
|
||||
let plain = json!({ "label": label, "device": device }).to_string();
|
||||
match custos_seal::seal(&public, format!("domi-pair:{id}").as_bytes(), plain.as_bytes()) {
|
||||
|
||||
Reference in New Issue
Block a user