Skip to content

Commit e82d8b2

Browse files
feat(eos-api): support cdt 1.7.0
1 parent b0da08e commit e82d8b2

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

eos_api.hpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -578,24 +578,25 @@ bool __oraclize_randomDS_matchBytes32Prefix(const eosio::checksum256 content, co
578578

579579
bool __oraclize_randomDS_test_pubkey_signature(const uint8_t whatever, const uint8_t v, const uint8_t r[32], const uint8_t s[32], const eosio::checksum256 digest, const uint8_t pubkey[64])
580580
{
581-
eosio::signature sig;
581+
eosio::webauthn_signature sig;
582+
//eosio::signature sig;
582583

583-
sig.type = whatever;
584-
sig.data[0] = v;
584+
//sig.type = whatever;
585+
sig.auth_data[0] = v;
585586
for (int i = 0; i < 32; i++)
586-
sig.data[i + 1] = r[i];
587+
sig.auth_data[i + 1] = r[i];
587588
for (int i = 0; i < 32; i++)
588-
sig.data[i + 1 + 32] = s[i];
589+
sig.auth_data[i + 1 + 32] = s[i];
589590

590-
const eosio::public_key pubkey_recovered = recover_key(digest, sig);
591+
const eosio::webauthn_public_key pubkey_recovered = get<eosio::webauthn_public_key>(recover_key(digest, sig));
591592

592-
if (pubkey_recovered.data.size() != 33)
593+
if (pubkey_recovered.key.size() != 33)
593594
return false;
594-
if (pubkey_recovered.data[0] != 0x02 && pubkey_recovered.data[0] != 0x03)
595+
if (pubkey_recovered.key[0] != 0x02 && pubkey_recovered.key[0] != 0x03)
595596
return false;
596597
// Discard the first (0x00) and the second byte (0x02 or 0x03)
597598
for (int i = 0; i < 32; i++)
598-
if ((uint8_t)pubkey_recovered.data[i + 1] != pubkey[i])
599+
if ((uint8_t)pubkey_recovered.key[i + 1] != pubkey[i])
599600
return false;
600601
return true;
601602
}

0 commit comments

Comments
 (0)