Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/demo/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@ const nextConfig = {
experimental: {
optimizePackageImports: ["@ckb-ccc/core", "@ckb-ccc/core/bundle"],
},
// SharedArrayBuffer (required by @nervosnetwork/fiber-js WASM) needs
// Cross-Origin-Opener-Policy: same-origin + COEP on the page.
//
// COOP: same-origin severs window.opener in cross-origin wallet popups
// (JoyID, etc.), so it is applied only to /connected/Fiber where the WASM
// runs. Wallet signing is delegated to /fiber-sign-proxy (a same-origin
// popup with no COOP) that relays the signature back via BroadcastChannel.
async headers() {
return [
{
source: "/(.*)",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The source pattern /(.*) applies the COOP and COEP headers to all routes. However, the comments on lines 9-12 state that these headers should only be applied to /connected/Fiber because they break cross-origin wallet popups (like JoyID) used on other pages. Applying these headers globally will break wallet functionality for the rest of the application, including the /fiber-sign-proxy mentioned in the comments.

Suggested change
source: "/(.*)",
source: "/connected/Fiber",

headers: [
{ key: "Cross-Origin-Opener-Policy", value: "same-origin" },
{ key: "Cross-Origin-Embedder-Policy", value: "require-corp" },
],
},
];
},
};

export default nextConfig;
1 change: 1 addition & 0 deletions packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"@eslint/eslintrc": "^3.3.1",
"@headlessui/react": "^2.2.7",
"@heroicons/react": "^2.2.0",
"@nervosnetwork/fiber-js": "0.8.1",
"@scure/bip32": "^2.0.0",
"@scure/bip39": "^2.0.0",
"@tailwindcss/postcss": "^4.1.12",
Expand Down
Loading
Loading