EOSIO / eosjs-ecc

Elliptic curve cryptography functions: Private Key, Public Key, Signature, AES, Encryption, Decryption
288 stars 119 forks source link

No delimiter in string, cannot determine type Error #11

Closed yepp4you closed 6 years ago

yepp4you commented 6 years ago

It seems that the signature has changed in eos. It seems that we need to make changes. libraries/fc/src/crypto/signature.cpp static signature::storage_type parse_base58(const std::string& base58str) { constexpr auto prefix = config::signature_base_prefix;

  const auto pivot = base58str.find('_');
  FC_ASSERT(pivot != std::string::npos, "No delimiter in string, cannot determine type: ${str}", ("str", base58str));

  const auto prefix_str = base58str.substr(0, pivot);
  FC_ASSERT(prefix == prefix_str, "Signature Key has invalid prefix: ${str}", ("str", base58str)("prefix_str", prefix_str));

  auto data_str = base58str.substr(pivot + 1);
  FC_ASSERT(!data_str.empty(), "Signature has no data: ${str}", ("str", base58str));
  return base58_str_parser<signature::storage_type, config::signature_prefix>::apply(data_str);

}

Error Log ==> https://github.com/EOSIO/eos/commit/f55f431f8fb4d91e8d872d281ffd3a1cd9de3758#diff-41a221719ab6bb16c1ddaf8a235c9a47

jcalfee commented 6 years ago

I need to sync this fix with an eosio release. Please consider the dawn3 release DAWN-2018-04-23-ALPHA in the mean time. Does this work for you?

jcalfee commented 6 years ago

New private, public, and signature prefixes (w/legacy fallback): https://github.com/EOSIO/eos/commit/573be193254661b1c9d47b4467080ed992dac15c

Delimiter changed from . to _ https://github.com/EOSIO/eos/commit/f55f431f8fb4d91e8d872d281ffd3a1cd9de3758

EOS => PUBR1 (public key w/legacy fallback) unit tests EOS => SIGK1 (rename signature prefix) PVT => private key prefix

jcalfee commented 6 years ago

The signature error is fixed and published under: eosjs@10.0.0 (also eosjs@dawn3) ..

BinaryFocus commented 6 years ago

I've just tested this and it seems to be working. Thank you!

nsjames commented 6 years ago

They must be driving you crazy James :)

crypto5000 commented 6 years ago

Confirmed. Now works for me, too. James is a rock star with these turnarounds.

jcalfee commented 6 years ago

The other changes are moved to this ticket: https://github.com/EOSIO/eosjs-ecc/issues/12