Nip44Encrypt

This commit is contained in:
randogoth 2026-07-11 17:33:08 +03:00
parent 60f9e4ccfa
commit 1fee9e5d34
2 changed files with 32 additions and 0 deletions

View file

@ -64,6 +64,8 @@ final actor = NostrSignerActor(privateKeyHex);
|---|---|---|
| `SignEvent(kind, content, tags?, createdAt?)` | `EventSigned(event)` | Returns a signed event as a JSON string with all seven NIP-01 fields |
| `GetPublicKey()` | `PublicKeyResult(publicKey)` | Returns the hex public key for this signer |
| `Nip44Encrypt(plaintext)` | `Nip44Text(value)` | NIP-44 v2 encrypt-to-self: seals `plaintext` with this signer's own key (base64 payload). Useful for kind-30078 app data. |
| `Nip44Decrypt(payload)` | `Nip44Text(value)` | Inverse of `Nip44Encrypt`. Throws on a version mismatch or HMAC failure. |
`tags` defaults to `[]`. `createdAt` defaults to `DateTime.now()` (Unix seconds).
@ -107,6 +109,9 @@ Implements the same `SignerMessage`/`SignerResult` protocol as `NostrSignerActor
| `GetPublicKey()` | `PublicKeyResult(publicKey)` | Returns the signer's public key (cached after first call) |
| `SignEvent(kind, content, tags?, createdAt?)` | `EventSigned(event)` | Sends a `sign_event` request to the remote signer; returns the fully signed event JSON |
The `Nip44Encrypt`/`Nip44Decrypt` messages are **not** supported by the remote
signer yet — only `GetPublicKey` and `SignEvent` are proxied over NIP-46.
Call `actor.close()` when done to tear down the relay connection.
```dart