Extracts the `appCode` from a full app-data document, if present. `appCode` sits at the document root, next to (not inside) the protocol `metadata`, so it is not part of [`ProtocolAppData`] and callers that want it — e.g. for analytics — parse it separately with this helper. Returns `None` for absent or malformed app data.
(full_app_data: &[u8])
| 306 | /// it — e.g. for analytics — parse it separately with this helper. Returns |
| 307 | /// `None` for absent or malformed app data. |
| 308 | pub fn app_code(full_app_data: &[u8]) -> Option<String> { |
| 309 | #[derive(Deserialize)] |
| 310 | struct AppCode { |
| 311 | #[serde(rename = "appCode")] |
| 312 | app_code: Option<String>, |
| 313 | } |
| 314 | |
| 315 | serde_json::from_slice::<AppCode>(full_app_data) |
| 316 | .ok()? |
| 317 | .app_code |
| 318 | } |
| 319 | |
| 320 | /// The root app data JSON object. |
| 321 | /// |
no test coverage detected