solana_security_txt/
lib.rs

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