miden_objects/decoded/
account_file.rs1pub use proto::account_file::DecodedAuthSecretKey as AuthSecretKey;
4
5use crate::decoded::VerificationError;
6use crate::{Verify, proto};
7
8#[cfg(test)]
9mod tests;
10
11impl Verify for AuthSecretKey {
13 type Verified = miden_protocol::account::auth::AuthSecretKey;
14 type Error = core::convert::Infallible;
15 fn verify(self) -> Result<Self::Verified, Self::Error> {
16 use proto::account_file::auth_secret_key::DecodedKey;
17
18 Ok(match self.key {
19 DecodedKey::Falcon512Poseidon2(key) => {
20 Self::Verified::Falcon512Poseidon2(key.into_inner())
21 },
22 DecodedKey::EcdsaK256Keccak(key) => Self::Verified::EcdsaK256Keccak(key.into_inner()),
23 })
24 }
25}
26
27pub use proto::account_file::DecodedAccountFile as AccountFile;
28
29impl Verify for AccountFile {
30 type Verified = crate::account_file::AccountFile;
31 type Error = VerificationError;
32 fn verify(self) -> Result<Self::Verified, Self::Error> {
33 match self.version {
34 proto::account_file::account_file::DecodedVersion::V1(file) => file.verify(),
35 }
36 }
37}
38
39pub use proto::account_file::DecodedAccountFileV1 as AccountFileV1;
40
41impl Verify for AccountFileV1 {
42 type Verified = crate::account_file::AccountFile;
43 type Error = VerificationError;
44 fn verify(self) -> Result<Self::Verified, Self::Error> {
45 Ok(Self::Verified::new(
46 self.account.verify()?,
47 self.auth_secret_keys.verify_infallible(),
48 ))
49 }
50}