mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-utils.git
synced 2026-11-05 16:51:07 +00:00
Sign the root over WalletConnect (#83)
* Sign the root over WalletConnect Wallet 1.3.0's DApp browser never delivers injected-provider requests, so the page could not get a signature from any installed wallet. WalletConnect is the route installed wallets answer: on the phone the page opens the wallet by its pezkuwiwallet://wc link, elsewhere it shows a code for the wallet to scan, then asks for polkadot_signMessage on <Bytes>payload</Bytes>. Measured over a real session on the 1.3.0 signing code: the signature verifies under the "substrate" context, which is what the thresholds count. The injected provider stays as a second button for wallets where it works. The WalletConnect bundle is built from scripts/root/wc (pinned versions, node build.mjs). * Open the wallet by a fixed link, not the peer's redirect The redirect in a WalletConnect session's peer metadata is supplied by whichever wallet connects, so following it let a connecting peer navigate the signing page anywhere, javascript: included.
This commit is contained in:
1 parent
306c65532e
commit
c3bc55d37c
6 files changed
+2078
-58
No files matched your search
@@ -0,0 +1,15 @@
|
||||
// Bundles entry.js into the signing page's vendor directory: npm ci && node build.mjs
|
||||
import { build } from 'esbuild';
|
||||
|
||||
await build({
|
||||
entryPoints: ['entry.js'],
|
||||
bundle: true,
|
||||
format: 'iife',
|
||||
globalName: 'RootSigningWC',
|
||||
platform: 'browser',
|
||||
target: 'es2020',
|
||||
outfile: '../../../docs/root-signing/vendor/walletconnect.js',
|
||||
minify: true,
|
||||
legalComments: 'eof',
|
||||
define: { 'process.env.NODE_ENV': '"production"', global: 'globalThis' },
|
||||
});
|
||||
@@ -0,0 +1,10 @@
|
||||
// WalletConnect for the root signing page: the sign client and a QR encoder, as window.RootSigningWC.
|
||||
// Buffer and process are what WalletConnect's dependencies expect a browser to have.
|
||||
import { Buffer } from 'buffer';
|
||||
import process from 'process';
|
||||
if (typeof globalThis.Buffer === 'undefined') globalThis.Buffer = Buffer;
|
||||
if (typeof globalThis.process === 'undefined') globalThis.process = process;
|
||||
if (!globalThis.process.version) globalThis.process.version = 'v18.0.0';
|
||||
|
||||
export { SignClient } from '@walletconnect/sign-client';
|
||||
export { toDataURL as qrDataUrl } from 'qrcode';
|
||||
Generated
+1843
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "pezkuwi-root-signing-walletconnect",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"description": "Builds docs/root-signing/vendor/walletconnect.js: node build.mjs",
|
||||
"dependencies": {
|
||||
"@walletconnect/sign-client": "2.23.9",
|
||||
"buffer": "6.0.3",
|
||||
"process": "0.11.10",
|
||||
"qrcode": "1.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "0.28.1"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user