//:build !wasm package signer // HasSigner returns true if window.nostr (NIP-07) is available. func HasSigner() (ok bool) { panic("jsbridge") } // HasMLS returns true if window.nostr.mls (Smesh Signer MLS) is available. func HasMLS() (ok bool) { panic("jsbridge") } // GetPublicKey requests the public key from the browser extension. // Calls fn with hex pubkey on success, empty string on failure. func GetPublicKey(fn func(string)) { panic("jsbridge") } // SignEvent signs a serialized nostr event via NIP-07. // Calls fn with the signed event JSON on success, empty string on failure. func SignEvent(eventJSON string, fn func(string)) { panic("jsbridge") } // GetSharedSecret computes ECDH(user_seckey, peerPubkey) and returns // the shared secret as hex via fn. Used for IDB encryption key derivation. func GetSharedSecret(peerPubkey string, fn func(string)) { panic("jsbridge") } // Nip44Decrypt decrypts NIP-44 ciphertext via the browser extension. func Nip44Decrypt(peerPubkey, ciphertext string, fn func(string)) { panic("jsbridge") } // Nip44Encrypt encrypts plaintext via NIP-44 through the browser extension. func Nip44Encrypt(peerPubkey, plaintext string, fn func(string)) { panic("jsbridge") } // --- Smesh management API (window.nostr.musiquay) --- // IsInstalled checks whether the musiquay signer extension is present. // Calls fn(true) if window.nostr.musiquay exists. func IsInstalled(fn func(bool)) { panic("jsbridge") } // GetVaultStatus returns "none", "locked", or "unlocked". func GetVaultStatus(fn func(string)) { panic("jsbridge") } // CreateVault creates a new vault with the given password. func CreateVault(password string, fn func(bool)) { panic("jsbridge") } // UnlockVault unlocks the vault with the given password. func UnlockVault(password string, fn func(bool)) { panic("jsbridge") } // LastUnlockError returns the diagnostic reason for the most recent unlock // failure. One of: "" (no error), "no-vault", "no-hash", "wrong-password", // "bad-iv", "kdf-failed", "decrypt-failed". func LastUnlockError(fn func(string)) { panic("jsbridge") } // LockVault locks the vault. func LockVault(fn func()) { panic("jsbridge") } // ListIdentities returns a JSON array of identities. func ListIdentities(fn func(string)) { panic("jsbridge") } // AddIdentity imports an nsec into the vault. func AddIdentity(nsec string, fn func(bool)) { panic("jsbridge") } // NsecLogin sets up an in-memory identity from an nsec without vault crypto. func NsecLogin(nsec string, fn func(bool)) { panic("jsbridge") } // SwitchIdentity sets the active identity by pubkey. func SwitchIdentity(pubkey string, fn func(bool)) { panic("jsbridge") } // ExportVault re-encrypts the vault with the given password and returns it. func ExportVault(password string, fn func(string)) { panic("jsbridge") } // ImportVault imports an encrypted vault data string. func ImportVault(data string, fn func(bool)) { panic("jsbridge") } // RemoveIdentity removes an identity by pubkey. func RemoveIdentity(pubkey string, fn func(bool)) { panic("jsbridge") } // --- HD keychain --- // GenerateMnemonic generates a 12-word BIP39 mnemonic (preview only, not stored). func GenerateMnemonic(fn func(string)) { panic("jsbridge") } // ValidateMnemonic checks if a mnemonic is valid BIP39. func ValidateMnemonic(mnemonic string, fn func(bool)) { panic("jsbridge") } // CreateHDVault creates an HD vault from `mnemonic` (or generates a fresh one // if mnemonic == "") and derives the first identity. fn receives the mnemonic // on success, empty string on failure. The WASM signer rejects non-empty input // that is not a valid BIP-39 phrase to prevent a PBKDF2-derived deterministic // seed from arbitrary strings. func CreateHDVault(password, mnemonic string, fn func(string)) { panic("jsbridge") } // RestoreHDVault restores an HD vault from an existing mnemonic. // The third (label) parameter is currently ignored by the WASM signer; pass "". func RestoreHDVault(password, mnemonic, label string, fn func(bool)) { panic("jsbridge") } // DeriveIdentity derives the identity at the given account index from the // active HD keychain. fn receives the hex pubkey on success, empty string on // failure. The argument is sent as a string; the WASM signer extracts the // integer account number from it (digits only, leading non-digits ignored). // Pass a plain decimal string like "1" or "42" - arbitrary text falls back to 0. func DeriveIdentity(accountStr string, fn func(string)) { panic("jsbridge") } // GetMnemonic returns the decrypted mnemonic if the vault is HD and unlocked. func GetMnemonic(fn func(string)) { panic("jsbridge") } // ProbeAccount derives the key at the given account index without adding it. // Calls fn with the hex pubkey, or empty string on failure. func ProbeAccount(index int32, fn func(string)) { panic("jsbridge") } // IsHD returns true if the unlocked vault is HD-based. func IsHD(fn func(bool)) { panic("jsbridge") } // ResetExtension wipes the vault and all keys from the extension. func ResetExtension(fn func(bool)) { panic("jsbridge") } // --- NWC wallet connections --- // NwcList returns a JSON array of connections: [{id,alias,walletPubkey,relayURL,clientPubkey,createdAt}]. func NwcList(fn func(string)) { panic("jsbridge") } // NwcAdd parses a nostr+walletconnect:// URI, stores it, and calls fn with the id (or empty on failure). func NwcAdd(uri, alias string, createdAt int64, fn func(string)) { panic("jsbridge") } // NwcRemove deletes a connection by id. func NwcRemove(id string, fn func(bool)) { panic("jsbridge") } // NwcBuildRequest builds a signed kind:23194 NWC request event. // method is the NWC method name, paramsJSON is a JSON object string (or "{}"). // encryption is "nip04" or "nip44". Returns the signed event JSON or empty on failure. func NwcBuildRequest(id, method, paramsJSON, encryption string, createdAt int64, fn func(string)) { panic("jsbridge") } // NwcParseResponse decrypts a kind:23195 response ciphertext. // Returns plaintext JSON or empty on failure. func NwcParseResponse(id, ciphertext, encryption string, fn func(string)) { panic("jsbridge") } // OnStateChange registers a persistent callback that fires whenever signer state // changes (vault status, active pubkey). The callback receives a JSON object: // {"installed":bool,"vaultStatus":"none"|"locked"|"unlocked","pubkey":"hex"}. // The callback is NOT one-shot - it stays registered and fires on each change. // Fires once immediately with current state. func OnStateChange(fn func(string)) { panic("jsbridge") }