Merge branch 'uri-to-key' into 'master'

Add uri to relay private key generation

See merge request riftenlabs/lib/wizardconnect!3
This commit is contained in:
Dagur Valberg Johannsson 2026-03-09 14:38:24 +00:00
commit 451b19c32d
5 changed files with 8 additions and 8 deletions

View file

@ -37,7 +37,7 @@ async function buildAdapter(
walletName: "wiz-test CLI wallet",
walletIcon: "",
getRelayPrivateKey(): Uint8Array {
getRelayPrivateKey(_uri: string): Uint8Array {
return relayPrivateKey;
},

View file

@ -65,7 +65,7 @@ export function makeTestAdapter(seed?: Uint8Array): WalletAdapter {
walletName: "Test Wallet",
walletIcon: "",
getRelayPrivateKey(): Uint8Array {
getRelayPrivateKey(_uri: string): Uint8Array {
return hdMaster.privateKey;
},

View file

@ -19,12 +19,12 @@ export interface WalletAdapter {
walletIcon: string;
/**
* Return the relay identity private key for this session.
* May be ephemeral (random per session) or stable (HD-derived) both work.
* The dapp learns the wallet's public key dynamically via wallet_ready
* so stability across restarts is not required.
* Return the relay identity private key for a given connection URI.
* Should be deterministic per URI so that reconnecting to the same URI
* produces the same Nostr identity (relay recognizes the wallet after reload).
* Different URIs should yield different keys for privacy (dapps can't correlate).
*/
getRelayPrivateKey(): Uint8Array;
getRelayPrivateKey(uri: string): Uint8Array;
/**
* Derive the compressed public key (33 bytes) for a given HD path and index.

View file

@ -161,7 +161,7 @@ export class WalletConnectionManager extends EventEmitter<WalletConnectionManage
const result = initiateWalletRelay(statusCallback, {
uri,
walletPrivateKey: this.adapter.getRelayPrivateKey(),
walletPrivateKey: this.adapter.getRelayPrivateKey(uri),
});
conn.cleanup = result.cleanup;