pub struct SandiAN;Implementations§
Source§impl SandiAN
impl SandiAN
Sourcepub fn encode(raw: &str) -> String
pub fn encode(raw: &str) -> String
Mentransformasikan password mentah menjadi Sandi A-N Nusantara ber-envelope $an1$ (Standard Mode)
§Contoh
use pakem::core::security::sandi_an::SandiAN;
let sandi = SandiAN::encode("admin123");
assert!(sandi.starts_with("$an1$"));Sourcepub fn encode_with_key(raw: &str, app_key: &str) -> String
pub fn encode_with_key(raw: &str, app_key: &str) -> String
Mentransformasikan password dengan arsitektur Hybrid Key-Dependent Masking ber-envelope $ank$
Mengunci transformasi ke dalam kunci unik aplikasi (APP_KEY). Tanpa APP_KEY yang sama persis,
permutasi bitwise tidak akan pernah bisa direkonstruksi atau ditebak oleh dekompiler / peretas.
Sourcepub fn decode(encoded: &str) -> Result<String, &'static str>
pub fn decode(encoded: &str) -> Result<String, &'static str>
Mengembalikan string Sandi A-N ke bentuk kata sandi aslinya (Decode Otomatis)
Mendukung format $an1$ standar maupun $ank$ (dengan auto-fallback key dari .env)
Sourcepub fn decode_with_key(
encoded: &str,
app_key: &str,
) -> Result<String, &'static str>
pub fn decode_with_key( encoded: &str, app_key: &str, ) -> Result<String, &'static str>
Mengembalikan string Sandi A-N Hybrid $ank$ menggunakan kunci spesifik app_key
Sourcepub fn is_sandi_an(s: &str) -> bool
pub fn is_sandi_an(s: &str) -> bool
Memeriksa apakah sebuah string adalah format Sandi A-N ($an1$ atau $ank$)
Auto Trait Implementations§
impl Forget for SandiAN
impl Freeze for SandiAN
impl Move for SandiAN
impl RefUnwindSafe for SandiAN
impl Send for SandiAN
impl Sync for SandiAN
impl Unpin for SandiAN
impl UnsafeUnpin for SandiAN
impl UnwindSafe for SandiAN
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more