Angular: Validate PGP public key without openpgp library

39 Views Asked by At

In my Angular 15 project, I want to validate a PGP public key (user input) before sending it to the backend. This would work perfectly with openpgp:

import { readKey } from 'openpgp';

...

async validatePgpKey(keyString: string): Promise<boolean> {
  try {
    await readKey({ armoredKey: keyString });
    return true;
  } catch (error) {
    return false;
  }
}

Due to the license (LGPL-3.0+) I cannot use this approach in the current project.

Apart from a manual implementation, I could not find a library that could take over this task. That surprises me.

0

There are 0 best solutions below