Ring Daemon 16.0.0
Loading...
Searching...
No Matches
jami::ServerAccountManager Class Reference

#include <server_account_manager.h>

Inheritance diagram for jami::ServerAccountManager:
Inheritance graph
Collaboration diagram for jami::ServerAccountManager:
Collaboration graph

Classes

struct  ServerAccountCredentials
 

Public Types

using SyncBlueprintCallback = std::function< void(const std::map< std::string, std::string > &config)>
 
- Public Types inherited from jami::AccountManager
enum class  AddDeviceError { INVALID_URI = -1 , ALREADY_LINKING = -2 , GENERIC = -3 }
 
enum class  AuthError { UNKNOWN , INVALID_ARGUMENTS , SERVER_ERROR , NETWORK }
 
using AuthFailureCallback = std::function< void(AuthError error, const std::string &message)>
 
using AuthSuccessCallback = std::function< void(const AccountInfo &info, const std::map< std::string, std::string > &config, std::string &&receipt, std::vector< uint8_t > &&receipt_signature)>
 
using CertRequest = std::future< std::unique_ptr< dht::crypto::CertificateRequest > >
 
using clock = std::chrono::system_clock
 
using DeviceSyncCallback = std::function< void(DeviceSync &&syncData)>
 
using LookupCallback = NameDirectory::LookupCallback
 
using OnChangeCallback = ContactList::OnChangeCallback
 
using OnDeviceAnnouncedCb = std::function< void()>
 
using OnNewDeviceCb = std::function< void(const std::shared_ptr< dht::crypto::Certificate > &)>
 
using PeerCertificateCb = std::function< void(const std::shared_ptr< dht::crypto::Certificate > &crt, const dht::InfoHash &peer_account)>
 
using PrivateKey = std::shared_future< std::shared_ptr< dht::crypto::PrivateKey > >
 
using RegistrationCallback = NameDirectory::RegistrationCallback
 
using RevokeDeviceCallback = std::function< void(RevokeDeviceResult)>
 
enum class  RevokeDeviceResult { SUCCESS = 0 , ERROR_CREDENTIALS , ERROR_NETWORK }
 
using SearchCallback = NameDirectory::SearchCallback
 
using SearchResponse = NameDirectory::Response
 
using SearchResult = NameDirectory::SearchResult
 
using time_point = clock::time_point
 

Public Member Functions

bool changePassword (const std::string &, const std::string &) override
 
void initAuthentication (PrivateKey request, std::string deviceName, std::unique_ptr< AccountCredentials > credentials, AuthSuccessCallback onSuccess, AuthFailureCallback onFailure, const OnChangeCallback &onChange) override
 
void onNeedsMigration (std::function< void()> cb)
 
void registerName (const std::string &name, std::string_view scheme, const std::string &password, RegistrationCallback cb) override
 
bool revokeDevice (const std::string &device, std::string_view scheme, const std::string &password, RevokeDeviceCallback cb) override
 
bool searchUser (const std::string &query, SearchCallback cb) override
 
 ServerAccountManager (const std::string &accountId, const std::filesystem::path &path, const std::string &managerHostname, const std::string &nameServer)
 
void syncBlueprintConfig (SyncBlueprintCallback onSuccess)
 
void syncDevices () override
 
- Public Member Functions inherited from jami::AccountManager
bool acceptTrustRequest (const std::string &from, bool includeConversation=true)
 
 AccountManager (const std::string &accountId, const std::filesystem::path &path, const std::string &nameServer)
 
bool addContact (const dht::InfoHash &uri, bool confirmed=false, const std::string &conversationId="")
 Add contact to the account contact list.
 
virtual int32_t addDevice (const std::string &, std::string_view, AuthChannelHandler *)
 Initiates the process of adding a new device to the account.
 
CertRequest buildRequest (PrivateKey fDeviceKey)
 
virtual bool cancelAddDevice (uint32_t)
 
dhtnet::tls::CertificateStore & certStore () const
 
virtual bool confirmAddDevice (uint32_t)
 
bool discardTrustRequest (const std::string &from)
 
virtual bool findCertificate (const dht::InfoHash &h, std::function< void(const std::shared_ptr< dht::crypto::Certificate > &)> &&cb={})
 
virtual bool findCertificate (const dht::PkId &h, std::function< void(const std::shared_ptr< dht::crypto::Certificate > &)> &&cb={})
 
void forEachDevice (const dht::InfoHash &to, std::function< void(const std::shared_ptr< dht::crypto::PublicKey > &)> &&op, std::function< void(bool)> &&end={})
 
bool foundAccountDevice (const std::shared_ptr< dht::crypto::Certificate > &crt, const std::string &name={}, const time_point &last_sync=time_point::min())
 
std::string getAccountDeviceName () const
 
std::vector< std::string > getCertificatesByStatus (dhtnet::tls::TrustStore::PermissionStatus status)
 
dhtnet::tls::TrustStore::PermissionStatus getCertificateStatus (const std::string &cert_id) const
 
std::map< std::string, std::string > getContactDetails (const std::string &uri) const
 Obtain details about one account contact in serializable form.
 
std::optional< ContactgetContactInfo (const std::string &uri) const
 
std::vector< std::map< std::string, std::string > > getContacts (bool includeRemoved=false) const
 
const AccountInfogetInfo () const
 
const std::map< dht::PkId, KnownDevice > & getKnownDevices () const
 
virtual std::vector< uint8_tgetPasswordKey (const std::string &)
 
std::vector< std::map< std::string, std::string > > getTrustRequests () const
 
bool isAllowed (const crypto::Certificate &crt, bool allowPublic=false)
 
virtual bool isPasswordValid (const std::string &)
 
dht::crypto::Identity loadIdentity (const std::string &crt_path, const std::string &key_path, const std::string &key_pwd) const
 
virtual void lookupAddress (const std::string &address, LookupCallback cb)
 
virtual void lookupUri (const std::string &name, const std::string &defaultServer, LookupCallback cb)
 
bool onPeerCertificate (const std::shared_ptr< dht::crypto::Certificate > &crt, bool allowPublic, dht::InfoHash &account_id)
 
void onPeerMessage (const dht::crypto::PublicKey &peer_device, bool allowPublic, PeerCertificateCb &&cb)
 
virtual void onSyncData (DeviceSync &&device, bool checkDevice=true)
 
void reloadContacts ()
 
void removeContact (const std::string &uri, bool banned=true)
 
void removeContactConversation (const std::string &uri)
 
void sendTrustRequest (const std::string &to, const std::string &convId, const std::vector< uint8_t > &payload)
 
void sendTrustRequestConfirm (const dht::InfoHash &to, const std::string &conversationId)
 
void setAccountDeviceName (const std::string &name)
 
bool setCertificateStatus (const std::shared_ptr< crypto::Certificate > &cert, dhtnet::tls::TrustStore::PermissionStatus status, bool local=true)
 
bool setCertificateStatus (const std::string &cert_id, dhtnet::tls::TrustStore::PermissionStatus status)
 
void setDht (const std::shared_ptr< dht::DhtRunner > &dht)
 
virtual void startSync (const OnNewDeviceCb &cb, const OnDeviceAnnouncedCb &dcb, bool publishPresence=true)
 
void updateContactConversation (const std::string &uri, const std::string &convId)
 
const AccountInfouseIdentity (const dht::crypto::Identity &id, const std::string &receipt, const std::vector< uint8_t > &receiptSignature, const std::string &username, const OnChangeCallback &onChange)
 
virtual ~AccountManager ()
 

Additional Inherited Members

- Static Public Member Functions inherited from jami::AccountManager
static bool foundPeerDevice (const std::string &accoundId, const std::shared_ptr< dht::crypto::Certificate > &crt, dht::InfoHash &account_id)
 Inform that a potential peer device have been found.
 
static std::shared_ptr< dht::Value > parseAnnounce (const std::string &announceBase64, const std::string &accountId, const std::string &deviceSha1, const std::string &deviceSha256)
 
- Static Public Attributes inherited from jami::AccountManager
static constexpr const char *const DHT_TYPE_NS = "cx.ring"
 
- Protected Attributes inherited from jami::AccountManager
const std::string accountId_
 
std::shared_ptr< dht::DhtRunner > dht_
 
std::unique_ptr< AccountInfoinfo_
 
std::reference_wrapper< NameDirectorynameDir_
 
OnChangeCallback onChange_
 
const std::filesystem::path path_
 

Detailed Description

Definition at line 27 of file server_account_manager.h.

Member Typedef Documentation

◆ SyncBlueprintCallback

using jami::ServerAccountManager::SyncBlueprintCallback = std::function<void(const std::map<std::string, std::string>& config)>

Definition at line 56 of file server_account_manager.h.

Constructor & Destructor Documentation

◆ ServerAccountManager()

jami::ServerAccountManager::ServerAccountManager ( const std::string &  accountId,
const std::filesystem::path &  path,
const std::string &  managerHostname,
const std::string &  nameServer 
)

Definition at line 49 of file server_account_manager.cpp.

Member Function Documentation

◆ changePassword()

bool jami::ServerAccountManager::changePassword ( const std::string &  ,
const std::string &   
)
inlineoverridevirtual

Implements jami::AccountManager.

Definition at line 48 of file server_account_manager.h.

◆ initAuthentication()

◆ onNeedsMigration()

void jami::ServerAccountManager::onNeedsMigration ( std::function< void()>  cb)
inline

Definition at line 72 of file server_account_manager.h.

References jami::emitSignal().

Here is the call graph for this function:

◆ registerName()

void jami::ServerAccountManager::registerName ( const std::string &  name,
std::string_view  scheme,
const std::string &  password,
RegistrationCallback  cb 
)
overridevirtual

Implements jami::AccountManager.

Definition at line 640 of file server_account_manager.cpp.

◆ revokeDevice()

bool jami::ServerAccountManager::revokeDevice ( const std::string &  device,
std::string_view  scheme,
const std::string &  password,
RevokeDeviceCallback  cb 
)
overridevirtual

Reimplemented from jami::AccountManager.

Definition at line 600 of file server_account_manager.cpp.

References JAMI_DEBUG, JAMI_ERROR, JAMI_WARNING, and jami::PATH_DEVICE.

◆ searchUser()

bool jami::ServerAccountManager::searchUser ( const std::string &  query,
SearchCallback  cb 
)
overridevirtual

Reimplemented from jami::AccountManager.

Definition at line 646 of file server_account_manager.cpp.

References JAMI_DEBUG, JAMI_ERROR, JAMI_WARNING, and jami::PATH_SEARCH.

◆ syncBlueprintConfig()

void jami::ServerAccountManager::syncBlueprintConfig ( SyncBlueprintCallback  onSuccess)

Definition at line 569 of file server_account_manager.cpp.

References JAMI_DEBUG, JAMI_ERROR, and jami::PATH_BLUEPRINT.

◆ syncDevices()

void jami::ServerAccountManager::syncDevices ( )
overridevirtual

The documentation for this class was generated from the following files: