Skip to content

choose usable signing key for outgoing messages #1532

@tomholub

Description

@tomholub

I'll create a separate issue for the actual fix: the iOS app should carefully choose the signing key.

If private keys contain at least one key that is usable for signing, then use that. Else show error None of your account keys are usable for signing

Something like on the browser:

  private static chooseSigningKeyAndDecryptIt = async (
    view: ComposeView,
    senderKis: KeyInfoWithIdentity[]
  ): Promise<ParsedKeyInfo | undefined> => {
    const parsedSenderPrvs = await KeyStoreUtil.parse(senderKis);
    // to consider - currently we choose first valid key for signing. Should we sign with all?
    //   alternatively we could use most recenlty modified valid key
    const parsedSenderPrv = parsedSenderPrvs.find(k => k.key.usableForSigning);
    if (!parsedSenderPrv) {
      throw Error("None of your account keys are usable for signing")
    }
    return await view.storageModule.decryptSenderKey(parsedSenderPrv);
  };
}

Then this test has to be updated:

      await NewMessageScreen.clickSendButton();
      //TODO need to fix, the error should not be displayed for this case
      await BaseScreen.checkModalMessage(noPrivateKeyError);

and also this test will change:

    const noPrivateKeyError = 'Error\n' +
      'Could not compose message\n' +
      '\n' +
      'Error: Error encrypting message: Could not find valid key packet for signing in key bf79556b2cad5c1e';

Originally posted by @tomholub in #1526 (comment)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions