this repo has no description
1
fork

Configure Feed

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

Accept camelCase aliases on LegacySession and Identity

Two pre-existing test failures boiled down to the same root cause:
the wire format for atproto lexicon records is camelCase, but the
serde structs were declared snake_case only. Tests exercising legacy
login and identity-file migration therefore failed on deserialization
with "missing field `access_jwt`" / "missing field `public_key`".

Adding `#[serde(alias = ...)]` on each affected field lets the
structs accept either form on read while still emitting the canonical
snake_case name on write. That means:

- Legacy session parsing (createSession / refreshSession) now works
against real PDS responses, not just test fixtures that pre-shaped
the JSON into snake_case.
- Identity files written by an older version in camelCase (the
format the migration test assumes) load cleanly; files written
today stay snake_case, so the on-disk format doesn't churn.

Confirmed `cargo test -p opake-core --lib` (571 pass) and
`cargo test -p opake-cli` (103 pass) both green — the two failures
flagged during the Identity refactor now resolve.

+16 -5
+8
crates/opake-core/src/client/xrpc/mod.rs
··· 37 37 } 38 38 39 39 /// Legacy password-based session (createSession / refreshSession). 40 + /// 41 + /// The atproto lexicon wire format uses camelCase (`accessJwt`, 42 + /// `refreshJwt`); local storage historically used snake_case. Aliases on 43 + /// both fields let the same struct parse either without maintaining 44 + /// separate DTOs. Serialization always emits the primary (snake_case) 45 + /// name so files written today stay consistent with older storage. 40 46 #[derive(Clone, crate::RedactedDebug, Serialize, Deserialize)] 41 47 pub struct LegacySession { 42 48 pub did: String, 43 49 pub handle: String, 44 50 #[redact] 51 + #[serde(alias = "accessJwt")] 45 52 pub access_jwt: String, 46 53 #[redact] 54 + #[serde(alias = "refreshJwt")] 47 55 pub refresh_jwt: String, 48 56 } 49 57
+8 -5
crates/opake-core/src/storage.rs
··· 128 128 129 129 /// Encryption + signing keypairs, stored as base64. 130 130 /// 131 - /// Encryption + signing keypairs, stored as base64. 132 - /// 133 131 /// `#[redact]` fields are zeroized on drop automatically (via RedactedDebug). 134 - /// The signing fields are optional for backward compat with old identity files. 132 + /// The signing fields are optional for backward compat with old identity 133 + /// files. Field aliases accept both snake_case (the primary, canonical 134 + /// serialization) and camelCase — older identity files on disk used the 135 + /// camelCase form, so the migration path relies on the aliases. 135 136 #[derive(crate::RedactedDebug, Serialize, Deserialize)] 136 137 pub struct Identity { 137 138 pub did: String, 139 + #[serde(alias = "publicKey")] 138 140 pub public_key: String, 139 141 #[redact] 142 + #[serde(alias = "privateKey")] 140 143 pub private_key: String, 141 144 /// Ed25519 signing secret key (base64). 142 - #[serde(default)] 145 + #[serde(default, alias = "signingKey")] 143 146 #[redact] 144 147 pub signing_key: Option<String>, 145 148 /// Ed25519 signing public/verify key (base64). 146 - #[serde(default)] 149 + #[serde(default, alias = "verifyKey")] 147 150 pub verify_key: Option<String>, 148 151 } 149 152