diff --git a/src/ValidatorKeys.cpp b/src/ValidatorKeys.cpp index 7e2f6f4..c66eaa6 100644 --- a/src/ValidatorKeys.cpp +++ b/src/ValidatorKeys.cpp @@ -1,23 +1,3 @@ -//------------------------------------------------------------------------------ -/* - This file is part of validator-keys-tool: - https://github.com/ripple/validator-keys-tool - Copyright (c) 2016 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - #include #include @@ -33,7 +13,7 @@ #include -namespace ripple { +namespace xrpl { std::string ValidatorToken::toString() const @@ -42,7 +22,7 @@ ValidatorToken::toString() const jv["validation_secret_key"] = strHex(secretKey); jv["manifest"] = manifest; - return ripple::base64_encode(to_string(jv)); + return xrpl::base64_encode(to_string(jv)); } ValidatorKeys::ValidatorKeys(KeyType const& keyType) @@ -229,8 +209,8 @@ ValidatorKeys::createValidatorToken(KeyType const& keyType) if (!domain_.empty()) st[sfDomain] = makeSlice(domain_); - ripple::sign(st, HashPrefix::manifest, keyType, tokenSecret); - ripple::sign( + xrpl::sign(st, HashPrefix::manifest, keyType, tokenSecret); + xrpl::sign( st, HashPrefix::manifest, keyType_, keys_.secretKey, sfMasterSignature); Serializer s; @@ -241,7 +221,7 @@ ValidatorKeys::createValidatorToken(KeyType const& keyType) std::copy(s.begin(), s.end(), std::back_inserter(manifest_)); return ValidatorToken{ - ripple::base64_encode(manifest_.data(), manifest_.size()), tokenSecret}; + xrpl::base64_encode(manifest_.data(), manifest_.size()), tokenSecret}; } std::string @@ -253,7 +233,7 @@ ValidatorKeys::revoke() st[sfSequence] = std::numeric_limits::max(); st[sfPublicKey] = keys_.publicKey; - ripple::sign( + xrpl::sign( st, HashPrefix::manifest, keyType_, keys_.secretKey, sfMasterSignature); Serializer s; @@ -263,14 +243,14 @@ ValidatorKeys::revoke() manifest_.reserve(s.size()); std::copy(s.begin(), s.end(), std::back_inserter(manifest_)); - return ripple::base64_encode(manifest_.data(), manifest_.size()); + return xrpl::base64_encode(manifest_.data(), manifest_.size()); } std::string ValidatorKeys::sign(std::string const& data) const { return strHex( - ripple::sign(keys_.publicKey, keys_.secretKey, makeSlice(data))); + xrpl::sign(keys_.publicKey, keys_.secretKey, makeSlice(data))); } void @@ -311,4 +291,4 @@ ValidatorKeys::domain(std::string d) domain_ = std::move(d); } -} // namespace ripple +} // namespace xrpl diff --git a/src/ValidatorKeys.h b/src/ValidatorKeys.h index 3741c45..e80ad0a 100644 --- a/src/ValidatorKeys.h +++ b/src/ValidatorKeys.h @@ -1,23 +1,3 @@ -//------------------------------------------------------------------------------ -/* - This file is part of validator-keys-tool: - https://github.com/ripple/validator-keys-tool - Copyright (c) 2016 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - #include #include @@ -33,7 +13,7 @@ class path; } } // namespace boost -namespace ripple { +namespace xrpl { struct ValidatorToken { @@ -175,4 +155,4 @@ class ValidatorKeys } }; -} // namespace ripple +} // namespace xrpl diff --git a/src/ValidatorKeysTool.cpp b/src/ValidatorKeysTool.cpp index a899234..761674c 100644 --- a/src/ValidatorKeysTool.cpp +++ b/src/ValidatorKeysTool.cpp @@ -1,23 +1,3 @@ -//------------------------------------------------------------------------------ -/* - This file is part of validator-keys-tool: - https://github.com/ripple/validator-keys-tool - Copyright (c) 2016 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - #include #include @@ -73,7 +53,7 @@ runUnitTests() void createKeyFile(boost::filesystem::path const& keyFile) { - using namespace ripple; + using namespace xrpl; if (exists(keyFile)) throw std::runtime_error( @@ -89,7 +69,7 @@ createKeyFile(boost::filesystem::path const& keyFile) void createToken(boost::filesystem::path const& keyFile) { - using namespace ripple; + using namespace xrpl; auto keys = ValidatorKeys::make_ValidatorKeys(keyFile); @@ -107,7 +87,7 @@ createToken(boost::filesystem::path const& keyFile) keys.writeToFile(keyFile); std::cout - << "Update rippled.cfg file with these values and restart rippled:\n\n"; + << "Update rippled.cfg file with these values and restart xrpld:\n\n"; std::cout << "# validator public key: " << toBase58(TokenType::NodePublic, keys.publicKey()) << "\n\n"; std::cout << "[validator_token]\n"; @@ -123,7 +103,7 @@ createToken(boost::filesystem::path const& keyFile) void createRevocation(boost::filesystem::path const& keyFile) { - using namespace ripple; + using namespace xrpl; auto keys = ValidatorKeys::make_ValidatorKeys(keyFile); @@ -138,7 +118,7 @@ createRevocation(boost::filesystem::path const& keyFile) keys.writeToFile(keyFile); std::cout - << "Update rippled.cfg file with these values and restart rippled:\n\n"; + << "Update rippled.cfg file with these values and restart xrpld:\n\n"; std::cout << "# validator public key: " << toBase58(TokenType::NodePublic, keys.publicKey()) << "\n\n"; std::cout << "[validator_key_revocation]\n"; @@ -151,9 +131,9 @@ createRevocation(boost::filesystem::path const& keyFile) } void -attestDomain(ripple::ValidatorKeys const& keys) +attestDomain(xrpl::ValidatorKeys const& keys) { - using namespace ripple; + using namespace xrpl; if (keys.domain().empty()) { @@ -180,7 +160,7 @@ attestDomain(ripple::ValidatorKeys const& keys) void attestDomain(boost::filesystem::path const& keyFile) { - using namespace ripple; + using namespace xrpl; auto keys = ValidatorKeys::make_ValidatorKeys(keyFile); @@ -194,7 +174,7 @@ attestDomain(boost::filesystem::path const& keyFile) void setDomain(std::string const& domain, boost::filesystem::path const& keyFile) { - using namespace ripple; + using namespace xrpl; auto keys = ValidatorKeys::make_ValidatorKeys(keyFile); @@ -230,7 +210,7 @@ setDomain(std::string const& domain, boost::filesystem::path const& keyFile) std::cout << "\n"; std::cout << "You also need to update the rippled.cfg file to add a new\n"; - std::cout << "validator token and restart rippled:\n\n"; + std::cout << "validator token and restart xrpld:\n\n"; std::cout << "# validator public key: " << toBase58(TokenType::NodePublic, keys.publicKey()) << "\n\n"; std::cout << "[validator_token]\n"; @@ -246,7 +226,7 @@ setDomain(std::string const& domain, boost::filesystem::path const& keyFile) void signData(std::string const& data, boost::filesystem::path const& keyFile) { - using namespace ripple; + using namespace xrpl; if (data.empty()) throw std::runtime_error( @@ -266,7 +246,7 @@ generateManifest( std::string const& type, boost::filesystem::path const& keyFile) { - using namespace ripple; + using namespace xrpl; auto keys = ValidatorKeys::make_ValidatorKeys(keyFile); diff --git a/src/ValidatorKeysTool.h b/src/ValidatorKeysTool.h index 90ce4cb..2a3a925 100644 --- a/src/ValidatorKeysTool.h +++ b/src/ValidatorKeysTool.h @@ -1,23 +1,3 @@ -//------------------------------------------------------------------------------ -/* - This file is part of validator-keys-tool: - https://github.com/ripple/validator-keys-tool - Copyright (c) 2016 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - #include #include diff --git a/src/test/KeyFileGuard.h b/src/test/KeyFileGuard.h index 842c092..e5e2d74 100644 --- a/src/test/KeyFileGuard.h +++ b/src/test/KeyFileGuard.h @@ -1,29 +1,10 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright 2016 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - #include #include #include -namespace ripple { +namespace xrpl { /** Write a key file dir and remove when done. @@ -75,4 +56,4 @@ class KeyFileGuard } }; -} // namespace ripple +} // namespace xrpl diff --git a/src/test/ValidatorKeysTool_test.cpp b/src/test/ValidatorKeysTool_test.cpp index 4bf6aaf..bb73e0e 100644 --- a/src/test/ValidatorKeysTool_test.cpp +++ b/src/test/ValidatorKeysTool_test.cpp @@ -1,22 +1,3 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright 2016 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - #include #include @@ -24,7 +5,7 @@ #include -namespace ripple { +namespace xrpl { namespace tests { @@ -309,8 +290,8 @@ class ValidatorKeysTool_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(ValidatorKeysTool, keys, ripple); +BEAST_DEFINE_TESTSUITE(ValidatorKeysTool, keys, xrpl); } // namespace tests -} // namespace ripple +} // namespace xrpl diff --git a/src/test/ValidatorKeys_test.cpp b/src/test/ValidatorKeys_test.cpp index 0299275..d101818 100644 --- a/src/test/ValidatorKeys_test.cpp +++ b/src/test/ValidatorKeys_test.cpp @@ -1,22 +1,3 @@ -//------------------------------------------------------------------------------ -/* - This file is part of rippled: https://github.com/ripple/rippled - Copyright 2016 Ripple Labs Inc. - - Permission to use, copy, modify, and/or distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ -//============================================================================== - #include #include @@ -26,7 +7,7 @@ #include #include -namespace ripple { +namespace xrpl { namespace tests { @@ -203,7 +184,7 @@ class ValidatorKeys_test : public beast::unit_test::suite derivePublicKey(tokenKeyType, token->secretKey); STObject st(sfGeneric); - auto const manifest = ripple::base64_decode(token->manifest); + auto const manifest = xrpl::base64_decode(token->manifest); SerialIter sit(manifest.data(), manifest.size()); st.set(sit); @@ -251,7 +232,7 @@ class ValidatorKeys_test : public beast::unit_test::suite auto const revocation = keys.revoke(); STObject st(sfGeneric); - auto const manifest = ripple::base64_decode(revocation); + auto const manifest = xrpl::base64_decode(revocation); SerialIter sit(manifest.data(), manifest.size()); st.set(sit); @@ -405,8 +386,8 @@ class ValidatorKeys_test : public beast::unit_test::suite } }; -BEAST_DEFINE_TESTSUITE(ValidatorKeys, keys, ripple); +BEAST_DEFINE_TESTSUITE(ValidatorKeys, keys, xrpl); } // namespace tests -} // namespace ripple +} // namespace xrpl