Skip to content

Attester class should understand more than one returned pubkeys #4610

@tomholub

Description

@tomholub
  1. remove unused code + refactor

unrelated to this issue, but I just noticed

      // when requested from the content script, `getResponseHeader` will be missing because it's not a real XMLHttpRequest we are getting back
      // because it had to go through background scripts, and objects are serialized when this happens
      // the proper fix would be to send back headers from bg along with response text, and parse it here
      if (!r.getResponseHeader) {
        return { pubkey: r.responseText };
      }

This can be removed, no longer fulfills any function. Also Attester.doLookup attribute should be email instead of emailOrFingerprint

  1. lookupEmail (and doLookup) should return a list of public keys

the response from API may contain more than one armored public key block. They are concatenated by \n.

Since more than one armored block can be returned, you need to parse them apart with MsgBlockParser.detectBlocks if you get a http 200, then filter only public key blocks from the parsed blocks, and then return the resulting contents as an array of strings in PubkeysSearchResult

For a test, add another email address to attester-endpoints where it returns [pubkey1, pubkey2].join('\n'), then look that up with browser extension compose, and check that both pubkeys were imported.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions