mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-05-05 00:00:14 +02:00
nip46: encrypt/decrypt nip44 methods on client.
This commit is contained in:
parent
c91e7b9765
commit
cc038de0dd
@ -177,6 +177,22 @@ func (bunker *BunkerClient) SignEvent(ctx context.Context, evt *nostr.Event) err
|
||||
return err
|
||||
}
|
||||
|
||||
func (bunker *BunkerClient) NIP44Encrypt(
|
||||
ctx context.Context,
|
||||
targetPublicKey string,
|
||||
plaintext string,
|
||||
) (string, error) {
|
||||
return bunker.RPC(ctx, "nip44_encrypt", []string{targetPublicKey, plaintext})
|
||||
}
|
||||
|
||||
func (bunker *BunkerClient) NIP44Decrypt(
|
||||
ctx context.Context,
|
||||
targetPublicKey string,
|
||||
ciphertext string,
|
||||
) (string, error) {
|
||||
return bunker.RPC(ctx, "nip44_decrypt", []string{targetPublicKey, ciphertext})
|
||||
}
|
||||
|
||||
func (bunker *BunkerClient) RPC(ctx context.Context, method string, params []string) (string, error) {
|
||||
id := bunker.idPrefix + "-" + strconv.FormatUint(bunker.serial.Add(1), 10)
|
||||
req, err := json.Marshal(Request{
|
||||
|
Loading…
x
Reference in New Issue
Block a user