keyer: fix KeySigner and add a method for making one from scratch.
This commit is contained in:
@@ -16,6 +16,11 @@ type KeySigner struct {
|
||||
conversationKeys *xsync.MapOf[string, [32]byte]
|
||||
}
|
||||
|
||||
func NewPlainKeySigner(sec string) KeySigner {
|
||||
pk, _ := nostr.GetPublicKey(sec)
|
||||
return KeySigner{sec, pk, xsync.NewMapOf[string, [32]byte]()}
|
||||
}
|
||||
|
||||
func (ks KeySigner) SignEvent(ctx context.Context, evt *nostr.Event) error { return evt.Sign(ks.sk) }
|
||||
func (ks KeySigner) GetPublicKey(ctx context.Context) string { return ks.pk }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user