I am trying to integrate security.txt https://github.com/neodyme-labs/solana-security-txt into a project, and while from the repo it is clear how to access it from rust, I am at a loss as to how to do this in either python or javascript.
I can see the solana python library includes the parsing functionality for this, but I have no idea how to get to the program data from within python.
In rust you have to jump through a few hoops:
let program_account = client.get_account(&pubkey)
let program: UpgradeableLoaderState = bincode::deserialize_from(&program_account.data[..])?;
let program_data_address = if let UpgradeableLoaderState::Program {
programdata_address,
} = program
{
programdata_address
} else {
return Ok(());
};
let program_data_account = client.get_account(&program_data_address);
let offset = UpgradeableLoaderState::programdata_data_offset()?;
let program_data = &program_data_account.data[offset..];
let security_txt = solana_security_txt::find_and_parse(program_data)?;
println!("{}", security_txt);
but in python I really have no idea how to do all this stuff.. has anyone been able to do this?
Thanks