Skip to main content Link Search Menu Expand Document (external link)

4.1 Keystore

As stated in the Threat Model, Keystore is a trusted server where users can publish their public keys. You can assume that attackers cannot overwrite any entry you add to the Keystore.

Keystore is structured as a key-value store. In this context, key refers to an unique identifier that is used to index the value in the database, and does not refer to a crypographic key.

Keystore is designed to store only public encryption/verification keys. For all other types of data, consider using Datastore.

An implementation of Keystore is provided for you (see userlib) and is already imported into client.go.

The client application can interact with Keystore using the API documented below.


KeystoreSet

userlib.KeystoreSet(key string, value PKEEncKey/DSVerifyKey) (err error)

Stores the given value (public cryptographic key) at the given storage key.

Key-value entries into Keystore are immutable. Any attempt to modify an existing key-value entry will return an error.

Parameters
key (string) – Unique identifier used to index value in the keystore
value (PKEEncKey/DSVerifyKey) – Public (cryptographic) encryption/verification key
Return

err (error)


KeystoreGet

userlib.KeystoreGet(key string) (value PKEEncKey/DSVerifyKey, ok bool)

Return the value (public cryptographic key) at the given storage key.

If a value does exist at the given storage key, then ok will be true; otherwise it will be false.

Parameters
key (string) – Unique identifier used to index value in the keystore
Return

value (PKEEncKey/DSVerifyKey), ok (bool)