Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gtolarc opened this issue Oct 22, 2019 · 0 comments
Open

Comments

@gtolarc
Copy link

gtolarc commented Oct 22, 2019

public async verifyKeyOwnership(challenge: string): Promise<boolean> {

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?

public async verifyKeyOwnership(nonce: string, toSign: string, publicKey: string): Promise<boolean> {
    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)
      })
    })
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant