mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2026-03-20 23:28:58 +00:00
Internal: improve tree-shaking for crypto modules
Every submodule under the 'crypto' directory was exported-imported even if a handful of functions where actually needed. We now only export entire modules behind default exports if it makes sense for readability and if the different submodules would be imported together anyway (e.g. `cipherMode` exports are all needed by the SEIPD class). We've also dropped exports that are not used outside of the crypto modules, e.g. pkcs5 helpers.
This commit is contained in:
@@ -19,7 +19,7 @@ import * as stream from '@openpgp/web-stream-tools';
|
||||
import { armor, unarmor } from './encoding/armor';
|
||||
import { Argon2OutOfMemoryError } from './type/s2k';
|
||||
import defaultConfig from './config';
|
||||
import crypto from './crypto';
|
||||
import { generateSessionKey } from './crypto';
|
||||
import enums from './enums';
|
||||
import util from './util';
|
||||
import { Signature } from './signature';
|
||||
@@ -255,7 +255,7 @@ export class Message {
|
||||
pkeskPacketCopy.read(serialisedPKESK);
|
||||
const randomSessionKey = {
|
||||
sessionKeyAlgorithm,
|
||||
sessionKey: crypto.generateSessionKey(sessionKeyAlgorithm)
|
||||
sessionKey: generateSessionKey(sessionKeyAlgorithm)
|
||||
};
|
||||
try {
|
||||
await pkeskPacketCopy.decrypt(decryptionKeyPacket, randomSessionKey);
|
||||
@@ -368,7 +368,7 @@ export class Message {
|
||||
})
|
||||
));
|
||||
|
||||
const sessionKeyData = crypto.generateSessionKey(symmetricAlgo);
|
||||
const sessionKeyData = generateSessionKey(symmetricAlgo);
|
||||
return { data: sessionKeyData, algorithm: symmetricAlgoName, aeadAlgorithm: aeadAlgoName };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user