Open-Transactions  0.93.0-ge03d287
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OTPseudonym.hpp
Go to the documentation of this file.
1 /************************************************************
2  *
3  * OTPseudonym.hpp
4  *
5  */
6 
7 /************************************************************
8  -----BEGIN PGP SIGNED MESSAGE-----
9  Hash: SHA1
10 
11  * OPEN TRANSACTIONS
12  *
13  * Financial Cryptography and Digital Cash
14  * Library, Protocol, API, Server, CLI, GUI
15  *
16  * -- Anonymous Numbered Accounts.
17  * -- Untraceable Digital Cash.
18  * -- Triple-Signed Receipts.
19  * -- Cheques, Vouchers, Transfers, Inboxes.
20  * -- Basket Currencies, Markets, Payment Plans.
21  * -- Signed, XML, Ricardian-style Contracts.
22  * -- Scripted smart contracts.
23  *
24  * Copyright (C) 2010-2013 by "Fellow Traveler" (A pseudonym)
25  *
26  * EMAIL:
28  *
29  * BITCOIN: 1NtTPVVjDsUfDWybS4BwvHpG2pdS9RnYyQ
30  *
31  * KEY FINGERPRINT (PGP Key in license file):
32  * 9DD5 90EB 9292 4B48 0484 7910 0308 00ED F951 BB8E
33  *
34  * OFFICIAL PROJECT WIKI(s):
35  * https://github.com/FellowTraveler/Moneychanger
36  * https://github.com/FellowTraveler/Open-Transactions/wiki
37  *
38  * WEBSITE:
39  * http://www.OpenTransactions.org/
40  *
41  * Components and licensing:
42  * -- Moneychanger..A Java client GUI.....LICENSE:.....GPLv3
43  * -- otlib.........A class library.......LICENSE:...LAGPLv3
44  * -- otapi.........A client API..........LICENSE:...LAGPLv3
45  * -- opentxs/ot....Command-line client...LICENSE:...LAGPLv3
46  * -- otserver......Server Application....LICENSE:....AGPLv3
47  * Github.com/FellowTraveler/Open-Transactions/wiki/Components
48  *
49  * All of the above OT components were designed and written by
50  * Fellow Traveler, with the exception of Moneychanger, which
51  * was contracted out to Vicky C ([email protected]).
52  * The open-source community has since actively contributed.
53  *
54  * -----------------------------------------------------
55  *
56  * LICENSE:
57  * This program is free software: you can redistribute it
58  * and/or modify it under the terms of the GNU Affero
59  * General Public License as published by the Free Software
60  * Foundation, either version 3 of the License, or (at your
61  * option) any later version.
62  *
63  * ADDITIONAL PERMISSION under the GNU Affero GPL version 3
64  * section 7: (This paragraph applies only to the LAGPLv3
65  * components listed above.) If you modify this Program, or
66  * any covered work, by linking or combining it with other
67  * code, such other code is not for that reason alone subject
68  * to any of the requirements of the GNU Affero GPL version 3.
69  * (==> This means if you are only using the OT API, then you
70  * don't have to open-source your code--only your changes to
71  * Open-Transactions itself must be open source. Similar to
72  * LGPLv3, except it applies to software-as-a-service, not
73  * just to distributing binaries.)
74  *
75  * Extra WAIVER for OpenSSL, Lucre, and all other libraries
76  * used by Open Transactions: This program is released under
77  * the AGPL with the additional exemption that compiling,
78  * linking, and/or using OpenSSL is allowed. The same is true
79  * for any other open source libraries included in this
80  * project: complete waiver from the AGPL is hereby granted to
81  * compile, link, and/or use them with Open-Transactions,
82  * according to their own terms, as long as the rest of the
83  * Open-Transactions terms remain respected, with regard to
84  * the Open-Transactions code itself.
85  *
86  * Lucre License:
87  * This code is also "dual-license", meaning that Ben Lau-
88  * rie's license must also be included and respected, since
89  * the code for Lucre is also included with Open Transactions.
90  * See Open-Transactions/src/otlib/lucre/LUCRE_LICENSE.txt
91  * The Laurie requirements are light, but if there is any
92  * problem with his license, simply remove the Lucre code.
93  * Although there are no other blind token algorithms in Open
94  * Transactions (yet. credlib is coming), the other functions
95  * will continue to operate.
96  * See Lucre on Github: https://github.com/benlaurie/lucre
97  * -----------------------------------------------------
98  * You should have received a copy of the GNU Affero General
99  * Public License along with this program. If not, see:
100  * http://www.gnu.org/licenses/
101  *
102  * If you would like to use this software outside of the free
103  * software license, please contact FellowTraveler.
104  * (Unfortunately many will run anonymously and untraceably,
105  * so who could really stop them?)
106  *
107  * DISCLAIMER:
108  * This program is distributed in the hope that it will be
109  * useful, but WITHOUT ANY WARRANTY; without even the implied
110  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
111  * PURPOSE. See the GNU Affero General Public License for
112  * more details.
113 
114  -----BEGIN PGP SIGNATURE-----
115  Version: GnuPG v1.4.9 (Darwin)
116 
117  iQIcBAEBAgAGBQJRSsfJAAoJEAMIAO35UbuOQT8P/RJbka8etf7wbxdHQNAY+2cC
118  vDf8J3X8VI+pwMqv6wgTVy17venMZJa4I4ikXD/MRyWV1XbTG0mBXk/7AZk7Rexk
119  KTvL/U1kWiez6+8XXLye+k2JNM6v7eej8xMrqEcO0ZArh/DsLoIn1y8p8qjBI7+m
120  aE7lhstDiD0z8mwRRLKFLN2IH5rAFaZZUvj5ERJaoYUKdn4c+RcQVei2YOl4T0FU
121  LWND3YLoH8naqJXkaOKEN4UfJINCwxhe5Ke9wyfLWLUO7NamRkWD2T7CJ0xocnD1
122  sjAzlVGNgaFDRflfIF4QhBx1Ddl6wwhJfw+d08bjqblSq8aXDkmFA7HeunSFKkdn
123  oIEOEgyj+veuOMRJC5pnBJ9vV+7qRdDKQWaCKotynt4sWJDGQ9kWGWm74SsNaduN
124  TPMyr9kNmGsfR69Q2Zq/FLcLX/j8ESxU+HYUB4vaARw2xEOu2xwDDv6jt0j3Vqsg
125  x7rWv4S/Eh18FDNDkVRChiNoOIilLYLL6c38uMf1pnItBuxP3uhgY6COm59kVaRh
126  nyGTYCDYD2TK+fI9o89F1297uDCwEJ62U0Q7iTDp5QuXCoxkPfv8/kX6lS6T3y9G
127  M9mqIoLbIQ1EDntFv7/t6fUTS2+46uCrdZWbQ5RjYXdrzjij02nDmJAm2BngnZvd
128  kamH0Y/n11lCvo1oQxM+
129  =uSzz
130  -----END PGP SIGNATURE-----
131  **************************************************************/
132 
133 #ifndef OPENTXS_CORE_OTPSEUDONYM_HPP
134 #define OPENTXS_CORE_OTPSEUDONYM_HPP
135 
136 #include "crypto/OTASCIIArmor.hpp"
137 #include "OTIdentifier.hpp"
138 
139 #include <deque>
140 #include <map>
141 #include <list>
142 #include <set>
143 
144 namespace opentxs
145 {
146 
147 class OTAsymmetricKey;
148 class OTCredential;
149 class OTItem;
150 class OTKeypair;
151 class OTLedger;
152 class OTMessage;
153 class OTPassword;
154 class OTPasswordData;
155 class OTSubcredential;
157 
158 typedef std::deque<OTMessage*> dequeOfMail;
159 typedef std::map<std::string, int64_t> mapOfRequestNums;
160 typedef std::map<std::string, int64_t> mapOfHighestNums;
161 typedef std::deque<int64_t> dequeOfTransNums;
162 typedef std::map<std::string, dequeOfTransNums*> mapOfTransNums;
163 typedef std::map<std::string, OTIdentifier> mapOfIdentifiers;
164 typedef std::map<std::string, OTCredential*> mapOfCredentials;
165 typedef std::list<OTAsymmetricKey*> listOfAsymmetricKeys;
166 
168 {
169 private:
170  OTPseudonym(const OTPseudonym&);
171  OTPseudonym& operator=(const OTPseudonym&);
172 
173  bool m_bMarkForDeletion; // Default FALSE. When set to true, saves a
174  // "DELETED" flag with this Nym,
175  // for easy cleanup later when the server is doing some maintenance.
176  OTString m_strName; // Used by the wallet so the nym is easily identified by
177  // the user
178  // The internals, and server, prefer nymID to name.
179  OTString m_strNymfile; // This contains the request numbers and other user
180  // acct info. XML.
181  // Client-side only, since the server uses nymID for filenames
182  OTString m_strCertfile; // Filename for pem file that contains the x509
183  // Certificate. ----BEGIN etc...
184  // Client-side only for now.
185 
186  OTString m_strVersion; // This goes with the Nymfile
187  OTASCIIArmor m_ascCert; // Just the ascii-armor portion without BEGIN and
188  // END
189  OTString m_strSourceForNymID; // Hash this to form the NymID. Can be a
190  // public key, or a URL, or DN info from a
191  // cert, etc.
192  OTString m_strAltLocation; // If the Nym's credential IDs cannot be directly
193  // downloaded from the source, the download
194  // location is placed here instead. For example,
195  // if the source is DN info from a cert, the alt
196  // location might contain the URL to download it
197  // from.
198  OTIdentifier m_nymID; // Hashed-ID formed by hashing the Nym's public key.
199  OTIdentifier m_NymboxHash; // (Server-side) Hash of the Nymbox
200 
201  mapOfIdentifiers m_mapNymboxHash; // (Client-side) Hash of latest DOWNLOADED
202  // Nymbox (OTIdentifier) mapped by
203  // ServerID (std::string)
204  mapOfIdentifiers m_mapRecentHash; // (Client-side) Hash of Nymbox according
205  // to Server, based on some recent reply.
206  // (May be newer...)
207  mapOfIdentifiers m_mapInboxHash; // Whenever client downloads Inbox, its
208  // hash is stored here. (When downloading
209  // account, can compare ITS inbox hash to
210  // this one, to see if I already have
211  // latest one.)
212  mapOfIdentifiers m_mapOutboxHash; // Whenever client downloads Outbox, its
213  // hash is stored here. (When downloading
214  // account, can compare ITS outbox hash to
215  // this one, to see if I already have
216  // latest one.)
217  OTKeypair* m_pkeypair; // This nym's public key and private key
218  // NOTE: these dequeOfMail objects are only currently stored in the Nym for
219  // convenience.
220  // They don't have to be stored in here.
221  //
222  dequeOfMail m_dequeMail; // Any mail messages received by this Nym. (And not
223  // yet deleted.)
224  dequeOfMail m_dequeOutmail; // Any mail messages sent by this Nym. (And not
225  // yet deleted.)
226  dequeOfMail m_dequeOutpayments; // Any outoing payments sent by this Nym.
227  // (And not yet deleted.) (payments screen.)
228  mapOfRequestNums m_mapRequestNum; // Whenever this user makes a request to a
229  // transaction server
230  // he must use the latest request number. Each user has a request
231  // number for EACH transaction server he accesses.
232 
233  mapOfTransNums m_mapTransNum; // Each Transaction Request must be
234  // accompanied by a fresh transaction #,
235  // one that has previously been issued to the Nym by the Server. This list
236  // is used so that I know WHICH transaction numbers I still have to USE.
237 
238  mapOfTransNums m_mapIssuedNum; // If the server has issued me (1,2,3,4,5)
239  // and I have already used 1-3,
240  // then (4,5) are the only remaining numbers on the ABOVE list, but the
241  // entire (1,2,3,4,5) are still on THIS list--each only to be removed
242  // when I have ACCEPTED THE RECEIPT IN MY NYMBOX FOR EACH ONE. This list
243  // is so I can do agreements with the server concerning which RECEIPTS I'VE
244  // ACCEPTED.
245 
246  // When I accept a transaction number, I put it on this list. Then when I
247  // receive the server reply, I add the # to the
248  // actual lists (m_maps TransNum and IssuedNum) and remove it from this
249  // list. If it's NOT on this list when I receive
250  // the server reply, then the server is trying to trick me! into accepting a
251  // number I never asked to sign for. The real
252  // reason I added this member was so the server could drop notices into my
253  // Nymbox about these new transaction numbers
254  // (for cases where the actual network message was lost, the server reply, I
255  // realized a good backup plan is to have the
256  // server always drop notices into your nymbox as well, so you won't get out
257  // of sync, since the notice is there even if
258  // the network fails before you get the server's reply.) I think this is
259  // also a GREAT backup plan for withdrawing CASH.
260  //
261  mapOfTransNums m_mapTentativeNum;
262  // We store the highest transaction number accepted for any given server,
263  // and we refuse, in the future, to accept anything lower.
264  // This prevents a sneaky server from sending you an old number, getting you
265  // to sign it out again, then then using that to run
266  // through an old instrument (such as a cheque) that still has your old
267  // (valid) signature on it.
268  //
269  mapOfHighestNums m_mapHighTransNo; // Mapped, a single int64_t to each
270  // server (just like request numbers
271  // are.)
272  // Although it says "mapOfTransNums", in this case, request numbers are
273  // stored. I used mapOfTransNums and its associated
274  // generic manipulation functions, since they already existed. The
275  // AcknowledgedNums are for optimization only, as they enable
276  // us to avoid downloading many Box Receipts we'd other have to download.
277  // (Specifically, replyNotices, which are referenced
278  // by their request number.)
279  //
280  mapOfTransNums m_mapAcknowledgedNum;
281  // (SERVER side)
282  std::set<int64_t> m_setOpenCronItems; // Until these Cron Items are closed
283  // out, the server-side Nym keeps a
284  // list of them handy.
285 
286  // (SERVER side)
287  // Using strings here to avoid juggling memory crap.
288  std::set<std::string> m_setAccounts; // A list of asset account IDs. Server
289  // side only (client side uses wallet;
290  // has multiple servers.)
291  // (SERVER side.)
292  int64_t m_lUsageCredits; // Server-side. The usage credits available for
293  // this Nym. Infinite if negative.
294  mapOfCredentials m_mapCredentials; // The credentials for this Nym. (Each
295  // with a master key and various
296  // subcredentials.)
297  mapOfCredentials m_mapRevoked; // We keep track of old master credentials
298  // after they are revoked.
299  OTString::List m_listRevokedIDs; // std::string list, any revoked Credential
300  // IDs. (Mainly for subcredentials /
301  // subkeys.)
302 public:
303  EXPORT void GetPrivateCredentials(OTString& strCredList,
304  OTString::Map* pmapCredFiles = nullptr);
305  EXPORT void GetPublicCredentials(OTString& strCredList,
306  OTString::Map* pmapCredFiles = nullptr)
307  const; // If the Nym's source is a
308  // URL,
309  // he needs to post his valid
310  // master credential IDs there,
311  // so they can be verified
312  // against their source. This
313  // method is what creates the
314  // file which you can post at
315  // that URL. (Containing only
316  // the valid IDs, not the
317  // revoked ones.)
318  EXPORT bool AddNewMasterCredential(
319  OTString& strOutputMasterCredID, // The new ID, upon success, is
320  // returned here.
321  const OTString* pstrSourceForNymID = nullptr, // If nullptr, it uses the
322  // Nym's
323  // (presumed) existing pubkey
324  // as the source.
325  int32_t nBits = 1024, // Ignored unless pmapPrivate is nullptr.
326  const OTString::Map* pmapPrivate = nullptr, // If nullptr, then the keys
327  // are generated in here.
328  const OTString::Map* pmapPublic = nullptr, // In the case of key
329  // credentials, public is
330  // optional since it
331  // can already be derived from private. For now we pass it
332  // through... May eliminate this parameter later if not
333  // needed.
334  const OTPasswordData* pPWData = nullptr, // Pass in the string to show
335  // users
336  // here, if/when asking for the
337  // passphrase.
338  bool bChangeNymID = false); // Must be explicitly set to true, to change
339  // the Nym's ID.
340  // Other restrictions also apply... must be your first
341  // master credential. Must have no accounts. Basically can
342  // only be used for brand-new Nyms in circumstances where
343  // it's assumed the Nym's ID is in the process of being
344  // generated anyway. Should never be used on some existing
345  // Nym who is already in the wallet and who may even have
346  // accounts somewhere already.
347 
348  EXPORT bool AddNewSubkey(
349  const OTIdentifier& idMasterCredential,
350  int32_t nBits = 1024, // Ignored unless pmapPrivate is nullptr.
351  const OTString::Map* pmapPrivate = nullptr, // If nullptr, then the keys
352  // are generated in here.
353  const OTPasswordData* pPWData = nullptr, // Pass in the string to show
354  // users
355  // here, if/when asking for the
356  // passphrase.
357  OTString* pstrNewID = nullptr); // Optional -- if success, allows to
358  // return
359  // the ID for the new subkey that was
360  // created.
361 
362  EXPORT bool AddNewSubcredential(
363  const OTIdentifier& idMasterCredential,
364  const OTString::Map* pmapPrivate = nullptr, // If nullptr, then the keys
365  // are generated in here.
366  const OTString::Map* pmapPublic = nullptr, // In the case of key
367  // credentials, public is
368  // optional since it
369  // can already be derived from private. For now we pass it
370  // through... May eliminate this parameter later if not
371  // needed.
372  const OTPasswordData* pPWData = nullptr); // Pass in the string to show
373  // users
374  // here, if/when asking for the
375  // passphrase.
376  EXPORT size_t GetMasterCredentialCount() const;
377  EXPORT size_t GetRevokedCredentialCount() const;
378  EXPORT OTCredential* GetMasterCredential(const OTString& strID);
379  EXPORT OTCredential* GetRevokedCredential(const OTString& strID);
380  EXPORT const OTCredential* GetMasterCredentialByIndex(int32_t nIndex) const;
382  int32_t nIndex) const;
383  EXPORT const OTSubcredential* GetSubcredential(
384  const OTString& strMasterID, const OTString& strSubCredID) const;
385  EXPORT const OTSubcredential* GetRevokedSubcred(
386  const OTString& strRevokedID, const OTString& strSubCredID) const;
387  EXPORT bool GetNymboxHashServerSide(const OTIdentifier& theServerID,
388  OTIdentifier& theOutput); // server-side
389  EXPORT void SetNymboxHashServerSide(
390  const OTIdentifier& theInput); // server-side
391 private:
392  // Generic function used by the below functions.
393  bool GetHash(const mapOfIdentifiers& the_map, const std::string& str_id,
394  OTIdentifier& theOutput) const; // client-side
395  bool SetHash(mapOfIdentifiers& the_map, const std::string& str_id,
396  const OTIdentifier& theInput); // client-side
397  // OTIdentifier m_NymboxHash; // (Server-side) Hash of the
398  // Nymbox
399  // mapOfIdentifiers m_mapNymboxHash; // (Client-side) Hash of
400  // Nymbox (OTIdentifier) mapped by ServerID (std::string)
401 public:
402  // This value is only updated on client side, when the actual latest
403  // nymbox has been downloaded.
404  EXPORT bool GetNymboxHash(const std::string& server_id,
405  OTIdentifier& theOutput) const; // client-side
406  EXPORT bool SetNymboxHash(const std::string& server_id,
407  const OTIdentifier& theInput); // client-side
408  // Whereas THIS value is updated when various server replies are received.
409  // (So we can see the most recent version of the same hash on server side.)
410  // If this doesn't match the hash above, then it's time to download your
411  // nymbox
412  // because it's old.
413  EXPORT bool GetRecentHash(const std::string& server_id,
414  OTIdentifier& theOutput) const; // client-side
415  EXPORT bool SetRecentHash(const std::string& server_id,
416  const OTIdentifier& theInput); // client-side
417  // This functions are for the latest downloaded inbox's hash.
418  // (If the hash that appears in the account is different, then
419  // your inbox is old -- download it again.)
420  //
421  // This saves you having to download it many times when it has not even
422  // changed.
423  //
424  EXPORT bool GetInboxHash(const std::string& acct_id,
425  OTIdentifier& theOutput) const; // client-side
426  EXPORT bool SetInboxHash(const std::string& acct_id,
427  const OTIdentifier& theInput); // client-side
428  // This functions are for the latest downloaded outbox's hash.
429  // (If the hash that appears in the account is different, then
430  // your outbox is old -- download it again.)
431  //
432  // This saves you having to download it many times when it has not even
433  // changed.
434  //
435  EXPORT bool GetOutboxHash(const std::string& acct_id,
436  OTIdentifier& theOutput) const; // client-side
437  EXPORT bool SetOutboxHash(const std::string& acct_id,
438  const OTIdentifier& theInput); // client-side
439  EXPORT const int64_t& GetUsageCredits() const
440  {
441  return m_lUsageCredits;
442  }
443  EXPORT void SetUsageCredits(const int64_t& lUsage)
444  {
445  m_lUsageCredits = lUsage;
446  }
447  inline void MarkForDeletion()
448  {
449  m_bMarkForDeletion = true;
450  }
451  inline bool IsMarkedForDeletion() const
452  {
453  return m_bMarkForDeletion;
454  }
455  inline void MarkAsUndeleted()
456  {
457  m_bMarkForDeletion = false;
458  }
459 
460  // Server-side. Helps the server keep track of the accounts for a certain
461  // Nym, and the cron items.
462  inline std::set<int64_t>& GetSetOpenCronItems()
463  {
464  return m_setOpenCronItems;
465  }
466  inline std::set<std::string>& GetSetAssetAccounts()
467  {
468  return m_setAccounts;
469  } // stores acct IDs as std::string
471  {
472  return m_strName;
473  }
474  inline void SetNymName(const OTString& strName)
475  {
476  m_strName = strName;
477  }
478  // Old style: the user enters a passphrase for using the Nym.
479  // New style: the user enters a passphrase which is used to derive a key,
480  // which is used to decrypt the master key, which is used for using the Nym.
481  // To convert an "old style" Nym to a "new style" Nym, just call this
482  // function
483  // after loading "old style" and it will save in the "new style."
484  // THIS WILL OVERWRITE THE CERT (with the new master key passphrase.)
485  // meaning
486  // that you will no longer be able to use the Nym OUTSIDE of OT, since
487  // OpenSSL
488  // will be expecting the master key, not the user's actual passphrase.
489  //
490  // THEREFORE: Nyms will be "imported" into the master key mode, and then if
491  // you want
492  // to use them outside of your wallet, you will have to "export" the Nym,
493  // which will
494  // have to call a function that reverses the one below.
495  // (ConvertBackOutOfCachedKey or
496  // some such thing.)
497  //
498 
499  // EXPORT bool ConvertToCachedKey(); // Replaced by
500  // Savex509CertAndPrivateKey().
501  EXPORT OTPseudonym();
502  EXPORT OTPseudonym(const OTIdentifier& nymID);
503  EXPORT OTPseudonym(const OTString& strNymID);
504  EXPORT OTPseudonym(const OTString& name, const OTString& filename,
505  const OTString& nymID);
506  EXPORT virtual ~OTPseudonym();
507  EXPORT void Initialize();
508  EXPORT void ReleaseTransactionNumbers();
509  EXPORT bool VerifyPseudonym() const;
510  // Use this to actually generate a new key pair and assorted nym files.
511  //
512  EXPORT bool GenerateNym(int32_t nBits = 1024, bool bCreateFile = true,
513  std::string str_id_source = "",
514  std::string str_alt_location = "");
515  // Some messages require "transaction agreement" as opposed to "balance
516  // agreement."
517  // That is, cases where only transactions change and not balances.
518  //
520  const OTTransaction& theOwner); // like balance agreement
521  // SET PUBLIC KEY BASED ON INPUT STRING
522 
523  // This version WILL handle the bookends -----BEGIN PUBLIC KEY------
524  EXPORT bool SetPublicKey(const OTString& strKey, bool bEscaped = true);
525 
526  // This version WILL handle the bookends: -----BEGIN CERTIFICATE------
527  // It also handles the escaped version: - -----BEGIN CERTIFICATE-----
528  EXPORT bool SetCertificate(const OTString& strCert, bool bEscaped = true);
529 
530  // This will set the public key on this Nym based on the public key as it
531  // appears in an ascii-armored string.
532  EXPORT bool SetPublicKey(const OTASCIIArmor& strKey);
533  // SET PRIVATE KEY BASED ON INPUT STRING
534 
535  // This version WILL handle the bookends -----BEGIN ENCRYPTED PRIVATE
536  // KEY------
537  EXPORT bool SetPrivateKey(const OTString& strKey, bool bEscaped = true);
538 
539  // This will set the private key on this Nym based on the private key as it
540  // appears in an ascii-armored string.
541  EXPORT bool SetPrivateKey(const OTASCIIArmor& strKey);
542  // LOAD PUBLIC / PRIVATE NYM
543 
544  // CALLER is responsible to delete the Nym ptr being returned
545  // in these functions!
546  //
547  EXPORT static OTPseudonym* LoadPublicNym(const OTIdentifier& NYM_ID,
548  const OTString* pstrName = nullptr,
549  const char* szFuncName = nullptr);
550 
551  EXPORT static OTPseudonym* LoadPrivateNym(
552  const OTIdentifier& NYM_ID, bool bChecking = false,
553  const OTString* pstrName = nullptr, const char* szFuncName = nullptr,
554  const OTPasswordData* pPWData = nullptr,
555  const OTPassword* pImportPassword = nullptr);
556  EXPORT bool HasPublicKey();
557  EXPORT bool HasPrivateKey();
558  EXPORT const OTAsymmetricKey& GetPublicAuthKey() const; // Authentication
559  const OTAsymmetricKey& GetPrivateAuthKey() const;
560  EXPORT const OTAsymmetricKey& GetPublicEncrKey() const; // Encryption
561  const OTAsymmetricKey& GetPrivateEncrKey() const;
562  EXPORT const OTAsymmetricKey& GetPublicSignKey() const; // Signing
563  const OTAsymmetricKey& GetPrivateSignKey() const;
564  // OT uses the signature's metadata to narrow down its search for the
565  // correct public key.
566  EXPORT int32_t GetPublicKeysBySignature(
567  listOfAsymmetricKeys& listOutput, const OTSignature& theSignature,
568  char cKeyType = '0') const; // 'S' (signing key) or
569  // 'E' (encryption key)
570  // or 'A'
571  // (authentication key)
572  EXPORT bool SaveCredentialList();
573  EXPORT void SaveCredentialListToString(OTString& strOutput);
574  EXPORT void SaveCredentialsToString(OTString& strOutput,
575  OTString::Map* pmapPubInfo = nullptr,
576  OTString::Map* pmapPriInfo = nullptr);
577  EXPORT bool LoadCredentials(bool bLoadPrivate = false, // Loads public
578  // credentials by
579  // default. For private, pass true.
580  const OTPasswordData* pPWData = nullptr,
581  const OTPassword* pImportPassword = nullptr);
582  // Like for when you are exporting a Nym from the wallet.
583  EXPORT bool ReEncryptPrivateCredentials(
584  bool bImporting,
585  const OTPasswordData* pPWData = nullptr, // bImporting=true, or
586  // false if exporting.
587  const OTPassword* pImportPassword = nullptr);
588  // The signer is whoever wanted to make sure these nym files haven't
589  // changed.
590  // Usually that means the server nym. Most of the time, m_nymServer will be
591  // used as signer.
592  EXPORT bool LoadSignedNymfile(OTPseudonym& SIGNER_NYM);
593  EXPORT bool SaveSignedNymfile(OTPseudonym& SIGNER_NYM);
594  EXPORT bool LoadNymfile(const char* szFilename = nullptr);
595  EXPORT bool LoadFromString(const OTString& strNym,
596  OTString::Map* pMapCredentials =
597  nullptr, // pMapCredentials can be passed, if
598  // you prefer to use a specific set,
599  // instead of just loading the actual
600  // set from storage (such as during
601  // registration, when the credentials
602  // have been sent inside a message.)
603  OTString* pstrReason = nullptr,
604  const OTPassword* pImportPassword = nullptr);
605  // pstrID is an output parameter.
606  EXPORT bool Server_PubKeyExists(OTString* pstrID = nullptr); // Only used on
607  // server side.
608  EXPORT bool LoadPublicKey();
609  EXPORT static bool DoesCertfileExist(const OTString& strNymID); // static
610  // version
611  // of the
612  // next
613  // function.
614  EXPORT bool CertfileExists(); // on the client side, this means it's a
615  // private Nym.
616  EXPORT bool Loadx509CertAndPrivateKey(
617  bool bChecking = false, const OTPasswordData* pPWData = nullptr,
618  const OTPassword* pImportPassword = nullptr);
620  const OTString& strInput, const OTPasswordData* pPWData = nullptr,
621  const OTPassword* pImportPassword = nullptr);
622  EXPORT bool Savex509CertAndPrivateKey(bool bCreateFile = true,
623  const OTString* pstrReason = nullptr);
625  OTString& strOutput, const OTString* pstrReason = nullptr);
626  EXPORT bool SavePseudonymWallet(OTString& strOutput) const;
627  EXPORT bool SavePseudonymWallet(std::ofstream& ofs) const;
628  EXPORT bool SavePublicKey(const OTString& strPath) const;
629  EXPORT bool SavePublicKey(std::ofstream& ofs) const;
630  EXPORT bool SavePseudonym(); // saves to filename m_strNymfile
631  EXPORT bool SavePseudonym(const char* szFoldername, const char* szFilename);
632  EXPORT bool SavePseudonym(OTString& strNym);
633  EXPORT bool SavePseudonym(std::ofstream& ofs);
634  EXPORT bool SetIdentifierByPubkey();
635  EXPORT bool CompareID(const OTIdentifier& theIdentifier) const
636  {
637  return (theIdentifier == m_nymID);
638  }
639 
640  EXPORT bool CompareID(const OTPseudonym& RHS) const;
641  EXPORT const OTString& GetNymIDSource() const
642  {
643  return m_strSourceForNymID;
644  } // Source for NymID for this credential. (Hash it to get ID.)
645  EXPORT const OTString& GetAltLocation() const
646  {
647  return m_strAltLocation;
648  } // Alternate download location for Nym's credential IDs. (Primary location
649  // being the source itself, but sometimes that's not feasible.)
650 
651  EXPORT void SetNymIDSource(const OTString& strSource)
652  {
653  m_strSourceForNymID = strSource;
654  }
655  EXPORT void SetAltLocation(const OTString& strLocation)
656  {
657  m_strAltLocation = strLocation;
658  }
659 
660  EXPORT void SerializeNymIDSource(OTString& strOutput) const;
661  EXPORT const OTIdentifier& GetConstID() const
662  {
663  return m_nymID;
664  } // CONST VERSION
665 
666  EXPORT void GetIdentifier(OTIdentifier& theIdentifier) const; // BINARY
667  // VERSION
668  EXPORT void SetIdentifier(const OTIdentifier& theIdentifier);
669 
670  EXPORT void GetIdentifier(OTString& theIdentifier) const; // STRING VERSION
671  EXPORT void SetIdentifier(const OTString& theIdentifier);
672  EXPORT void HarvestTransactionNumbers(
673  const OTIdentifier& theServerID, OTPseudonym& SIGNER_NYM,
674  OTPseudonym& theOtherNym, // OtherNym is used as a container for the
675  // server to send
676  bool bSave = true); // us new transaction numbers.
677 
678  EXPORT void HarvestIssuedNumbers(
679  const OTIdentifier& theServerID, OTPseudonym& SIGNER_NYM,
680  OTPseudonym& theOtherNym, // OtherNym is used as container for us to
681  // send a list
682  bool bSave = false); // of issued numbers to the server (for balance
683  // agreement)
684 
685  EXPORT bool ClawbackTransactionNumber(
686  const OTIdentifier& theServerID,
687  const int64_t& lTransClawback, // the number being clawed back.
688  bool bSave = false, OTPseudonym* pSIGNER_NYM = nullptr);
689  EXPORT void IncrementRequestNum(OTPseudonym& SIGNER_NYM,
690  const OTString& strServerID); // Increment
691  // the counter
692  // or create a
693  // new one for
694  // this
695  // serverID
696  // starting at
697  // 1
698  EXPORT void OnUpdateRequestNum(OTPseudonym& SIGNER_NYM,
699  const OTString& strServerID,
700  int64_t lNewRequestNumber); // if the server
701  // sends us a
702  // @getRequest
703  EXPORT bool GetCurrentRequestNum(const OTString& strServerID,
704  int64_t& lReqNum) const; // get the current
705  // request number for
706  // the serverID
707 
708  EXPORT bool GetHighestNum(const OTString& strServerID,
709  int64_t& lHighestNum) const; // get the
710  // last/current
711  // highest transaction
712  // number for the serverID.
713  EXPORT int64_t UpdateHighestNum(
714  OTPseudonym& SIGNER_NYM, const OTString& strServerID,
715  std::set<int64_t>& setNumbers, std::set<int64_t>& setOutputGood,
716  std::set<int64_t>& setOutputBad,
717  bool bSave = false); // Returns 0 if success, otherwise #
718  // of the violator.
719 
721  {
722  return m_mapTransNum;
723  }
725  {
726  return m_mapIssuedNum;
727  }
729  {
730  return m_mapTentativeNum;
731  }
733  {
734  return m_mapAcknowledgedNum;
735  } // This one actually stores request numbers.
736 
737  EXPORT void RemoveAllNumbers(const OTString* pstrServerID = nullptr,
738  bool bRemoveHighestNum = true); // for
739  // transaction
740  // numbers
741  EXPORT void RemoveReqNumbers(const OTString* pstrServerID =
742  nullptr); // for request numbers (entirely
743  // different animal)
744  EXPORT bool UnRegisterAtServer(const OTString& strServerID); // Removes the
745  // request num
746  // for a
747  // specific
748  // server, if
749  // it was there
750  // before.
751  EXPORT bool IsRegisteredAtServer(
752  const OTString& strServerID) const; // You can't
753  // go using a
754  // Nym at a
755  // certain
756  // server, if
757  // it's not
758  // registered
759  // there...
760  //
761  // ** ResyncWithServer **
762  //
763  // Not for normal use! (Since you should never get out of sync with the
764  // server in the first place.)
765  // However, in testing, or if some bug messes up some data, or whatever, and
766  // you absolutely need to
767  // re-sync with a server, and you trust that server not to lie to you, then
768  // this function will do the trick.
769  // NOTE: Before calling this, you need to do a getNymbox() to download the
770  // latest Nymbox, and you need to do
771  // a createUserAccount() to download the server's copy of your Nym. You then
772  // need to load that Nymbox from
773  // local storage, and you need to load the server's message Nym out of the
774  // @createUserAccount reply, so that
775  // you can pass both of those objects into this function, which must assume
776  // that those pieces were already done
777  // just prior to this call.
778  EXPORT bool ResyncWithServer(const OTLedger& theNymbox,
779  const OTPseudonym& theMessageNym);
780  // HIGH LEVEL:
781  EXPORT bool AddTransactionNum(
782  OTPseudonym& SIGNER_NYM, const OTString& strServerID, int64_t lTransNum,
783  bool bSave); // We have received a new trans num from server. Store it.
784  EXPORT bool GetNextTransactionNum(OTPseudonym& SIGNER_NYM,
785  const OTString& strServerID,
786  int64_t& lTransNum,
787  bool bSave = true); // Get the next
788  // available
789  // transaction number
790  // for the serverID
791  // passed. Saves by
792  // default.
793  EXPORT bool RemoveIssuedNum(OTPseudonym& SIGNER_NYM,
794  const OTString& strServerID,
795  const int64_t& lTransNum,
796  bool bSave); // SAVE OR NOT (your choice)
797  bool RemoveTentativeNum(OTPseudonym& SIGNER_NYM,
798  const OTString& strServerID,
799  const int64_t& lTransNum, bool bSave);
800  EXPORT bool RemoveAcknowledgedNum(OTPseudonym& SIGNER_NYM,
801  const OTString& strServerID,
802  const int64_t& lRequestNum,
803  bool bSave); // Used on both client and
804  // server sides for
805  // optimization.
806  EXPORT bool VerifyIssuedNum(const OTString& strServerID,
807  const int64_t& lTransNum) const; // verify user
808  // is
809  // still responsible
810  // for (signed for) a
811  // certain trans#
812  // that was previous
813  // issued to him.
814  // (i.e. it's been
815  // used, but not yet
816  // accepted receipt
817  // through inbox.)
818  EXPORT bool VerifyTransactionNum(const OTString& strServerID,
819  const int64_t& lTransNum) const; // server
820  // verifies that
821  // nym has this
822  // TransNum
823  // available for
824  // use.
825  EXPORT bool VerifyTentativeNum(
826  const OTString& strServerID,
827  const int64_t& lTransNum) const; // Client-side
828  // verifies that
829  // it actually
830  // tried to sign
831  // for this number
832  // (so it knows if
833  // the reply is
834  // valid.)
835  EXPORT bool VerifyAcknowledgedNum(
836  const OTString& strServerID,
837  const int64_t& lRequestNum) const; // Client
838  // verifies
839  // it has
840  // already
841  // seen a
842  // server reply. Server acknowledges client
843  // has seen reply (so client can remove
844  // from list, so server can as well.)
845  // These two functions are for when you re-download your
846  // nym/account/inbox/outbox, and you
847  // need to verify it against the last signed receipt to make sure you aren't
848  // getting screwed.
849  //
850  EXPORT bool VerifyIssuedNumbersOnNym(OTPseudonym& THE_NYM);
852  // These functions are for transaction numbers that were assigned to me,
853  // until I accept the receipts or put stop payment onto them.
854  //
855  EXPORT int32_t
856  GetIssuedNumCount(const OTIdentifier& theServerID) const; // count
857  EXPORT int64_t GetIssuedNum(const OTIdentifier& theServerID,
858  int32_t nIndex) const; // index
859 
860  EXPORT bool AddIssuedNum(const OTString& strServerID,
861  const int64_t& lTransNum); // doesn't save
862 
863  EXPORT bool RemoveIssuedNum(OTPseudonym& SIGNER_NYM,
864  const OTString& strServerID,
865  const int64_t& lTransNum); // saves
866  EXPORT bool RemoveIssuedNum(const OTString& strServerID,
867  const int64_t& lTransNum); // doesn't save
868  // These functions are for transaction numbers that I still have available
869  // to use.
870  //
871  EXPORT int32_t
872  GetTransactionNumCount(const OTIdentifier& theServerID) const; // count
873  EXPORT int64_t GetTransactionNum(const OTIdentifier& theServerID,
874  int32_t nIndex) const; // index
875 
876  EXPORT bool AddTransactionNum(const OTString& strServerID,
877  int64_t lTransNum); // doesn't save
878 
879  EXPORT bool RemoveTransactionNum(OTPseudonym& SIGNER_NYM,
880  const OTString& strServerID,
881  const int64_t& lTransNum); // server
882  // removes spent
883  // number from
884  // nym file.
885  // Saves.
886  EXPORT bool RemoveTransactionNum(const OTString& strServerID,
887  const int64_t& lTransNum); // doesn't save.
888  // These functions are for tentative transaction numbers that I am trying to
889  // sign for.
890  // They are in my Nymbox. I sign to accept them, and then store them here.
891  // The server
892  // replies with success, and then I remove them from this list, and move
893  // them onto the
894  // two lists above. For good measure, the server also puts a success note
895  // into my Nymbox,
896  // so if the network transport is lost, I will still have the chance to get
897  // my Nymbox,
898  // and see the notices. By this time, the numbers are DEFNITELY ALREADY
899  // CONFIRMED, and
900  // the notices can simply be discarded if the numbers aren't on list
901  // "Tentative" list.
902  // That means they already went through, and were already removed from this
903  // list as
904  // described higher in this paragraph. HOWEVER, if I somehow lost the
905  // message (the
906  // original server success reply when I signed for the numbers) then they
907  // will STILL be
908  // stuck on this list! The notice gives me a chance to officially move them
909  // to the right
910  // place. After all, my transactions won't work until I do, because my
911  // balance agreements
912  // will be wrong.
913  //
914  EXPORT int32_t
915  GetTentativeNumCount(const OTIdentifier& theServerID) const; // count
916  EXPORT int64_t GetTentativeNum(const OTIdentifier& theServerID,
917  int32_t nIndex) const; // index
918 
919  EXPORT bool AddTentativeNum(const OTString& strServerID,
920  const int64_t& lTransNum); // doesn't save
921 
922  EXPORT bool RemoveTentativeNum(OTPseudonym& SIGNER_NYM,
923  const OTString& strServerID,
924  const int64_t& lTransNum);
925  EXPORT bool RemoveTentativeNum(const OTString& strServerID,
926  const int64_t& lTransNum); // doesn't save.
927  // On the client side, whenever the client is DEFINITELY made aware of the
928  // existence of a
929  // server reply, he adds its request number to this list, which is sent
930  // along with all client-side
931  // requests to the server.
932  // The server reads the list on the incoming client message (and it uses
933  // these same functions
934  // to store its own internal list.) If the # already appears on its internal
935  // list, then it does
936  // nothing. Otherwise, it loads up the Nymbox and removes the replyNotice,
937  // and then adds the #
938  // to its internal list.
939  // For any numbers on the internal list but NOT on the client's list, the
940  // server removes from
941  // the internal list. (The client removed them when it saw the server's
942  // internal list, which the
943  // server sends with its replies.)
944  //
945  // This entire protocol, densely described, is unnecessary for OT to
946  // function, but is great for
947  // optimization, as it enables OT to avoid downloading all Box Receipts
948  // containing replyNotices,
949  // as long as the original reply was properly received when the request was
950  // originally sent (which
951  // is MOST of the time...)
952  // Thus we can eliminate most replyNotice downloads, and likely a large % of
953  // box receipt downloads
954  // as well.
955  //
956  EXPORT int32_t
957  GetAcknowledgedNumCount(const OTIdentifier& theServerID) const; // count
958  EXPORT int64_t GetAcknowledgedNum(const OTIdentifier& theServerID,
959  int32_t nIndex) const; // index
960 
961  EXPORT bool AddAcknowledgedNum(const OTString& strServerID,
962  const int64_t& lRequestNum); // doesn't save
963 
964  EXPORT bool RemoveAcknowledgedNum(OTPseudonym& SIGNER_NYM,
965  const OTString& strServerID,
966  const int64_t& lRequestNum);
967  EXPORT bool RemoveAcknowledgedNum(const OTString& strServerID,
968  const int64_t& lRequestNum); // doesn't
969  // save.
970  // The "issued" numbers and the "transaction" numbers both use these
971  // functions
972  // to do the actual work (just avoiding code duplication.) "tentative" as
973  // well,
974  // and "Acknowledged". (For acknowledged replies.)
975  //
976  EXPORT bool VerifyGenericNum(const mapOfTransNums& THE_MAP,
977  const OTString& strServerID,
978  const int64_t& lTransNum) const;
979 
980  EXPORT bool RemoveGenericNum(mapOfTransNums& THE_MAP,
981  OTPseudonym& SIGNER_NYM,
982  const OTString& strServerID,
983  const int64_t& lTransNum); // saves
984  EXPORT bool RemoveGenericNum(mapOfTransNums& THE_MAP,
985  const OTString& strServerID,
986  const int64_t& lTransNum); // doesn't save
987 
988  EXPORT bool AddGenericNum(mapOfTransNums& THE_MAP,
989  const OTString& strServerID,
990  int64_t lTransNum); // doesn't save
991 
992  EXPORT int32_t GetGenericNumCount(const mapOfTransNums& THE_MAP,
993  const OTIdentifier& theServerID) const;
994  EXPORT int64_t GetGenericNum(const mapOfTransNums& THE_MAP,
995  const OTIdentifier& theServerID,
996  int32_t nIndex) const;
997  // Whenever a Nym receives a message via his Nymbox, and then the Nymbox is
998  // processed, (which happens automatically)
999  // that processing will drop all mail messages into this deque for
1000  // safe-keeping, after Nymbox is cleared.
1001  //
1002  EXPORT void AddMail(OTMessage& theMessage); // a mail message is the
1003  // original OTMessage from the
1004  // sender, transported via
1005  // Nymbox of recipient (me).
1006  EXPORT int32_t GetMailCount() const; // How many mail messages does this Nym
1007  // currently store?
1008  EXPORT OTMessage* GetMailByIndex(int32_t nIndex) const; // Get a
1009  // specific
1010  // piece of mail, at
1011  // a specific index.
1012  EXPORT bool RemoveMailByIndex(int32_t nIndex); // if returns false,
1013  // mail index was bad
1014  // (or something else
1015  // must have gone
1016  // seriously wrong.)
1017 
1018  EXPORT void ClearMail(); // called by the destructor. (Not intended to erase
1019  // messages from local storage.)
1020  // Whenever a Nym sends a message, a copy is dropped into his Outmail.
1021  //
1022  EXPORT void AddOutmail(OTMessage& theMessage); // a mail message is the
1023  // original OTMessage that
1024  // this Nym sent.
1025  EXPORT int32_t
1026  GetOutmailCount() const; // How many outmail messages does this Nym
1027  // currently store?
1028  EXPORT OTMessage* GetOutmailByIndex(int32_t nIndex) const; // Get a
1029  // specific
1030  // piece of
1031  // outmail, at a
1032  // specific
1033  // index.
1034  EXPORT bool RemoveOutmailByIndex(int32_t nIndex); // if returns false,
1035  // outmail index was
1036  // bad (or something
1037  // else must have
1038  // gone seriously
1039  // wrong.)
1040 
1041  EXPORT void ClearOutmail(); // called by the destructor. (Not intended to
1042  // erase messages from local storage.)
1043  // Whenever a Nym sends a payment, a copy is dropped into his Outpayments.
1044  // (Payments screen.)
1045  //
1046  EXPORT void AddOutpayments(OTMessage& theMessage); // a payments message is
1047  // the original OTMessage
1048  // that this Nym sent.
1049  EXPORT int32_t
1050  GetOutpaymentsCount() const; // How many outpayments messages does
1051  // this Nym currently store?
1053  int32_t nIndex) const; // Get a specific piece of outpayments, at a
1054  // specific index.
1055  EXPORT bool RemoveOutpaymentsByIndex(int32_t nIndex,
1056  bool bDeleteIt = true); // if returns
1057  // false,
1058  // outpayments index was bad
1059  // (or something else must
1060  // have gone seriously
1061  // wrong.)
1062 
1063  EXPORT void ClearOutpayments(); // called by the destructor. (Not intended
1064  // to erase messages from local storage.)
1065  void ClearCredentials();
1066  void ClearAll();
1067  EXPORT void DisplayStatistics(OTString& strOutput);
1068 };
1069 
1070 } // namespace opentxs
1071 
1072 #endif // OPENTXS_CORE_OTPSEUDONYM_HPP
EXPORT int32_t GetIssuedNumCount(const OTIdentifier &theServerID) const
EXPORT bool SetPrivateKey(const OTString &strKey, bool bEscaped=true)
EXPORT void GetPublicCredentials(OTString &strCredList, OTString::Map *pmapCredFiles=nullptr) const
std::map< std::string, std::string > Map
Definition: OTString.hpp:162
EXPORT bool SetNymboxHash(const std::string &server_id, const OTIdentifier &theInput)
EXPORT bool VerifyIssuedNumbersOnNym(OTPseudonym &THE_NYM)
static EXPORT OTPseudonym * LoadPublicNym(const OTIdentifier &NYM_ID, const OTString *pstrName=nullptr, const char *szFuncName=nullptr)
EXPORT bool SetPublicKey(const OTString &strKey, bool bEscaped=true)
std::list< OTAsymmetricKey * > listOfAsymmetricKeys
EXPORT void ClearMail()
EXPORT void HarvestTransactionNumbers(const OTIdentifier &theServerID, OTPseudonym &SIGNER_NYM, OTPseudonym &theOtherNym, bool bSave=true)
EXPORT const OTSubcredential * GetSubcredential(const OTString &strMasterID, const OTString &strSubCredID) const
static EXPORT bool DoesCertfileExist(const OTString &strNymID)
mapOfTransNums & GetMapTentativeNum()
EXPORT OTItem * GenerateTransactionStatement(const OTTransaction &theOwner)
EXPORT bool ClawbackTransactionNumber(const OTIdentifier &theServerID, const int64_t &lTransClawback, bool bSave=false, OTPseudonym *pSIGNER_NYM=nullptr)
EXPORT bool LoadFromString(const OTString &strNym, OTString::Map *pMapCredentials=nullptr, OTString *pstrReason=nullptr, const OTPassword *pImportPassword=nullptr)
EXPORT bool SetInboxHash(const std::string &acct_id, const OTIdentifier &theInput)
EXPORT void GetIdentifier(OTIdentifier &theIdentifier) const
mapOfTransNums & GetMapTransNum()
EXPORT OTCredential * GetMasterCredential(const OTString &strID)
EXPORT bool SavePublicKey(const OTString &strPath) const
EXPORT bool VerifyIssuedNum(const OTString &strServerID, const int64_t &lTransNum) const
EXPORT void AddOutmail(OTMessage &theMessage)
EXPORT bool GetNextTransactionNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, int64_t &lTransNum, bool bSave=true)
EXPORT bool VerifyTentativeNum(const OTString &strServerID, const int64_t &lTransNum) const
EXPORT bool SetCertificate(const OTString &strCert, bool bEscaped=true)
EXPORT bool RemoveOutmailByIndex(int32_t nIndex)
EXPORT bool SavePseudonymWallet(OTString &strOutput) const
EXPORT const OTAsymmetricKey & GetPublicEncrKey() const
EXPORT int64_t GetTransactionNum(const OTIdentifier &theServerID, int32_t nIndex) const
EXPORT bool GetInboxHash(const std::string &acct_id, OTIdentifier &theOutput) const
EXPORT void GetPrivateCredentials(OTString &strCredList, OTString::Map *pmapCredFiles=nullptr)
EXPORT bool Server_PubKeyExists(OTString *pstrID=nullptr)
std::map< std::string, OTIdentifier > mapOfIdentifiers
std::map< std::string, int64_t > mapOfRequestNums
EXPORT bool RemoveGenericNum(mapOfTransNums &THE_MAP, OTPseudonym &SIGNER_NYM, const OTString &strServerID, const int64_t &lTransNum)
void SetNymName(const OTString &strName)
EXPORT bool ReEncryptPrivateCredentials(bool bImporting, const OTPasswordData *pPWData=nullptr, const OTPassword *pImportPassword=nullptr)
bool RemoveTentativeNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, const int64_t &lTransNum, bool bSave)
EXPORT void AddOutpayments(OTMessage &theMessage)
OTString & GetNymName()
EXPORT bool GetRecentHash(const std::string &server_id, OTIdentifier &theOutput) const
EXPORT bool AddTentativeNum(const OTString &strServerID, const int64_t &lTransNum)
EXPORT bool AddNewSubkey(const OTIdentifier &idMasterCredential, int32_t nBits=1024, const OTString::Map *pmapPrivate=nullptr, const OTPasswordData *pPWData=nullptr, OTString *pstrNewID=nullptr)
EXPORT bool LoadSignedNymfile(OTPseudonym &SIGNER_NYM)
EXPORT void SerializeNymIDSource(OTString &strOutput) const
bool IsMarkedForDeletion() const
EXPORT void SetNymboxHashServerSide(const OTIdentifier &theInput)
EXPORT int32_t GetTransactionNumCount(const OTIdentifier &theServerID) const
std::map< std::string, int64_t > mapOfHighestNums
EXPORT const int64_t & GetUsageCredits() const
EXPORT void HarvestIssuedNumbers(const OTIdentifier &theServerID, OTPseudonym &SIGNER_NYM, OTPseudonym &theOtherNym, bool bSave=false)
EXPORT bool VerifyPseudonym() const
EXPORT void Initialize()
EXPORT int64_t GetGenericNum(const mapOfTransNums &THE_MAP, const OTIdentifier &theServerID, int32_t nIndex) const
std::map< std::string, dequeOfTransNums * > mapOfTransNums
EXPORT void SetIdentifier(const OTIdentifier &theIdentifier)
EXPORT int32_t GetMailCount() const
return the number of mail items available for this Nym.
EXPORT const OTCredential * GetRevokedCredentialByIndex(int32_t nIndex) const
EXPORT void ClearOutpayments()
EXPORT int32_t GetOutpaymentsCount() const
return the number of payments items available for this Nym.
EXPORT bool LoadPublicKey()
EXPORT bool Savex509CertAndPrivateKeyToString(OTString &strOutput, const OTString *pstrReason=nullptr)
EXPORT void ClearOutmail()
EXPORT bool GetHighestNum(const OTString &strServerID, int64_t &lHighestNum) const
EXPORT int32_t GetTentativeNumCount(const OTIdentifier &theServerID) const
EXPORT bool RemoveTransactionNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, const int64_t &lTransNum)
EXPORT bool VerifyTransactionStatementNumbersOnNym(OTPseudonym &THE_NYM)
EXPORT bool GenerateNym(int32_t nBits=1024, bool bCreateFile=true, std::string str_id_source="", std::string str_alt_location="")
EXPORT bool Loadx509CertAndPrivateKey(bool bChecking=false, const OTPasswordData *pPWData=nullptr, const OTPassword *pImportPassword=nullptr)
EXPORT void SaveCredentialListToString(OTString &strOutput)
EXPORT bool AddTransactionNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, int64_t lTransNum, bool bSave)
EXPORT void SaveCredentialsToString(OTString &strOutput, OTString::Map *pmapPubInfo=nullptr, OTString::Map *pmapPriInfo=nullptr)
EXPORT int64_t GetTentativeNum(const OTIdentifier &theServerID, int32_t nIndex) const
EXPORT const OTAsymmetricKey & GetPublicAuthKey() const
EXPORT bool SetIdentifierByPubkey()
EXPORT bool GetCurrentRequestNum(const OTString &strServerID, int64_t &lReqNum) const
EXPORT int64_t UpdateHighestNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, std::set< int64_t > &setNumbers, std::set< int64_t > &setOutputGood, std::set< int64_t > &setOutputBad, bool bSave=false)
EXPORT bool RemoveIssuedNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, const int64_t &lTransNum, bool bSave)
EXPORT void SetUsageCredits(const int64_t &lUsage)
EXPORT int32_t GetPublicKeysBySignature(listOfAsymmetricKeys &listOutput, const OTSignature &theSignature, char cKeyType= '0') const
std::deque< int64_t > dequeOfTransNums
EXPORT bool VerifyGenericNum(const mapOfTransNums &THE_MAP, const OTString &strServerID, const int64_t &lTransNum) const
const OTAsymmetricKey & GetPrivateAuthKey() const
EXPORT void SetNymIDSource(const OTString &strSource)
const OTAsymmetricKey & GetPrivateEncrKey() const
EXPORT int32_t GetOutmailCount() const
return the number of mail items available for this Nym.
EXPORT OTMessage * GetOutmailByIndex(int32_t nIndex) const
EXPORT void ReleaseTransactionNumbers()
EXPORT bool AddNewSubcredential(const OTIdentifier &idMasterCredential, const OTString::Map *pmapPrivate=nullptr, const OTString::Map *pmapPublic=nullptr, const OTPasswordData *pPWData=nullptr)
EXPORT bool RemoveMailByIndex(int32_t nIndex)
EXPORT bool SetOutboxHash(const std::string &acct_id, const OTIdentifier &theInput)
EXPORT bool HasPublicKey()
EXPORT bool AddAcknowledgedNum(const OTString &strServerID, const int64_t &lRequestNum)
EXPORT bool RemoveAcknowledgedNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, const int64_t &lRequestNum, bool bSave)
EXPORT void SetAltLocation(const OTString &strLocation)
mapOfTransNums & GetMapIssuedNum()
EXPORT bool CompareID(const OTIdentifier &theIdentifier) const
static EXPORT OTPseudonym * LoadPrivateNym(const OTIdentifier &NYM_ID, bool bChecking=false, const OTString *pstrName=nullptr, const char *szFuncName=nullptr, const OTPasswordData *pPWData=nullptr, const OTPassword *pImportPassword=nullptr)
EXPORT bool IsRegisteredAtServer(const OTString &strServerID) const
EXPORT const OTString & GetAltLocation() const
EXPORT bool AddGenericNum(mapOfTransNums &THE_MAP, const OTString &strServerID, int64_t lTransNum)
std::list< std::string > List
Definition: OTString.hpp:161
EXPORT OTCredential * GetRevokedCredential(const OTString &strID)
EXPORT bool SetRecentHash(const std::string &server_id, const OTIdentifier &theInput)
virtual EXPORT ~OTPseudonym()
EXPORT const OTAsymmetricKey & GetPublicSignKey() const
EXPORT bool GetNymboxHash(const std::string &server_id, OTIdentifier &theOutput) const
EXPORT bool Loadx509CertAndPrivateKeyFromString(const OTString &strInput, const OTPasswordData *pPWData=nullptr, const OTPassword *pImportPassword=nullptr)
EXPORT bool GetOutboxHash(const std::string &acct_id, OTIdentifier &theOutput) const
EXPORT bool HasPrivateKey()
EXPORT int32_t GetGenericNumCount(const mapOfTransNums &THE_MAP, const OTIdentifier &theServerID) const
EXPORT bool SavePseudonym()
EXPORT int32_t GetAcknowledgedNumCount(const OTIdentifier &theServerID) const
EXPORT void DisplayStatistics(OTString &strOutput)
std::deque< OTMessage * > dequeOfMail
EXPORT void OnUpdateRequestNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID, int64_t lNewRequestNumber)
EXPORT const OTCredential * GetMasterCredentialByIndex(int32_t nIndex) const
EXPORT bool GetNymboxHashServerSide(const OTIdentifier &theServerID, OTIdentifier &theOutput)
EXPORT size_t GetRevokedCredentialCount() const
EXPORT const OTIdentifier & GetConstID() const
EXPORT bool RemoveOutpaymentsByIndex(int32_t nIndex, bool bDeleteIt=true)
EXPORT void RemoveReqNumbers(const OTString *pstrServerID=nullptr)
EXPORT void AddMail(OTMessage &theMessage)
EXPORT const OTString & GetNymIDSource() const
mapOfTransNums & GetMapAcknowledgedNum()
EXPORT bool SaveCredentialList()
std::set< int64_t > & GetSetOpenCronItems()
EXPORT bool ResyncWithServer(const OTLedger &theNymbox, const OTPseudonym &theMessageNym)
EXPORT int64_t GetAcknowledgedNum(const OTIdentifier &theServerID, int32_t nIndex) const
const OTAsymmetricKey & GetPrivateSignKey() const
EXPORT bool CertfileExists()
EXPORT void RemoveAllNumbers(const OTString *pstrServerID=nullptr, bool bRemoveHighestNum=true)
EXPORT bool LoadCredentials(bool bLoadPrivate=false, const OTPasswordData *pPWData=nullptr, const OTPassword *pImportPassword=nullptr)
EXPORT int64_t GetIssuedNum(const OTIdentifier &theServerID, int32_t nIndex) const
EXPORT const OTSubcredential * GetRevokedSubcred(const OTString &strRevokedID, const OTString &strSubCredID) const
EXPORT bool Savex509CertAndPrivateKey(bool bCreateFile=true, const OTString *pstrReason=nullptr)
EXPORT OTMessage * GetOutpaymentsByIndex(int32_t nIndex) const
EXPORT size_t GetMasterCredentialCount() const
std::map< std::string, OTCredential * > mapOfCredentials
EXPORT bool AddIssuedNum(const OTString &strServerID, const int64_t &lTransNum)
EXPORT bool AddNewMasterCredential(OTString &strOutputMasterCredID, const OTString *pstrSourceForNymID=nullptr, int32_t nBits=1024, const OTString::Map *pmapPrivate=nullptr, const OTString::Map *pmapPublic=nullptr, const OTPasswordData *pPWData=nullptr, bool bChangeNymID=false)
std::set< std::string > & GetSetAssetAccounts()
EXPORT bool VerifyAcknowledgedNum(const OTString &strServerID, const int64_t &lRequestNum) const
EXPORT bool UnRegisterAtServer(const OTString &strServerID)
EXPORT OTMessage * GetMailByIndex(int32_t nIndex) const
EXPORT bool VerifyTransactionNum(const OTString &strServerID, const int64_t &lTransNum) const
EXPORT bool SaveSignedNymfile(OTPseudonym &SIGNER_NYM)
EXPORT bool LoadNymfile(const char *szFilename=nullptr)
EXPORT void IncrementRequestNum(OTPseudonym &SIGNER_NYM, const OTString &strServerID)