openpgpjs / openpgpjs/web-stream-tools
Issue with error `concatUint8Array: Data must be in the form of a Uint8Array` using OpenPGP
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 35
- Forks
- 15
- Avg merge
- 1h 23m
- Merged PRs (30d)
- 1
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure in a Next.js server action using openpgp.readKey with the reported armored key input and compare the tested Node.js, Bun, Edge, Webpack, and Turbopack configurations. Start with node_modules/@openpgp/web-stream-tools/lib/util.js at isUint8Array; done means explaining why the input is rejected and documenting or validating a compatible fix or workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bun, javascript, nextjs, nodejs, typescript, webpack
- Domain
- backend, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100