Skip to content
Snippets Groups Projects
revocation.rs 730 B
Newer Older
Hugo Trentesaux's avatar
Hugo Trentesaux committed
use crate::*;
Hugo Trentesaux's avatar
Hugo Trentesaux committed
// TODO include prefix in RevocationPayload and use below
// use crate::runtime::runtime_types::pallet_identity::types::RevocationPayload;
type EncodedRevocationPayload = Vec<u8>;
pub async fn print_revoc_sig(data: &Data) {
	let (_, signature) = generate_revoc_doc(data).await;
Hugo Trentesaux's avatar
Hugo Trentesaux committed
	println!("revocation payload signature");
	println!("0x{}", hex::encode(signature));
}

pub async fn generate_revoc_doc(data: &Data) -> (EncodedRevocationPayload, sr25519::Signature) {
Hugo Trentesaux's avatar
Hugo Trentesaux committed
	let payload = (b"revo", data.genesis_hash, data.idty_index()).encode();
	let KeyPair::Sr25519(keypair) = data.keypair().await else {
		panic!("Cesium keys not implemented there")
	};
	let signature = keypair.sign(&payload);
Hugo Trentesaux's avatar
Hugo Trentesaux committed
	(payload, signature)