EOSIO / EOSIO/ual-scatter

What is the intended behavior of the "verifyKeyOwnership" function?

Open
#53 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
14
Forks
22
PR merge metrics
No merged PRs in 30d

Description

https://github.com/EOSIO/ual-scatter/blob/fdd40e0bda01cad2b87f759e9d00be95f6c40eba/src/ScatterUser.ts#L51
Calling this function with a 12-character random string as a parameter always returns false.

Modifying the function as follows will do the desired behavior. Is this a bug or is there some other intended situation?
```javascript
public async verifyKeyOwnership(nonce: string, toSign: string, publicKey: string): Promise {
return new Promise((resolve, reject) => {
setTimeout(() => {
reject(new Error('verifyKeyOwnership failed'))
}, 1000)

this.scatter.authenticate(nonce, toSign, publicKey).then(async (res) => {
const pubKey = ecc.recoverHash(res, ecc.sha256(ecc.sha256(toSign) + ecc.sha256(nonce)));
const myKeys = await this.getKeys()
for (const key of myKeys) {
if (key === pubKey) {
resolve(true)
}
}
resolve(false)
})
})
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.