rippled
Loading...
Searching...
No Matches
did.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2019 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_TEST_JTX_DID_H_INCLUDED
21#define RIPPLE_TEST_JTX_DID_H_INCLUDED
22
23#include <test/jtx/Account.h>
24#include <test/jtx/Env.h>
25#include <test/jtx/owners.h>
26
27namespace ripple {
28namespace test {
29namespace jtx {
30
32namespace did {
33
35set(jtx::Account const& account);
36
38setValid(jtx::Account const& account);
39
42{
43private:
45
46public:
47 explicit document(std::string const& u) : document_(strHex(u))
48 {
49 }
50
51 void
53 {
54 jtx.jv[sfDIDDocument.jsonName] = document_;
55 }
56};
57
59class uri
60{
61private:
63
64public:
65 explicit uri(std::string const& u) : uri_(strHex(u))
66 {
67 }
68
69 void
71 {
72 jtx.jv[sfURI.jsonName] = uri_;
73 }
74};
75
77class data
78{
79private:
81
82public:
83 explicit data(std::string const& u) : data_(strHex(u))
84 {
85 }
86
87 void
89 {
90 jtx.jv[sfData.jsonName] = data_;
91 }
92};
93
95del(jtx::Account const& account);
96
97} // namespace did
98
99} // namespace jtx
100
101} // namespace test
102} // namespace ripple
103
104#endif
Represents a JSON value.
Definition json_value.h:149
Immutable cryptographic account descriptor.
Definition Account.h:39
A transaction testing environment.
Definition Env.h:121
Sets the optional Attestation on a DIDSet.
Definition did.h:78
data(std::string const &u)
Definition did.h:83
void operator()(jtx::Env &, jtx::JTx &jtx) const
Definition did.h:88
Sets the optional DIDDocument on a DIDSet.
Definition did.h:42
void operator()(jtx::Env &, jtx::JTx &jtx) const
Definition did.h:52
document(std::string const &u)
Definition did.h:47
Sets the optional URI on a DIDSet.
Definition did.h:60
void operator()(jtx::Env &, jtx::JTx &jtx) const
Definition did.h:70
uri(std::string const &u)
Definition did.h:65
Json::Value del(jtx::Account const &account)
Definition dids.cpp:52
Json::Value setValid(jtx::Account const &account)
Definition dids.cpp:42
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:25
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
std::string strHex(FwdIt begin, FwdIt end)
Definition strHex.h:30
Execution context for applying a JSON transaction.
Definition JTx.h:45
Json::Value jv
Definition JTx.h:46