SecretKeyData class

A SecretKey that is stored in memory.

The bytes can be accessed with bytes. The bytes can be destroyed with destroy. After calling destroy, the bytes are no longer accessible and the getter bytes will throw StateError.

Inheritance
Annotations
  • @sealed

Constructors

SecretKeyData(List<int> bytes, {bool overwriteWhenDestroyed = false, String? debugLabel})
Constructs a secret key with the given bytes.
SecretKeyData.random({required int length, Uint8List? bytes, Random? random, String? debugLabel})
Generates N random bytes.
factory
SecretKeyData.randomWithBuffer(Uint8List bytes, {Random? random, bool overwriteWhenDestroyed = true, String? debugLabel})
factory

Properties

allowDecrypt bool
Whether decryption is allowed with this key.
no setterinherited
allowEncrypt bool
Whether encryption is allowed with this key.
no setterinherited
bytes List<int>
In-memory bytes of the secret key.
no setter
debugLabel String?
Debug label for the key.
final
hasBeenDestroyed bool
Whether the secret key has been destroyed with destroy.
no setter
hashCode int
The hash code for this object.
no setteroverride
isDestroyed bool
Whether destroy has been called.
no setterinherited
isExtractable bool
Whether extract will succeed.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copy() SecretKeyData
Returns a copy of this object.
destroy() → void
Overwrites the bytes with zeroes and discards the reference to them.
override
extract() Future<SecretKeyData>
Returns SecretKeyData.
override
extractBytes() Future<List<int>>
Returns bytes of the secret key.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override