2023-07-24 15:36:35 -04:00
|
|
|
use ciphersuite::Ciphersuite;
|
|
|
|
|
|
2023-07-30 16:11:30 -04:00
|
|
|
use crate::networks::Network;
|
2023-07-24 15:36:35 -04:00
|
|
|
|
|
|
|
|
// Generate a static additional key for a given chain in a globally consistent manner
|
|
|
|
|
// Doesn't consider the current group key to increase the simplicity of verifying Serai's status
|
|
|
|
|
// Takes an index, k, to support protocols which use multiple secondary keys
|
|
|
|
|
// Presumably a view key
|
2023-07-30 16:11:30 -04:00
|
|
|
pub fn additional_key<N: Network>(k: u64) -> <N::Curve as Ciphersuite>::F {
|
|
|
|
|
<N::Curve as Ciphersuite>::hash_to_F(
|
2023-07-24 15:36:35 -04:00
|
|
|
b"Serai DEX Additional Key",
|
2023-07-30 16:11:30 -04:00
|
|
|
&[N::ID.as_bytes(), &k.to_le_bytes()].concat(),
|
2023-07-24 15:36:35 -04:00
|
|
|
)
|
|
|
|
|
}
|