Documentation ¶
Index ¶
- func New(ctx context.Context, pool *nostr.SimplePool, input string, opts *SignerOptions) (nostr.Keyer, error)
- type BunkerSigner
- func (bs BunkerSigner) Decrypt(ctx context.Context, base64ciphertext string, sender string) (plaintext string, err error)
- func (bs BunkerSigner) Encrypt(ctx context.Context, plaintext string, recipient string) (string, error)
- func (bs BunkerSigner) GetPublicKey(ctx context.Context) (string, error)
- func (bs BunkerSigner) SignEvent(ctx context.Context, evt *nostr.Event) error
- type Cipherdeprecated
- type EncryptedKeySigner
- func (es EncryptedKeySigner) Decrypt(ctx context.Context, base64ciphertext string, sender string) (plaintext string, err error)
- func (es EncryptedKeySigner) Encrypt(ctx context.Context, plaintext string, recipient string) (c64 string, err error)
- func (es *EncryptedKeySigner) GetPublicKey(ctx context.Context) (string, error)
- func (es *EncryptedKeySigner) SignEvent(ctx context.Context, evt *nostr.Event) error
- type KeySigner
- func (ks KeySigner) Decrypt(ctx context.Context, base64ciphertext string, sender string) (string, error)
- func (ks KeySigner) Encrypt(ctx context.Context, plaintext string, recipient string) (string, error)
- func (ks KeySigner) GetPublicKey(ctx context.Context) (string, error)
- func (ks KeySigner) SignEvent(ctx context.Context, evt *nostr.Event) error
- type Keyerdeprecated
- type ManualSigner
- func (ms ManualSigner) Decrypt(ctx context.Context, base64ciphertext string, sender string) (plaintext string, err error)
- func (ms ManualSigner) Encrypt(ctx context.Context, plaintext string, recipient string) (c64 string, err error)
- func (ms ManualSigner) GetPublicKey(ctx context.Context) (string, error)
- func (ms ManualSigner) SignEvent(ctx context.Context, evt *nostr.Event) error
- type Signerdeprecated
- type SignerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BunkerSigner ¶
type BunkerSigner struct {
// contains filtered or unexported fields
}
BunkerSigner is a signer that asks a bunker using NIP-46 every time it needs to do an operation.
func NewBunkerSignerFromBunkerClient ¶
func NewBunkerSignerFromBunkerClient(bc *nip46.BunkerClient) BunkerSigner
func (BunkerSigner) GetPublicKey ¶
func (bs BunkerSigner) GetPublicKey(ctx context.Context) (string, error)
type Cipher
deprecated
type EncryptedKeySigner ¶
type EncryptedKeySigner struct {
// contains filtered or unexported fields
}
EncryptedKeySigner is a signer that must always ask the user for a password before every operation.
func (*EncryptedKeySigner) GetPublicKey ¶
func (es *EncryptedKeySigner) GetPublicKey(ctx context.Context) (string, error)
type KeySigner ¶
type KeySigner struct {
// contains filtered or unexported fields
}
Keysigner is a signer that holds the private key in memory and can do all the operations instantly and easily.
func NewPlainKeySigner ¶ added in v0.36.3
func (KeySigner) GetPublicKey ¶
type ManualSigner ¶
type ManualSigner struct { ManualGetPublicKey func(context.Context) (string, error) ManualSignEvent func(context.Context, *nostr.Event) error ManualEncrypt func(ctx context.Context, plaintext string, recipientPublicKey string) (base64ciphertext string, err error) ManualDecrypt func(ctx context.Context, base64ciphertext string, senderPublicKey string) (plaintext string, err error) }
ManualSigner is a signer that doesn't really do anything, it just calls the functions given to it. It can be used when an app for some reason wants to ask the user to manually provide a signed event by copy-and-paste, for example.
func (ManualSigner) GetPublicKey ¶
func (ms ManualSigner) GetPublicKey(ctx context.Context) (string, error)
type SignerOptions ¶
type SignerOptions struct { BunkerClientSecretKey string BunkerSignTimeout time.Duration BunkerAuthHandler func(string) // if a PasswordHandler is provided the key will be stored encrypted and this function will be called // every time an operation needs access to the key so the user can be prompted. PasswordHandler func(context.Context) string // if instead a Password is provided along with a ncryptsec, then the key will be decrypted and stored in plaintext. Password string }
Click to show internal directories.
Click to hide internal directories.