FileTokenStore

A file-backed TokenStore. Tokens for all resources are stored as a single JSON object ({ "<resource>": { ... } }) at path.

Encryption hook: subclass and override serialize/deserialize to encrypt the JSON blob at rest (e.g. with a key from the OS keychain). The plaintext implementation writes the file with owner-only (0600) permissions on POSIX.

Members

Functions

deserialize
Json deserialize(const(ubyte)[] data)

Deserialize bytes read from disk into the token map. Override to decrypt.

serialize
const(ubyte)[] serialize(Json all)

Serialize the full token map to bytes for writing. Override to encrypt.

Variables

path
string path;

The on-disk path of the token file.

Inherited Members

From TokenStore

load
StoredToken load(string resource)

Load the stored token for resource, or a default-constructed StoredToken (hasToken == false) when none is stored.

save
void save(string resource, StoredToken token)

Persist token for resource, replacing any previous value.