v0.2.5-pre.005
This commit is contained in:
@@ -1,15 +1,20 @@
|
||||
// file: crates/ksp-wallet-lib/src/view.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
/// Authorized VIEW capability handle.
|
||||
///
|
||||
/// VIEW exposes protected metadata and, in later `0.2.5` tranches, will expose only self-rotation of its VIEW password. It never owns the Solana secret or
|
||||
/// OWNER administration material.
|
||||
/// VIEW exposes protected metadata and retains only the authenticated metadata capability needed for its future self-service password rotation. It never
|
||||
/// owns the Solana secret or OWNER administration material.
|
||||
pub struct WalletView {
|
||||
info: crate::WalletInfo,
|
||||
state: crate::wallet::ViewStateV1,
|
||||
}
|
||||
|
||||
impl WalletView {
|
||||
pub(crate) fn from_unlocked(info: crate::WalletInfo, state: crate::wallet::ViewStateV1) -> Self {
|
||||
return Self { info, state };
|
||||
}
|
||||
|
||||
/// Returns the authorization capability represented by this handle.
|
||||
#[must_use]
|
||||
pub const fn capability(&self) -> crate::WalletCapability {
|
||||
@@ -45,10 +50,15 @@ impl WalletView {
|
||||
);
|
||||
return &self.info;
|
||||
}
|
||||
|
||||
/// Serializes the unchanged locked `.kspwallet` V1 document without exposing the metadata content key.
|
||||
pub fn to_json_bytes(&self) -> ksp_core_lib::Result<std::vec::Vec<u8>> {
|
||||
return self.state.envelope().to_json_bytes();
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for WalletView {
|
||||
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
return formatter.debug_struct("WalletView").field("info", &self.info).finish();
|
||||
return formatter.debug_struct("WalletView").field("info", &self.info).field("unlocked_state", &"<redacted>").finish();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user