Skip to content

Commit 1972351

Browse files
authored
Change LocalData timestamp fields from u32 to DateTime<Utc> to support JavaScript timestamps (#214)
## 🎟️ Tracking <!-- Paste the link to the Jira or GitHub issue or otherwise describe / point to where this change is coming from. --> ## 📔 Objective This PR updates the LocalData and LocalDataView structs to use DateTime<Utc> instead of u32 for timestamp fields (lastUsedDate and lastLaunched). The timestamp sent from the TS client can exceed the u32 max value, which throws an error. <!-- Describe what the purpose of this PR is, for example what bug you're fixing or new feature you're adding. --> ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
1 parent 7a4974b commit 1972351

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

crates/bitwarden-vault/src/cipher/local_data.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use bitwarden_core::key_management::{KeyIds, SymmetricKeyId};
22
use bitwarden_crypto::{CryptoError, Decryptable, Encryptable, KeyStoreContext};
3+
use chrono::{DateTime, Utc};
34
use schemars::JsonSchema;
45
use serde::{Deserialize, Serialize};
56
#[cfg(feature = "wasm")]
@@ -10,17 +11,17 @@ use tsify_next::Tsify;
1011
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
1112
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
1213
pub struct LocalData {
13-
last_used_date: Option<u32>,
14-
last_launched: Option<u32>,
14+
last_used_date: Option<DateTime<Utc>>,
15+
last_launched: Option<DateTime<Utc>>,
1516
}
1617

1718
#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
1819
#[serde(rename_all = "camelCase", deny_unknown_fields)]
1920
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))]
2021
#[cfg_attr(feature = "wasm", derive(Tsify), tsify(into_wasm_abi, from_wasm_abi))]
2122
pub struct LocalDataView {
22-
last_used_date: Option<u32>,
23-
last_launched: Option<u32>,
23+
last_used_date: Option<DateTime<Utc>>,
24+
last_launched: Option<DateTime<Utc>>,
2425
}
2526

2627
impl Encryptable<KeyIds, SymmetricKeyId, LocalData> for LocalDataView {

0 commit comments

Comments
 (0)