mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
monero: only mask user features on new polyseed, not on decode (#503)
* monero: only mask user features on new polyseed, not on decode - This commit ensures a polyseed string that has unsupported features correctly errors on decode (rather than panic in debug build or return an incorrect successful response in prod build) - Also avoids panicking when checksum calculation is unexpectedly wrong Polyseed reference impl for feature masking: - polyseed_create:b7c35bb3c6/src/polyseed.c (L61)- polyseed_decode:b7c35bb3c6/src/polyseed.c (L212)* PR comments * Make from_internal a member of Polyseed * Add accidentally removed newline --------- Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
@@ -7,7 +7,7 @@ use curve25519_dalek::scalar::Scalar;
|
||||
use crate::{
|
||||
hash,
|
||||
wallet::seed::{
|
||||
Seed, SeedType,
|
||||
Seed, SeedType, SeedError,
|
||||
classic::{self, trim_by_lang},
|
||||
polyseed,
|
||||
},
|
||||
@@ -469,3 +469,13 @@ fn test_polyseed() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_invalid_polyseed() {
|
||||
// This seed includes unsupported features bits and should error on decode
|
||||
let seed = "include domain claim resemble urban hire lunch bird \
|
||||
crucial fire best wife ring warm ignore model"
|
||||
.into();
|
||||
let res = Seed::from_string(Zeroizing::new(seed));
|
||||
assert_eq!(res, Err(SeedError::UnsupportedFeatures));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user