Skip to content

Commit

Permalink
add UX flow dedicated to the 'churn' operation
Browse files Browse the repository at this point in the history
  • Loading branch information
bunnie committed Jul 19, 2022
1 parent 0a4702d commit e40a109
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions services/pddb/locales/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
"zh": "⚠ PDDB 需要重新加密。⚠\n为了安全地执行此操作,您现在必须解锁所有秘密基地。 任何被锁定的基础都可以被覆盖。",
"en-tts": "⚠ PDDB needs to be keyed to this device. ⚠\nYou must enumerate all secret Bases now. Any Basis not disclosed could be overwritten."
},
"pddb.churn.request": {
"en": "⚠ PDDB `churn` requested. ⚠\nYou must enumerate all secret Bases now. Any Basis not disclosed could be overwritten.",
"ja": "⚠ PDDBの「チャーン」が要求されました。 ⚠\nこれを安全に行うには、今すぐすべてのシークレットベースのロックを解除する必要があります。 ロックされたままのベーシスは上書きされる可能性があります。",
"zh": "⚠ 请求 PDDB `churn`。⚠\n为了安全地执行此操作,您现在必须解锁所有秘密基地。 任何被锁定的基础都可以被覆盖。",
"en-tts": "⚠ PDDB `churn` requested. ⚠\nYou must enumerate all secret Bases now. Any Basis not disclosed could be overwritten."
},
"pddb.freespace.enumerate": {
"en": "Enumerate a Basis?",
"ja": "根拠を開示しますか?",
Expand Down Expand Up @@ -71,6 +77,12 @@
"zh": "继续重新加密?",
"en-tts": "Enumeration finished.\n\nShall we proceed to rekeying?"
},
"pddb.churn.finished": {
"en": "Enumeration finished.\n\nShall we proceed to churning? This process takes about 20 minutes.",
"ja": "列挙が終了しました。\n\n攪拌に進みましょうか? このプロセスには約20分かかります。",
"zh": "枚举完成。\n\n我们要继续搅拌吗? 这个过程大约需要 20 分钟。",
"en-tts": "Enumeration finished.\n\nShall we proceed to churning? This process takes about 20 minutes."
},
"pddb.okay": {
"en": "Okay",
"ja": "OK",
Expand Down
8 changes: 6 additions & 2 deletions services/pddb/src/backend/hw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ impl Deref for StaticCryptoData {
#[derive(Eq, PartialEq)]
enum DnaMode {
Normal,
Churn,
Migration,
}
#[derive(Zeroize)]
Expand Down Expand Up @@ -685,7 +686,7 @@ impl PddbOs {
aad.extend_from_slice(PDDB_FAST_SPACE_SYSTEM_BASIS.as_bytes());
aad.extend_from_slice(&PDDB_VERSION.to_le_bytes());
match self.dna_mode {
DnaMode::Normal => aad.extend_from_slice(&self.dna.to_le_bytes()),
DnaMode::Normal | DnaMode::Churn => aad.extend_from_slice(&self.dna.to_le_bytes()),
DnaMode::Migration => aad.extend_from_slice(&self.migration_dna.to_le_bytes()),
}
}
Expand Down Expand Up @@ -1237,7 +1238,7 @@ impl PddbOs {
aad.extend_from_slice(&name.as_bytes());
aad.extend_from_slice(&PDDB_VERSION.to_le_bytes());
match self.dna_mode {
DnaMode::Normal => aad.extend_from_slice(&self.dna.to_le_bytes()),
DnaMode::Normal | DnaMode::Churn => aad.extend_from_slice(&self.dna.to_le_bytes()),
DnaMode::Migration => aad.extend_from_slice(&self.migration_dna.to_le_bytes()),
}
aad
Expand Down Expand Up @@ -1854,6 +1855,7 @@ impl PddbOs {
log::info!("migrating from dna 0x{:x} -> 0x{:x}", self.migration_dna, self.dna);
self.fast_space_read(); // we hawe to re-read the FSCB, because it would have failed previously with lots of warnings
},
PddbRekeyOp::Churn => self.dna_mode = DnaMode::Churn,
_ => (),
};

Expand Down Expand Up @@ -2113,6 +2115,7 @@ impl PddbOs {
match self.dna_mode {
DnaMode::Normal => t!("pddb.freespace.request", xous::LANG),
DnaMode::Migration => t!("pddb.rekey.request", xous::LANG),
DnaMode::Churn => t!("pddb.churn.request", xous::LANG),
},
None).ok();
self.tt.sleep_ms(SWAP_DELAY_MS).unwrap();
Expand Down Expand Up @@ -2194,6 +2197,7 @@ impl PddbOs {
match self.dna_mode {
DnaMode::Normal => t!("pddb.freespace.finished", xous::LANG),
DnaMode::Migration => t!("pddb.rekey.finished", xous::LANG),
DnaMode::Churn => t!("pddb.churn.finished", xous::LANG),
}) {
Some(ret)
} else {
Expand Down

0 comments on commit e40a109

Please sign in to comment.