Fiókkezelő
Ebben a részben megtudjuk, hogyan kell kezelni egy Jami-fiókot. Ez azt jelenti, hogyan hozhat létre Jami fiókot, hogyan módosíthatja az alapvető beállításokat és törölheti a fiókot. Ez a rész NEM elmagyarázza, mit jelent az összes beállítás, vagy hogyan használhatjuk a fiókot bármilyen művelet végrehajtására, például névjegy hozzáadására.
Mi a fiók?
A Jami nyelven a fiók egy X509 tanúsítványlánc, amely általában 3 tanúsítványt tartalmaz:
CA (önaláírt, ha helyben állítják elő vagy vállalat)
Fiók (ahol a nyilvános kulcs ujjlenyomatát „Jami ID”-nek hívják)
Eszköz
Ez lehetővé teszi a vállalat számára, hogy visszavonjon egy fiókot, ha szükséges, és egy fiókot egy eszköz visszavonására (például ha egyet ellopnak).
Új fiók létrehozása
Rendszerfolyamatoldali
API (Application Programming Interface – Alkalmazásprogramozási felület)
Ebben cx.ring.Ring.ConfigurationManager:
<method name="addAccount" tp:name-for-bindings="addAccount">
<tp:docstring>
Add a new account. When created, the signal <tp:member-ref>accountsChanged</tp:member-ref> is emitted. The clients must then call <tp:member-ref>getAccountList</tp:member-ref> to update their internal data structure.
<tp:rationale>If no details are specified, the default parameters are used.</tp:rationale>
<tp:rationale>The core tries to register the account as soon it is created.</tp:rationale>
</tp:docstring>
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="MapStringString"/>
<arg type="a{ss}" name="details" direction="in" tp:type="String_String_Map">
<tp:docstring>
The new account settings
</tp:docstring>
</arg>
<arg type="s" name="createdAccountId" direction="out">
<tp:docstring>
A new account ID
</tp:docstring>
</arg>
</method>
A részleteket a getAccountTemplate(type)
metódusból lehet lekérni a type=JAMI
vagy a type=SIP
paraméterrel. Például ez az LRC-ben használt következő kód.
std::string
NewAccountModel::createNewAccount(profile::Type type,
const std::string& displayName,
const std::string& archivePath,
const std::string& password,
const std::string& pin)
{
MapStringString details = type == profile::Type::SIP?
ConfigurationManager::instance().getAccountTemplate("SIP") :
ConfigurationManager::instance().getAccountTemplate("JAMI");
using namespace libjami::Account;
details[ConfProperties::TYPE] = type == profile::Type::SIP? "SIP" : "JAMI";
details[ConfProperties::DISPLAYNAME] = displayName.c_str();
details[ConfProperties::ALIAS] = displayName.c_str();
details[ConfProperties::UPNP_ENABLED] = "true";
details[ConfProperties::ARCHIVE_PASSWORD] = password.c_str();
details[ConfProperties::ARCHIVE_PIN] = pin.c_str();
details[ConfProperties::ARCHIVE_PATH] = archivePath.c_str();
QString accountId = ConfigurationManager::instance().addAccount(details);
return accountId.toStdString();
}
Ha egy új fiókot hozzanak hozzá, a accountsChanged
jelzésű lesz. A kliensnek a belső szerkezetét a Signál után a ConfigurationManager más módszereivel kell frissíteni.
A mag
Az új fiók létrehozásának fő logikája a src/ringdht/ringaccount.cpp
, a RingAccount::createAccount
Hogy működik, a kezdetektől
A Jami-fiókot valójában néhány gzip-archívumban tárolt fájl képviseli. Ha jelszót ad meg a fiók létrehozása során, az archívum a következőképpen lesz titkosítva: dht::crypto::aesEncrypt(archívum, jelszó)
(a dht::crypto::aesEncrypt
az OpenDHT-ban van definiálva, és használja a nettle/{aes,gcm}
). Ez az, amit az archívum tartalmaz egy nagy JSON-fájlt a következővel:
A magánkulcs
ringAccountKey
és a tanúsítványláncringAccountCert
(base64 kódolva)Generált CA kulcs (az önállóan aláírt tanúsítványok esetében)
ringCAKey
Visszatérett eszközök
ringAccountCRL
Az eszköz
ethKey
ethereum titkos kulcsa. Csak akkor használatos, ha regisztrálja a nevét azns.jami.net
oldalon. Nem kötelező.Kapcsolattartók
A számla beállításai
Tehát generáljuk!
TEENDŐ
Törölje a fiókot
A Jami-fiók törlése meglehetősen egyszerű. Mivel a kulcsok csak a készüléken vannak, ha a kulcsokat töröljük… a fiók törlődik! Az eszközön kívül egyetlen adat a kiszolgáló néven található felhasználónév. Az adatok eltávolítása a kiszolgáló név működésétől függ. Ez például nem lehetséges a https://ns.jami.net webhelyen
Rendszerfolyamatoldali
API (Application Programming Interface – Alkalmazásprogramozási felület)
Ebben cx.ring.Ring.ConfigurationManager:
<method name="removeAccount" tp:name-for-bindings="removeAccount">
<tp:docstring>
Remove an existing account. When removed, the signal <tp:member-ref>accountsChanged</tp:member-ref> is emitted. The clients must then call <tp:member-ref>getAccountList</tp:member-ref> to update their internal data structure.
</tp:docstring>
<arg type="s" name="accoundID" direction="in">
<tp:docstring>
The account to remove, identified by its ID
</tp:docstring>
</arg>
</method>
A felhasználó a rendszerben a következő funkciókat alkalmazza:
A mag
Az új fiók létrehozásának fő logikája a src/manager.cpp
, a Manager::removeAccount
-ben található.
Frissítse egy fiók adatait
API (Application Programming Interface – Alkalmazásprogramozási felület)
Ebben cx.ring.Ring.ConfigurationManager:
<method name="setAccountDetails" tp:name-for-bindings="setAccountDetails">
<tp:docstring>
Send new account parameters, or account parameters changes, to the core. The hash table is not required to be complete, only the updated parameters may be specified.
<tp:rationale>Account settings are written to the configuration file when the app properly quits.</tp:rationale>
<tp:rationale>After calling this method, the core will emit the signal <tp:member-ref>accountDetailsChanged</tp:member-ref> with the updated data. The client must subscribe to this signal and use it to update its internal data structure.</tp:rationale>
</tp:docstring>
<arg type="s" name="accountID" direction="in">
</arg>
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="MapStringString"/>
<arg type="a{ss}" name="details" direction="in" tp:type="String_String_Map">
</arg>
</method>
A térkép tartalmazhat részleges frissítést, és siker esetén az accountDetailsChanged
üzenet jelenik meg. getAccountDetails
Eszköz hozzáadása
Két lehetőség van egy eszköz hozzáadására.
Biztonsági mentés archívum (majd importálás a biztonsági másolatból)
API (Application Programming Interface – Alkalmazásprogramozási felület)
Ebben cx.ring.Ring.ConfigurationManager:
<method name="exportToFile" tp:name-for-bindings="exportToFile">
<tp:added version="5.1.0"/>
<tp:docstring>
Copy the account archive to the path provided in argument.
</tp:docstring>
<arg type="s" name="accountID" direction="in">
</arg>
<arg type="s" name="destinationPath" direction="in">
</arg>
<arg type="s" name="password" direction="in">
</arg>
<arg type="b" name="success" direction="out">
<tp:docstring>
True if the operation was initialized successfully.
</tp:docstring>
</arg>
</method>
Exportálás DHT-hálózaton
API (Application Programming Interface – Alkalmazásprogramozási felület)
Ebben cx.ring.Ring.ConfigurationManager:
<method name="exportOnRing" tp:name-for-bindings="exportOnRing">
<tp:docstring>
Export account on the DHT using the given password and generated PIN (returned through exportOnRingEnded signal).
</tp:docstring>
<arg type="s" name="accountID" direction="in">
</arg>
<arg type="s" name="password" direction="in">
</arg>
<arg type="b" name="success" direction="out">
<tp:docstring>
True if the operation was initialized successfully. exportOnRingEnded will be trigered on completion.
</tp:docstring>
</arg>
</method>
Ezután az exportOnRingEnded
kerül kiadásra.
Eszköz visszavonása
API (Application Programming Interface – Alkalmazásprogramozási felület)
<method name="revokeDevice" tp:name-for-bindings="revokeDevice">
<tp:docstring>
Revoke device attached to the given Jami account, and publish the new revocation list.
</tp:docstring>
<arg type="s" name="accountID" direction="in">
</arg>
<arg type="s" name="password" direction="in">
</arg>
<arg type="s" name="deviceId" direction="in">
</arg>
<arg type="b" name="success" direction="out">
<tp:docstring>
True if the operation was performed successfully.
</tp:docstring>
</arg>
</method>
<signal name="deviceRevocationEnded" tp:name-for-bindings="deviceRevocationEnded">
<tp:docstring>
Notify clients when the revokeDevice operation ended.
</tp:docstring>
<arg type="s" name="accountID">
</arg>
<arg type="s" name="deviceId">
</arg>
<arg type="i" name="status">
<tp:docstring>
Status code: 0 for success
<ul>
<li>SUCCESS = 0 everything went fine. Device is now revoked.</li>
<li>WRONG_PASSWORD = 1 revocation failed: wrong password.</li>
<li>UNKNOWN_DEVICE = 2 revocation failed: unknown device.</li>
</ul>
</tp:docstring>
</arg>
</signal>