[ripple/rippled] Allow ed25519 node and validator keys (#2647)

miguelportilla commented on this pull request.

> + auto const m = Manifest::make_Manifest(
+ boost::beast::detail::base64_decode(tokenManifestEd25519));
+ BEAST_EXPECT(m);
+ NodeID const tokenNodeID = calcNodeID(m->masterKey);
+
+ Config c;
+ c.section(SECTION_VALIDATOR_TOKEN).append(tokenBlobEd25519);
+ ValidatorKeys k{c, j};
+
+ BEAST_EXPECT(k.publicKey == tokenPublicKey);
+ BEAST_EXPECT(k.secretKey == tokenSecretKey);
+ BEAST_EXPECT(k.nodeID == tokenNodeID);
+ BEAST_EXPECT(k.manifest == tokenManifestEd25519);
+ BEAST_EXPECT(!k.configInvalid());
+ }
+

Consider condensing all of the config checks into like …
«`
auto configCheck = [&](std::vector< std::pair>> sections)
{
Config c;
for (auto const& s : sections)
c.section(s.first).append(s.second);
ValidatorKeys k{c, j};
BEAST_EXPECT(k.configInvalid());
BEAST_EXPECT(k.publicKey.size() == 0);
BEAST_EXPECT(k.manifest.empty());
};

// invalid validator token
configCheck({{SECTION_VALIDATOR_TOKEN, {«badtoken»}}});

// Cannot specify both
configCheck({
{SECTION_VALIDATION_SEED, {seed}},
{SECTION_VALIDATOR_TOKEN, tokenBlob}});

// Token manifest and private key must match
configCheck({{SECTION_VALIDATOR_TOKEN, invalidTokenBlob}});
«`

Добавить комментарий