+ * @brief Context for a database backend
+ */
+struct onak_dbctx {
+/**
+ * @brief De-initialize the key database.
+ *
+ * This function should be called upon program exit to allow the DB to
+ * cleanup after itself.
+ */
+ void (*cleanupdb)(struct onak_dbctx *);
+
+/**
+ * @brief Start a transaction.
+ *
+ * Start a transaction. Intended to be used if we're about to perform many
+ * operations on the database to help speed it all up, or if we want
+ * something to only succeed if all relevant operations are successful.
+ */
+ bool (*starttrans)(struct onak_dbctx *);
+
+/**
+ * @brief End a transaction.
+ *
+ * Ends a transaction.
+ */
+ void (*endtrans)(struct onak_dbctx *);
+
+/**
+ * @brief Given a keyid fetch the key from storage.
+ * @param keyid The keyid to fetch.
+ * @param publickey A pointer to a structure to return the key in.
+ * @param intrans If we're already in a transaction.
+ *
+ * This function returns a public key from whatever storage mechanism we
+ * are using.
+ *
+ * TODO: What about keyid collisions? Should we use fingerprint instead?
+ */
+ int (*fetch_key_id)(struct onak_dbctx *,
+ uint64_t keyid,
+ struct openpgp_publickey **publickey,
+ bool intrans);
+
+/**
+ * @brief Given a fingerprint fetch the key from storage.
+ * @param fp The fingerprint to fetch.
+ * @param fpsize Number of bytes in the fingerprint (16 for v3, 20 for v4)
+ * @param publickey A pointer to a structure to return the key in.
+ * @param intrans If we're already in a transaction.