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:
commit
451b19c32d
5 changed files with 8 additions and 8 deletions
Binary file not shown.
|
|
@ -37,7 +37,7 @@ async function buildAdapter(
|
|||
walletName: "wiz-test CLI wallet",
|
||||
walletIcon: "",
|
||||
|
||||
getRelayPrivateKey(): Uint8Array {
|
||||
getRelayPrivateKey(_uri: string): Uint8Array {
|
||||
return relayPrivateKey;
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ export function makeTestAdapter(seed?: Uint8Array): WalletAdapter {
|
|||
walletName: "Test Wallet",
|
||||
walletIcon: "",
|
||||
|
||||
getRelayPrivateKey(): Uint8Array {
|
||||
getRelayPrivateKey(_uri: string): Uint8Array {
|
||||
return hdMaster.privateKey;
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue