1use kdk_entropy::{dice_to_entropy, Dice, EntropyError};
2use kdk_zeroize::SensitiveBytes;
3
4use crate::error::MnemonicError;
5use crate::game::{GameMnemonic, SensitiveGame};
6
7pub type DiceMnemonic<const FACES: u8, const W: u8> = GameMnemonic<Dice<FACES>, W>;
10
11impl<const FACES: u8> SensitiveGame for Dice<FACES> {
12 fn to_entropy<const N: usize>(input: &[u8]) -> Result<SensitiveBytes<N, Self>, EntropyError> {
13 dice_to_entropy::<FACES, N>(input)
14 }
15}
16
17pub fn dice_mnemonic<const FACES: u8, const W: u8>(
31 rolls: &[u8],
32) -> Result<DiceMnemonic<FACES, W>, MnemonicError> {
33 <Dice<FACES> as SensitiveGame>::mnemonic::<W>(rolls)
34}