/** Create a fulfillment given a secret key and the message */ Ed25519::Ed25519 ( SecretKey const& secretKey, Slice message) { // First derive the public key, and place it in the // payload: ed25519_publickey ( secretKey.data(), payload_.data()); ed25519_sign ( message.data(), message.size(), secretKey.data(), payload_.data(), payload_.data() + pubkey_size_); }
Ed25519::Ed25519 ( SecretKey const& secretKey, PublicKey const& publicKey, Slice message) { if (publicKeyType (publicKey) != KeyType::ed25519) LogicError ("An Ed25519 public key is required."); // When PublicKey wraps an Ed25519 key it prefixes // the key itself with a 0xED byte. We carefully // skip that byte. std::memcpy ( payload_.data(), publicKey.data() + 1, publicKey.size() - 1); // Now sign: ed25519_sign ( message.data(), message.size(), secretKey.data(), payload_.data(), payload_.data() + pubkey_size_); }