v0.2.5-pre.009
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-wallet-lib/src/owner.rs
|
||||
// version: 4
|
||||
// version: 5
|
||||
|
||||
/// Authorized OWNER capability handle.
|
||||
///
|
||||
@@ -119,7 +119,7 @@ impl WalletOwner {
|
||||
destination: impl std::convert::AsRef<std::path::Path>,
|
||||
alias: std::option::Option<std::string::String>,
|
||||
) -> ksp_core_lib::Result<()> {
|
||||
let mut payload = crate::payload::MetadataPayloadV1::from_info(&self.info);
|
||||
let mut payload = crate::MetadataPayloadV1::from_info(&self.info);
|
||||
let mutation_result = payload.set_alias(alias);
|
||||
if let std::result::Result::Err(error) = mutation_result {
|
||||
return std::result::Result::Err(error);
|
||||
@@ -133,7 +133,7 @@ impl WalletOwner {
|
||||
destination: impl std::convert::AsRef<std::path::Path>,
|
||||
text: std::string::String,
|
||||
) -> ksp_core_lib::Result<std::string::String> {
|
||||
let mut payload = crate::payload::MetadataPayloadV1::from_info(&self.info);
|
||||
let mut payload = crate::MetadataPayloadV1::from_info(&self.info);
|
||||
let note_id = match payload.add_note(text) {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
@@ -152,7 +152,7 @@ impl WalletOwner {
|
||||
note_id: &str,
|
||||
text: std::string::String,
|
||||
) -> ksp_core_lib::Result<()> {
|
||||
let mut payload = crate::payload::MetadataPayloadV1::from_info(&self.info);
|
||||
let mut payload = crate::MetadataPayloadV1::from_info(&self.info);
|
||||
let mutation_result = payload.update_note(note_id, text);
|
||||
if let std::result::Result::Err(error) = mutation_result {
|
||||
return std::result::Result::Err(error);
|
||||
@@ -162,7 +162,7 @@ impl WalletOwner {
|
||||
|
||||
/// Deletes one protected note selected by its stable identifier.
|
||||
pub async fn delete_note(&mut self, destination: impl std::convert::AsRef<std::path::Path>, note_id: &str) -> ksp_core_lib::Result<()> {
|
||||
let mut payload = crate::payload::MetadataPayloadV1::from_info(&self.info);
|
||||
let mut payload = crate::MetadataPayloadV1::from_info(&self.info);
|
||||
let mutation_result = payload.delete_note(note_id);
|
||||
if let std::result::Result::Err(error) = mutation_result {
|
||||
return std::result::Result::Err(error);
|
||||
@@ -274,7 +274,7 @@ impl WalletOwner {
|
||||
async fn persist_metadata_payload(
|
||||
&mut self,
|
||||
destination: std::path::PathBuf,
|
||||
payload: crate::payload::MetadataPayloadV1,
|
||||
payload: crate::MetadataPayloadV1,
|
||||
operation: &'static str,
|
||||
) -> ksp_core_lib::Result<()> {
|
||||
let (envelope, info) = match self.state.stage_metadata_payload(payload) {
|
||||
@@ -292,6 +292,12 @@ impl WalletOwner {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for WalletOwner {
|
||||
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
return formatter.debug_struct("WalletOwner").field("info", &self.info).field("unlocked_state", &"<redacted>").finish();
|
||||
}
|
||||
}
|
||||
|
||||
async fn persist_staged(
|
||||
destination: std::path::PathBuf,
|
||||
expected_current: &crate::KspWalletEnvelopeV1,
|
||||
@@ -304,12 +310,6 @@ async fn persist_staged(
|
||||
return crate::persistence::replace_wallet_file_v1(destination, expected_current.clone(), serialized).await;
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for WalletOwner {
|
||||
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
return formatter.debug_struct("WalletOwner").field("info", &self.info).field("unlocked_state", &"<redacted>").finish();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "../unit_tests/administration.rs"]
|
||||
mod tests;
|
||||
|
||||
Reference in New Issue
Block a user