diff --git a/test/fuzz/createCleartextMessage.js b/test/fuzz/createCleartextMessage.js index 34190f3f..0b9f9c80 100644 --- a/test/fuzz/createCleartextMessage.js +++ b/test/fuzz/createCleartextMessage.js @@ -1,6 +1,6 @@ import { FuzzedDataProvider } from '@jazzer.js/core'; -import openpgp from '../initOpenpgp.js'; +import { createCleartextMessage } from 'openpgp'; const MAX_MESSAGE_LENGTH = 4096; @@ -10,6 +10,6 @@ const MAX_MESSAGE_LENGTH = 4096; export function fuzz (inputData) { const data = new FuzzedDataProvider(inputData); const text = data.bufToPrintableString(inputData, 2, MAX_MESSAGE_LENGTH, 'utf-8'); - return openpgp.createCleartextMessage({ text }); + return createCleartextMessage({ text }); } diff --git a/test/fuzz/createMessageBinary.js b/test/fuzz/createMessageBinary.js index ef35f2c4..bad7af2c 100644 --- a/test/fuzz/createMessageBinary.js +++ b/test/fuzz/createMessageBinary.js @@ -1,9 +1,9 @@ -import openpgp from '../initOpenpgp.js'; +import { createMessage } from 'openpgp'; /** * @param { Buffer } inputData */ export function fuzz (inputData) { - return openpgp.createMessage({ binary: new Uint8Array(inputData) }); + return createMessage({ binary: new Uint8Array(inputData) }); } diff --git a/test/fuzz/createMessageText.js b/test/fuzz/createMessageText.js index d10fce53..98b4a176 100644 --- a/test/fuzz/createMessageText.js +++ b/test/fuzz/createMessageText.js @@ -1,6 +1,6 @@ import { FuzzedDataProvider } from '@jazzer.js/core'; -import openpgp from '../initOpenpgp.js'; +import { createMessage } from 'openpgp'; const MAX_MESSAGE_LENGTH = 4096; @@ -9,5 +9,5 @@ const MAX_MESSAGE_LENGTH = 4096; */ export function fuzz (inputData) { const data = new FuzzedDataProvider(inputData); - return openpgp.createMessage({ text: data.consumeString(MAX_MESSAGE_LENGTH, 'utf-8') }); + return createMessage({ text: data.consumeString(MAX_MESSAGE_LENGTH, 'utf-8') }); } diff --git a/test/fuzz/generateKey.js b/test/fuzz/generateKey.js index b9887a7c..c192fcb0 100644 --- a/test/fuzz/generateKey.js +++ b/test/fuzz/generateKey.js @@ -1,6 +1,6 @@ import { FuzzedDataProvider } from '@jazzer.js/core'; -import openpgp from '../initOpenpgp.js'; +import { generateKey } from 'openpgp'; const MAX_NAME_LENGTH = 30; const MAX_COMMENT_LENGTH = 500; @@ -14,7 +14,7 @@ export function fuzz (inputData) { const asciiString = data.consumeString(MAX_COMMENT_LENGTH); const utf8String = data.consumeString(MAX_NAME_LENGTH, 'utf-8'); - return openpgp.generateKey({ userIDs: [ + return generateKey({ userIDs: [ { name: utf8String }, { email: utf8String }, { comment: asciiString }, diff --git a/test/fuzz/readKeyArmored.js b/test/fuzz/readKeyArmored.js index a432443f..d56a180a 100644 --- a/test/fuzz/readKeyArmored.js +++ b/test/fuzz/readKeyArmored.js @@ -1,6 +1,6 @@ import { FuzzedDataProvider } from '@jazzer.js/core'; -import openpgp from '../initOpenpgp.js'; +import { readKey } from 'openpgp'; const ignored = ['Misformed armored text']; const MAX_MESSAGE_LENGTH = 4096; @@ -18,7 +18,7 @@ export function fuzz (inputData) { const fuzzedText = data.consumeString(MAX_MESSAGE_LENGTH, 'utf-8'); const armoredKey = `-----BEGIN PGP PRIVATE KEY BLOCK-----\n ${fuzzedText} -----END PGP PRIVATE KEY BLOCK-----`; - return openpgp.readKey({ armoredKey }) + return readKey({ armoredKey }) .catch(error => { if (error.message && !ignoredError(error)) { throw error; diff --git a/test/fuzz/readKeyBinary.js b/test/fuzz/readKeyBinary.js index c837e47a..949fd2f4 100644 --- a/test/fuzz/readKeyBinary.js +++ b/test/fuzz/readKeyBinary.js @@ -1,4 +1,4 @@ -import openpgp from '../initOpenpgp.js'; +import { readKey } from 'openpgp'; const ignored = ['This message / key probably does not conform to a valid OpenPGP format']; @@ -12,7 +12,7 @@ function ignoredError(error) { export function fuzz (inputData) { const binaryKey = new Uint8Array(`-----BEGIN PGP PRIVATE KEY BLOCK-----\n ${inputData.toString('base64')} -----END PGP PRIVATE KEY BLOCK-----`); - return openpgp.readKey({ binaryKey }) + return readKey({ binaryKey }) .catch(error => { if (error.message && !ignoredError(error)) { throw error; diff --git a/test/fuzz/readMessageArmored.js b/test/fuzz/readMessageArmored.js index 61370b1e..3f730bc5 100644 --- a/test/fuzz/readMessageArmored.js +++ b/test/fuzz/readMessageArmored.js @@ -1,6 +1,6 @@ import { FuzzedDataProvider } from '@jazzer.js/core'; -import openpgp from '../initOpenpgp.js'; +import { readMessage } from 'openpgp'; const ignored = ['Misformed armored text']; const MAX_MESSAGE_LENGTH = 4096; @@ -17,7 +17,7 @@ export function fuzz (inputData) { const fuzzedText = data.consumeString(MAX_MESSAGE_LENGTH, 'utf-8'); const armoredMessage = `-----BEGIN PGP MESSAGE-----\n ${fuzzedText} -----END PGP MESSAGE-----`; - return openpgp.readMessage({ armoredMessage }) + return readMessage({ armoredMessage }) .catch(error => { if (error.message && !ignoredError(error)) { throw error; diff --git a/test/fuzz/readMessageBinary.js b/test/fuzz/readMessageBinary.js index f171b1ec..f06613d5 100644 --- a/test/fuzz/readMessageBinary.js +++ b/test/fuzz/readMessageBinary.js @@ -1,4 +1,4 @@ -import openpgp from '../initOpenpgp.js'; +import { readMessage } from 'openpgp'; const ignored = ['This message / key probably does not conform to a valid OpenPGP format']; @@ -12,7 +12,7 @@ function ignoredError(error) { export function fuzz (inputData) { const binaryMessage = new Uint8Array(`-----BEGIN PGP MESSAGE-----\n ${inputData.toString('base64')} -----END PGP MESSAGE-----`); - return openpgp.readMessage({ binaryMessage }) + return readMessage({ binaryMessage }) .catch(error => { if (error.message && !ignoredError(error)) { throw error;