use miden_protocol::account::component::AccountComponentMetadata;
use miden_protocol::account::{AccountComponent, AccountType};
use crate::account::components::no_auth_library;
pub struct NoAuth;
impl NoAuth {
pub const NAME: &'static str = "miden::standards::components::auth::no_auth";
pub fn new() -> Self {
Self
}
pub fn component_metadata() -> AccountComponentMetadata {
AccountComponentMetadata::new(Self::NAME, AccountType::all())
.with_description("No authentication component")
}
}
impl Default for NoAuth {
fn default() -> Self {
Self::new()
}
}
impl From<NoAuth> for AccountComponent {
fn from(_: NoAuth) -> Self {
let metadata = NoAuth::component_metadata();
AccountComponent::new(no_auth_library(), vec![], metadata)
.expect("NoAuth component should satisfy the requirements of a valid account component")
}
}
#[cfg(test)]
mod tests {
use miden_protocol::account::AccountBuilder;
use super::*;
use crate::account::wallets::BasicWallet;
#[test]
fn test_no_auth_component() {
let _account = AccountBuilder::new([0; 32])
.with_auth_component(NoAuth)
.with_component(BasicWallet)
.build()
.expect("account building failed");
}
}