Newer
Older
#ifndef __VEREIGN_IDENTITY_PROVIDER_HH
#define __VEREIGN_IDENTITY_PROVIDER_HH
#include <vereign/kvstore/crypto_storage.hh>
#include <mutex>
namespace vereign::identity {
/**
* Identity provider that manages the locally stored user identity.
*
* All public methods are thread safe.
*/
/**
* Creates Provider instance.
*
* @param storage The crypto storage used for read/write identity properties.
*/
/**
* Default constructor.
*
* Does nothing.
*/
~Provider();
// disable copying
Provider(const kvstore::Storage&) = delete;
auto operator=(const kvstore::Storage&) -> Provider& = delete;
/**
* Replaces the current identity.
*
* @param pin Required only under Linux. The pin code used for derivation of the crypto storage
* master key.
*
* @returns The base64 encoded PEM encoded identity public key.
*/
auto ResetIdentity(const std::string& pin) -> std::string;
/**
* Loads the local identity.
*
* @param pin Required only under Linux. The pin code used for derivation of the crypto storage
* master key.
*
* @returns The base64 encoded PEM encoded identity public key.
*/
auto LoadIdentity(const std::string& pin) -> std::string;
/**
* Retrieve identity public key.
*
* @returns The base64 encoded PEM encoded identity public key.
*/
auto GetIdentityPublicKeyBase64() -> std::string;
/**
* @returns base64 encoded SHA1 hash of the identity public key.
*/
auto GetDeviceHash() -> std::string;