v0.2.6-pre.017

This commit is contained in:
2026-08-22 09:39:13 +02:00
parent 5c0be421da
commit 362123f357
22 changed files with 896 additions and 109 deletions

View File

@@ -1,5 +1,5 @@
// file: crates/ksp-wallet-lib/src/owner.rs
// version: 7
// version: 8
/// Authorized OWNER capability handle.
///
@@ -58,6 +58,29 @@ impl WalletOwner {
return &self.info;
}
/// Returns one short-lived V1 Solana keypair copy for crate-internal authenticated migration.
pub(crate) fn clone_v1_solana_keypair_for_migration(&self) -> ksp_core_lib::Result<solana_keypair::Keypair> {
return match &self.state {
crate::OwnerState::V1(state) => state.clone_solana_keypair_for_migration(),
crate::OwnerState::V2(_) => {
std::result::Result::Err(ksp_core_lib::Error::new(crate::ERROR_CODE_MIGRATION_INVALID, "Wallet migration source is not V1"))
},
};
}
/// Replaces protected metadata exactly in memory during authenticated migration, preserving stable note identifiers.
pub(crate) fn replace_metadata_for_migration(&mut self, payload: crate::MetadataPayloadV1) -> ksp_core_lib::Result<()> {
let (envelope, info) = match self.state.stage_metadata_payload(payload) {
std::result::Result::Ok(value) => value,
std::result::Result::Err(error) => return std::result::Result::Err(error),
};
if let std::result::Result::Err(error) = self.state.apply_envelope(envelope) {
return std::result::Result::Err(error);
}
self.info = info;
return std::result::Result::Ok(());
}
/// Exports the immutable Solana keypair through one explicitly selected transfer adapter.
///
/// The returned bytes contain secret key material and are owned by the caller. Callers should minimize their lifetime and zeroize the buffer after use.