eosio-swift icon indicating copy to clipboard operation
eosio-swift copied to clipboard

PVT_K1 is a legacy WIF key

Open Mattijah opened this issue 5 years ago • 0 comments

The key returned by toEosioK1PrivateKey is in the legacy (WIF) format, while the actual PVT_K1 keys as for example PVT_K1_2QiGfgPuTfYxupXz4vAPGgeC3fCp2AJV23Lxxuuv6xxbUgND51 are not supported.

https://github.com/EOSIO/eosio-swift/blob/06a42e991bf55b68104292338d2796e3580d8be0/EosioSwift/Extensions/EosioKeySignatureExtensions.swift#L116-L118

Data(eosioPrivateKey:) fails when trying to initialize it with the key shown above.

https://github.com/EOSIO/eosio-swift/blob/06a42e991bf55b68104292338d2796e3580d8be0/EosioSwift/Extensions/EosioKeySignatureExtensions.swift#L227

Edit 1: There is already a logic in place for checking the checksum of the new key, but for some reason it's only used for R1.

https://github.com/EOSIO/eosio-swift/blob/06a42e991bf55b68104292338d2796e3580d8be0/EosioSwift/Extensions/EosioKeySignatureExtensions.swift#L217-L218

Edit 2: All test cases testing the private keys contain a fail message that talks about converting a public key.

https://github.com/EOSIO/eosio-swift/blob/0feb06fa8b38ca2f67f10c3318e0f8acbea9bafb/EosioSwiftTests/EosioKeySignatureExtensionTests.swift#L98

Mattijah avatar Nov 17 '20 11:11 Mattijah