ZenithSecureBytes class

A secure byte buffer that wraps a Uint8List and implements Zeroizable.

When zeroize is called (e.g. on scope disposal with purgeZeroize: true), all bytes in the underlying buffer are overwritten with 0x00. After zeroization, bytes returns a zero-filled view and isZeroized is true.

final token = ZenithSecureBytes(Uint8List.fromList([0xDE, 0xAD, 0xBE, 0xEF]));
userScope.container.getOrCreate(ZenithKey('token'), (_) => token);

manager.endScope('user_secure', purgeZeroize: true);

assert(token.isZeroized);                          // true
assert(token.bytes.every((b) => b == 0));          // true
Implemented types

Constructors

ZenithSecureBytes(Uint8List rawBytes)
Creates a ZenithSecureBytes wrapping rawBytes.

Properties

bytes → Uint8List
The raw byte buffer.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isZeroized → bool
Whether this object has already been zeroized.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
zeroize() → void
Overwrites the sensitive data with zero bytes.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited