Skip to content
Snippets Groups Projects

fix(identity): should be able to revoke idty with old key until ChangeOwnerKeyPeriod

Merged Éloïs requested to merge elois-revoc-with-old-key into master
2 files
+ 101
10
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -495,8 +495,11 @@ pub mod pallet {
@@ -495,8 +495,11 @@ pub mod pallet {
let idty_value = Identities::<T>::get(idty_index).ok_or(Error::<T>::IdtyNotFound)?;
let idty_value = Identities::<T>::get(idty_index).ok_or(Error::<T>::IdtyNotFound)?;
ensure!(
ensure!(
if let Some((ref old_owner_key, _)) = idty_value.old_owner_key {
if let Some((ref old_owner_key, last_change)) = idty_value.old_owner_key {
revocation_key == idty_value.owner_key || &revocation_key == old_owner_key
revocation_key == idty_value.owner_key
 
|| (&revocation_key == old_owner_key
 
&& frame_system::Pallet::<T>::block_number()
 
< last_change + T::ChangeOwnerKeyPeriod::get())
} else {
} else {
revocation_key == idty_value.owner_key
revocation_key == idty_value.owner_key
},
},
@@ -516,7 +519,7 @@ pub mod pallet {
@@ -516,7 +519,7 @@ pub mod pallet {
ensure!(
ensure!(
(REVOCATION_PAYLOAD_PREFIX, revocation_payload)
(REVOCATION_PAYLOAD_PREFIX, revocation_payload)
.using_encoded(|bytes| revocation_sig.verify(bytes, &idty_value.owner_key)),
.using_encoded(|bytes| revocation_sig.verify(bytes, &revocation_key)),
Error::<T>::InvalidRevocationSig
Error::<T>::InvalidRevocationSig
);
);
Loading