-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Hello,
First of all, thank you for your amazing work on OpenPGP! I'm currently developing an app that integrates OpenPGP, but I encountered an issue that I haven't been able to resolve.
Issue
I'm getting the following error when trying to parse an armored public key string:
concatUint8Array: Data must be in the form of a Uint8Array
Context
In a Next.js server action, I attempt to read a public key like this:
"use server";
import * as openpgp from "openpgp";
// and i also tried with
import * as openpgp from "openpgp/lightweight";
// ... some code
const userPublicKey = await openpgp.readKey({
armoredKey: publicKeyString, // Confirmed to be a valid string
});
// ... some code
Despite ensuring that publicKeyString is a valid armored key string, the error persists.
What I've Tried
I have tested this across multiple configurations, including:
- Next.js versions: 14 and 15 (with TypeScript)
- Runtimes: Bun (1.1.26), Node.js (v22.12.0)
- OpenPGP versions: 5 and 6
- Bundlers: Webpack and Turbopack
- Runtimes: Edge and the vanilla Next.js runtime
None of these changes resolved the issue.
Investigation
From stack tracing, the error originates from:
node_modules/@openpgp/web-stream-tools/lib/util.js line 50
function isUint8Array(input) {
return Uint8Array.prototype.isPrototypeOf(input);
}
It seems that something in my environment is affecting this function’s behavior, but I’m unsure what could be causing it.
Request
Could you provide any insights into what might be causing this issue? Is there a potential workaround or fix?
Any help would be greatly appreciated !
Best regards
Clarence