fork-openpgpjs/src/key/index.js
larabr f028026217
Replace Key with PrivateKey and PublicKey classes (#1300)
- Add `PrivateKey` and `PublicKey` classes. A `PrivateKey` can always
  be passed where a `PublicKey` key is expected, but not vice versa.
- Unexport `Key`, and export `PrivateKey` and `PublicKey`. 
- Rename `Key.packetlist2structure` to `Key.packetListToStructure`.
- Change `Key.update` to return a new updated key, rather than
  modifying the destination one in place.
- Add `openpgp.readPrivateKey` and `openpgp.readPrivateKeys` to avoid
  having to downcast the result of `readKey(s)` in TypeScript.
2021-05-25 19:18:47 +02:00

34 lines
524 B
JavaScript

import {
readKey,
readKeys,
readPrivateKey,
readPrivateKeys,
generate,
reformat
} from './factory';
import {
getPreferredAlgo,
isAEADSupported,
getPreferredHashAlgo,
createSignaturePacket
} from './helper';
import PrivateKey from './private_key.js';
import PublicKey from './public_key.js';
export {
readKey,
readKeys,
readPrivateKey,
readPrivateKeys,
generate,
reformat,
getPreferredAlgo,
isAEADSupported,
getPreferredHashAlgo,
createSignaturePacket,
PrivateKey,
PublicKey
};