Skip to content

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

@gtolarc

Description

@gtolarc

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)
      })
    })
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions