solana_security_txt/
lib.rs

1#![doc = include_str!("../README.md")]
2
3#[cfg(feature = "parser")]
4mod parser;
5#[cfg(feature = "parser")]
6pub use crate::parser::*;
7
8/// Constant for the beginning of the security.txt file.
9pub const SECURITY_TXT_BEGIN: &str = "=======BEGIN SECURITY.TXT V1=======\0";
10/// Constant for the end of the security.txt file.
11pub const SECURITY_TXT_END: &str = "=======END SECURITY.TXT V1=======\0";
12
13#[macro_export]
14/// Create a static string containing the security.txt file.
15macro_rules! security_txt {
16    ($($name:ident: $value:expr),*) => {
17        #[cfg_attr(target_arch = "bpf", link_section = ".security.txt")]
18        #[allow(dead_code)]
19        #[no_mangle]
20        /// Static string containing the security.txt file.
21        pub static security_txt: &str = concat! {
22            "=======BEGIN SECURITY.TXT V1=======\0",
23            $(stringify!($name), "\0", $value, "\0",)*
24            "=======END SECURITY.TXT V1=======\0"
25        };
26    };
27}