KeyDerivation class

Makes keys for one purpose from one secret, with HKDF-SHA256 (RFC 5869).

Dox uses APP_KEY for many things: cookies, JWTs, signed URLs. Each one gets its own key, made from APP_KEY and a label. So a value made for one purpose can not be used for another one.

Uint8List key = KeyDerivation.forAppKey(KeyDerivation.jwt);

Constructors

KeyDerivation()

Properties

hashCode → int
The hash code for this object.
no setterinherited
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

Operators

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

Static Methods

derive(String secret, String label) → Uint8List
The 32-byte key for label, made from secret. It is made once per isolate, then read from a cache.
forAppKey(String label) → Uint8List
The 32-byte key for label, made from APP_KEY of the app.
hkdf(List<int> secret, List<int> info, {List<int> salt = const <int>[], int length = 32}) → Uint8List
HKDF-SHA256 of RFC 5869: length bytes made from secret, info and salt. An empty salt is 32 zero bytes, like the RFC says.

Constants

label of the key that encrypts cookies (and the cookie session)
encrypt → const String
label of the key that AESEncryptor uses by default
jwt → const String
label of the key that signs JWTs of dox_auth
signedUrl → const String
label of the key that signs URLs, like the local signed URLs of dox_storage