miden_standards/account/auth/
no_auth.rs1use miden_protocol::account::AccountComponent;
2use miden_protocol::account::component::AccountComponentMetadata;
3
4use crate::account::components::no_auth_library;
5
6pub struct NoAuth;
21
22impl NoAuth {
23 pub const NAME: &'static str = "miden::auth::no_auth";
25
26 pub fn new() -> Self {
28 Self
29 }
30}
31
32impl Default for NoAuth {
33 fn default() -> Self {
34 Self::new()
35 }
36}
37
38impl From<NoAuth> for AccountComponent {
39 fn from(_: NoAuth) -> Self {
40 let metadata = AccountComponentMetadata::new(NoAuth::NAME)
41 .with_description("No authentication component")
42 .with_supports_all_types();
43
44 AccountComponent::new(no_auth_library(), vec![], metadata)
45 .expect("NoAuth component should satisfy the requirements of a valid account component")
46 }
47}
48
49#[cfg(test)]
50mod tests {
51 use miden_protocol::account::AccountBuilder;
52
53 use super::*;
54 use crate::account::wallets::BasicWallet;
55
56 #[test]
57 fn test_no_auth_component() {
58 let _account = AccountBuilder::new([0; 32])
60 .with_auth_component(NoAuth)
61 .with_component(BasicWallet)
62 .build()
63 .expect("account building failed");
64 }
65}