Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Browser Extension (Chrome MV3) compatibility: wallet.sync() fails due to CSP restrictions

Đang mở
#141 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
typescript, wasm
Lĩnh vực
frontend, security, web-dev

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện lỗi Manifest V3 với WebWallet, wallet.sync() và initThreadPool(8), sau đó theo dõi việc sử dụng worker và eval. So sánh điều này với sync tùy chỉnh của CipherScan và đường dẫn pczt_create để xác định liệu có tồn tại một cách tiếp cận single-threaded hoặc tương thích với cơ sở dữ liệu được hỗ trợ hay không; hoàn tất khi có một luồng giao dịch tương thích với MV3 được ghi lại hoặc hoạt động được.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Browser Extension (Chrome MV3) Compatibility Issue

🐛 Problem

I'm building a Zcash wallet browser extension using WebZjs, but encountering compatibility issues with Chrome Manifest V3's strict Content Security Policy (CSP).

🔍 Details

Environment:

  • Chrome Extension with Manifest V3
  • @chainsafe/webzjs-wallet (latest version)
  • Zcash testnet
  • CSP: script-src 'self' 'wasm-unsafe-eval'

Issue:

Chrome MV3 disallows eval() and new Function() for security reasons. This breaks WebZjs's sync mechanism:

// ❌ Fails in Chrome MV3
await wallet.sync();
// Error: eval() is not allowed in Chrome extensions

await initThreadPool(8);
// Error: Web Workers cannot use eval()Root cause:

  • wallet.sync() spawns Web Workers using eval() internally
  • initThreadPool() also relies on eval() for multi-threading
  • Chrome MV3 CSP blocks these operations
🔧 Current Workaround

I've implemented a custom sync using CipherScan's WASM for client-side decryption:

// ✅ Works: Custom sync with WASM
const compactBlocks = await fetchCompactBlocks(startHeight, endHeight);
const matches = await batch_filter_compact_outputs(compactBlocks, viewingKey);
const balance = calculateBalance(matches); // 0.02 ZEC ✅However, this creates a critical issue:

// WebZjs's internal database is EMPTY (never synced)
await wallet.propose_transfer(accountId, toAddress, amount);
// ❌ Error: "insufficient balance" (WebZjs DB has no notes!)The problem:

  • Custom sync finds funds ✅
  • WebZjs DB remains empty ❌
  • propose_transfer() can't find notes to spend ❌
❓ Questions

Is there a way to:

  1. Use WebZjs sync in single-threaded mode (without eval/Web Workers)?

    • Does WebZjs have a fallback sync mechanism compatible with MV3?
  2. Manually populate WebZjs database with notes from custom sync?

    • Can we inject notes/nullifiers into WebZjs's internal DB?
  3. Use alternative transaction API (PCZTs?) that doesn't require DB sync?
    // Does this work without wallet.sync()?
    const pczt = await wallet.pczt_create(accountId, toAddress, value);

    💡 Why This Matters

Browser extensions are a common use case for crypto wallets (Metamask, Phantom, Rabby, etc.). Chrome MV3 is now mandatory for all new extensions.

Making WebZjs compatible with MV3 would:

  • ✅ Enable Zcash browser wallet extensions
  • ✅ Improve Zcash ecosystem adoption
  • ✅ Align with industry standards (all major wallets support MV3)
📝 Reproduction Steps
  1. Create Chrome Extension (Manifest V3)
  2. Add CSP: "content_security_policy": { "extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'" }
  3. Initialize WebZjs: const wallet = new WebWallet("test", lightwalletdUrl, 10);
  4. Try to sync: await wallet.sync(); → Fails with CSP error
🙏 Request

Any guidance on MV3-compatible sync or transaction building would be greatly appreciated!

Ngôn ngữ chính
TypeScript
Star
43
Fork
32
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ChainSafe/WebZjs

Tất cả issue của ChainSafe/WebZjs

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.