Files
serai/processor/view-keys/src/lib.rs
Luke Parker d570c1d277 Move additional_key.rs to serai-processor-view-keys
I don't love this. I wanted to simply add this function to `processor/key-gen`,
but then anyone who wants a view key needs to pull in Bulletproofs which is a
mess of code. They'd also be subject to an AGPL licensed library.

This is so small it should be a primitive elsewhere, yet there is no primitives
library eligible. Maybe serai-client since that has the code to make
transactions to Serai (and will have this as a dependency)? Except then the
processor has to import serai-client when this rewrite removed it as a
dependency.
2024-09-19 23:36:32 -07:00

14 lines
412 B
Rust

#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![doc = include_str!("../README.md")]
#![deny(missing_docs)]
use ciphersuite::Ciphersuite;
/// Generate a view key for usage within Serai.
///
/// `k` is the index of the key to generate (enabling generating multiple view keys within a
/// single context).
pub fn view_key<C: Ciphersuite>(k: u64) -> C::F {
C::hash_to_F(b"Serai DEX View Key", &k.to_le_bytes())
}