Skip to content
Snippets Groups Projects

18: added c++ library

Open Alexander Holodov requested to merge 18-supported_cpp into master

Closes #18

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
cppstruct.go 0 → 100644
108 func (g *generator) generateMap(typ reflect.Type) (printer, error) {
109 if typ.Kind() != reflect.Map {
110 panic("bad type " + typ.String() + ", wanted map")
111 }
112
113 if !isSimpleType(typ.Key()) {
114 return nil, fmt.Errorf("key can't be complex type for map: %s", typ.Name())
115 }
116
117 keyType, err := g.getTypeName(typ.Key())
118 if err != nil {
119 return nil, fmt.Errorf("can't get key type")
120 }
121
122 elem := typ.Elem()
123 for elem.Kind() == reflect.Ptr {
  • This is great!

  • Damyan Mitev added 1 deleted label

    added 1 deleted label

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 41dda269 - 18 prevent useless allocates

    Compare with previous version

  • added 1 commit

    • e8f39da1 - 18 prevent useless allocates

    Compare with previous version

  • Alexander Holodov mentioned in issue #17

    mentioned in issue #17

  • Alexander Holodov removed reviewed + 1 deleted label

    removed reviewed + 1 deleted label

  • @damyan.mitev, @gospodin.bodurov could you please review again i've added secret storage for keys

  • cpp/demo.cpp 0 → 100644
    1 #include <iostream>
    2 #include <string>
    3 #include "secret_store.hpp"
    4 #include "vereign.hpp"
    5
    6
    7 int main(void) {
    8 vereign::init();
    9
    10 vereign::SecretStore store("./pkey");
  • 3
    4 #include <string>
    5 #include <fstream>
    6 #include <streambuf>
    7 #include <random>
    8
    9 #include <openssl/evp.h>
    10 #include <openssl/aes.h>
    11 #include <openssl/rand.h>
    12
    13
    14 #include "json.hpp"
    15
    16 namespace vereign {
    17
    18 class SecretStore {
  • cpp/vereign.hpp 0 → 100644
    16 namespace vereign {
    17
    18 const std::string login_url = "/identity/login";
    19
    20 void init() {
    21 curl_global_init(CURL_GLOBAL_ALL);
    22 }
    23
    24
    25
    26 struct RemoveGuardedForm {
    27 std::string guardedUUID;
    28 std::string entityUUID;
    29 };
    30
    31 void to_json(nlohmann::json &j, const RemoveGuardedForm &t) {
  • cpp/vereign.hpp 0 → 100644
    1807 std::string session;
    1808 std::string some;
    1809 };
    1810
    1811 void from_json(const nlohmann::json &j, VereignLoginResponse &l) {
    1812 j.at("Uuid").get_to(l.uuid);
    1813 j.at("Session").get_to(l.session);
    1814 }
    1815
    1816 class API {
    1817 std::string url;
    1818
    1819 public:
    1820 API(std::string url) : url(url) {};
    1821
    1822 std::string EntityRemoveMember(const VereignAccount &account, const RemoveMemberForm& inp);
  • cpp/vereign.hpp 0 → 100644
    1853 std::vector<Function> PassportListFunctions(const VereignAccount &account);
    1854 std::string ConversationUpdateRecipientEmailStatus(const VereignAccount &account, const UpdateRecipientEmailStatusForm& inp);
    1855 std::string EmailSendFeedback(const VereignAccount &account, const SendFeedbackForm& inp);
    1856 std::string PassportGenerateDIDs(const VereignAccount &account, const GenerateDIDsForm& inp);
    1857 std::string EntitySendClaimCode(const VereignAccount &account, const ClaimSendCodeForm& inp);
    1858 std::string EntityAddGuardian(const VereignAccount &account, const AddGuardianForm& inp);
    1859 std::string EntityRemoveViewer(const VereignAccount &account, const RemoveViewerForm& inp);
    1860 std::string PassportLinkClaim(const VereignAccount &account, const LinkClaimToPassportForm& inp);
    1861 std::vector<EntityMessage_V1> PassportListPassports(const VereignAccount &account);
    1862 std::vector<ConfirmableAction> ActionGetActionsWithoutSession(const VereignAccount &account, const GetActionsForm& inp);
    1863 std::string ConversationInitializeEmailStatus(const VereignAccount &account, const InitializeEmailStatusForm& inp);
    1864 std::string IdentityCancelAction(const VereignAccount &account, const CancelActionForm& inp);
    1865 std::vector<EntityMessage_V1> EntityGetEntity(const VereignAccount &account, const GetEntityForm& inp);
    1866 std::string EntityCreateEntity(const VereignAccount &account, const CreateEntityForm& inp);
    1867 std::string EntityAddViewer(const VereignAccount &account, const AddViewerForm& inp);
    1868 FileInfo DocumentGetFileInfo(const VereignAccount &account);
  • cpp/vereign.hpp 0 → 100644
    1931
    1932 std::string error_code;
    1933 auto data = parse_response_data(result, error_code);
    1934 if (!error_code.empty()) {
    1935 throw "response error";
    1936 }
    1937
    1938 return nlohmann::json::parse(data);
    1939 }
    1940
    1941
    1942 VereignAccount API::LoginWithPublicKey(const std::string &pkey) {
    1943 VereignAccount account = {};
    1944 account.pkey = pkey;
    1945
    1946 VereignLogin login = {"previousaddeddevice"};
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading