Files
openpgpjs/test/initOpenpgp.js
Daniel Huigens 6ab6b9c842 Tests: use native web streams when TransformStream is available (#1934)
Only load the web streams ponyfill when necessary (e.g. Safari <14.5 and Mobile Safari <14.1)
2025-12-05 13:59:08 +01:00

20 lines
549 B
JavaScript

/**
* This module centralises the openpgp import and ensures that the module is initialised
* at the top of the test bundle, and that the config is initialised before the tests code runs (incl. that outside of `describe`).
*/
import * as openpgp from 'openpgp';
import * as webStreamsPonyfill from 'web-streams-polyfill';
if (typeof window !== 'undefined') {
window.openpgp = openpgp;
}
openpgp.config.s2kIterationCountByte = 0;
if (!globalThis.TransformStream) {
Object.assign(globalThis, webStreamsPonyfill);
}
export default openpgp;