signer.mx raw

   1  package signer
   2  
   3  // HasSigner returns true if window.nostr (NIP-07) is available.
   4  func HasSigner() bool { panic("jsbridge") }
   5  
   6  // HasMLS returns true if window.nostr.mls (Smesh Signer MLS) is available.
   7  func HasMLS() bool { panic("jsbridge") }
   8  
   9  // GetPublicKey requests the public key from the browser extension.
  10  // Calls fn with hex pubkey on success, empty string on failure.
  11  func GetPublicKey(fn func(string)) { panic("jsbridge") }
  12  
  13  // SignEvent signs a serialized nostr event via NIP-07.
  14  // Calls fn with the signed event JSON on success, empty string on failure.
  15  func SignEvent(eventJSON string, fn func(string)) { panic("jsbridge") }
  16  
  17  // Nip04Decrypt decrypts NIP-04 ciphertext via the browser extension.
  18  func Nip04Decrypt(peerPubkey, ciphertext string, fn func(string)) { panic("jsbridge") }
  19  
  20  // Nip04Encrypt encrypts plaintext via NIP-04 through the browser extension.
  21  func Nip04Encrypt(peerPubkey, plaintext string, fn func(string)) { panic("jsbridge") }
  22  
  23  // Nip44Decrypt decrypts NIP-44 ciphertext via the browser extension.
  24  func Nip44Decrypt(peerPubkey, ciphertext string, fn func(string)) { panic("jsbridge") }
  25  
  26  // Nip44Encrypt encrypts plaintext via NIP-44 through the browser extension.
  27  func Nip44Encrypt(peerPubkey, plaintext string, fn func(string)) { panic("jsbridge") }
  28  
  29  // --- Smesh management API (window.nostr.smesh) ---
  30  
  31  // IsInstalled checks whether the smesh signer extension is present.
  32  // Calls fn(true) if window.nostr.smesh exists.
  33  func IsInstalled(fn func(bool)) { panic("jsbridge") }
  34  
  35  // GetVaultStatus returns "none", "locked", or "unlocked".
  36  func GetVaultStatus(fn func(string)) { panic("jsbridge") }
  37  
  38  // CreateVault creates a new vault with the given password.
  39  func CreateVault(password string, fn func(bool)) { panic("jsbridge") }
  40  
  41  // UnlockVault unlocks the vault with the given password.
  42  func UnlockVault(password string, fn func(bool)) { panic("jsbridge") }
  43  
  44  // LockVault locks the vault.
  45  func LockVault(fn func()) { panic("jsbridge") }
  46  
  47  // ListIdentities returns a JSON array of identities.
  48  func ListIdentities(fn func(string)) { panic("jsbridge") }
  49  
  50  // AddIdentity imports an nsec into the vault.
  51  func AddIdentity(nsec string, fn func(bool)) { panic("jsbridge") }
  52  
  53  // NsecLogin sets up an in-memory identity from an nsec without vault crypto.
  54  func NsecLogin(nsec string, fn func(bool)) { panic("jsbridge") }
  55  
  56  // SwitchIdentity sets the active identity by pubkey.
  57  func SwitchIdentity(pubkey string, fn func(bool)) { panic("jsbridge") }
  58  
  59  // ExportVault re-encrypts the vault with the given password and returns it.
  60  func ExportVault(password string, fn func(string)) { panic("jsbridge") }
  61  
  62  // ImportVault imports an encrypted vault data string.
  63  func ImportVault(data string, fn func(bool)) { panic("jsbridge") }
  64  
  65  // RemoveIdentity removes an identity by pubkey.
  66  func RemoveIdentity(pubkey string, fn func(bool)) { panic("jsbridge") }
  67  
  68  // --- HD keychain ---
  69  
  70  // GenerateMnemonic generates a 12-word BIP39 mnemonic (preview only, not stored).
  71  func GenerateMnemonic(fn func(string)) { panic("jsbridge") }
  72  
  73  // ValidateMnemonic checks if a mnemonic is valid BIP39.
  74  func ValidateMnemonic(mnemonic string, fn func(bool)) { panic("jsbridge") }
  75  
  76  // CreateHDVault generates a mnemonic, creates an HD vault, derives the first identity.
  77  // Calls fn with the mnemonic on success, empty string on failure.
  78  func CreateHDVault(password, name string, fn func(string)) { panic("jsbridge") }
  79  
  80  // RestoreHDVault restores an HD vault from an existing mnemonic.
  81  func RestoreHDVault(password, mnemonic, name string, fn func(bool)) { panic("jsbridge") }
  82  
  83  // DeriveIdentity derives the next identity from the HD keychain.
  84  // Calls fn with the hex pubkey on success, empty string on failure.
  85  func DeriveIdentity(name string, fn func(string)) { panic("jsbridge") }
  86  
  87  // GetMnemonic returns the decrypted mnemonic if the vault is HD and unlocked.
  88  func GetMnemonic(fn func(string)) { panic("jsbridge") }
  89  
  90  // ProbeAccount derives the key at the given account index without adding it.
  91  // Calls fn with the hex pubkey, or empty string on failure.
  92  func ProbeAccount(index int, fn func(string)) { panic("jsbridge") }
  93  
  94  // IsHD returns true if the unlocked vault is HD-based.
  95  func IsHD(fn func(bool)) { panic("jsbridge") }
  96  
  97  // ResetExtension wipes the vault and all keys from the extension.
  98  func ResetExtension(fn func(bool)) { panic("jsbridge") }
  99