mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-07-13 04:52:19 +02:00
a User interface that is like a Signer but can't sign.
This commit is contained in:
13
keyer.go
13
keyer.go
@ -15,15 +15,20 @@ type Keyer interface {
|
||||
Cipher
|
||||
}
|
||||
|
||||
// Signer is an interface for signing events.
|
||||
// User is an entity that has a public key (although they can't sign anything).
|
||||
type User interface {
|
||||
// GetPublicKey returns the public key associated with this user.
|
||||
GetPublicKey(ctx context.Context) (string, error)
|
||||
}
|
||||
|
||||
// Signer is a User that can also sign events.
|
||||
type Signer interface {
|
||||
User
|
||||
|
||||
// SignEvent signs the provided event, setting its ID, PubKey, and Sig fields.
|
||||
// The context can be used for operations that may require user interaction or
|
||||
// network access, such as with remote signers.
|
||||
SignEvent(ctx context.Context, evt *Event) error
|
||||
|
||||
// GetPublicKey returns the public key associated with this signer.
|
||||
GetPublicKey(ctx context.Context) (string, error)
|
||||
}
|
||||
|
||||
// Cipher is an interface for encrypting and decrypting messages with NIP-44
|
||||
|
Reference in New Issue
Block a user