Skip to content
Snippets Groups Projects
revocation.rs 633 B
Newer Older
Hugo Trentesaux's avatar
Hugo Trentesaux committed
use crate::*;
use sp_core::sr25519::Signature;
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>;
Hugo Trentesaux's avatar
Hugo Trentesaux committed
pub fn print_revoc_sig(data: &Data) {
Hugo Trentesaux's avatar
Hugo Trentesaux committed
	let (_, signature) = generate_revoc_doc(data);
	println!("revocation payload signature");
	println!("0x{}", hex::encode(signature));
}

Hugo Trentesaux's avatar
Hugo Trentesaux committed
pub fn generate_revoc_doc(data: &Data) -> (EncodedRevocationPayload, Signature) {
	let payload = (b"revo", data.genesis_hash, data.idty_index()).encode();
	let signature = data.keypair().sign(&payload);
Hugo Trentesaux's avatar
Hugo Trentesaux committed
	(payload, signature)