Skip to main content

dostr_nip55 0.1.0 copy "dostr_nip55: ^0.1.0" to clipboard
dostr_nip55: ^0.1.0 copied to clipboard

PlatformAndroid

NIP-55 Android signer for Nostr, to log in, sign and encrypt with a signer app from a Flutter app, without depending on dostr_flutter.

0.1.0 #

  • Initial release, moved out of the ndk_flutter package. It does not depend on dostr_flutter. The native side is now its own Android plugin, Nip55Plugin, on the dostr_nip55 method channel.
  • Nip55EventSigner is now Nip55Signer, after the NostrSigner it implements. The Nip55Signer that talks to the signer app is now Nip55SignerApp, and Nip55Signer takes it as signerApp instead of nip55Signer.
  • encryptNip44 and decryptNip44 take recipientPubkey and senderPubkey, as in NostrSigner, instead of recipientPubKey and senderPubKey. The nip04Encrypt, nip04Decrypt, nip44Encrypt and nip44Decrypt methods of Nip55SignerApp take pubkey instead of pubKey.
  • As in NostrSigner, encrypt and decrypt are now encryptNip04 and decryptNip04, with named parameters, the four encryption methods return a Future<String> instead of a Future<String?>, canSign is a getter, getPublicKey() is the publicKey getter, and requiresInteractiveSigning, requiresSignerNetwork and signerTransportRelayUrls are gone.
  • Given an npub, Nip55Signer keeps its pubkey in hex, so publicKey is the hex pubkey that it sends as current_user.
  • sign throws an ArgumentError for an event of another pubkey, and a SignerRequestFailedException when the signer app returns an invalid event or one signed by another account. It used to return that event, and to reject an invalid one with a SignerRequestRejectedException.
  • A queued request that dispose drops fails with a SignerRequestFailedException instead of a SignerRequestRejectedException. dispose also fails the requests the signer app has not answered yet, and stops the plugin from waiting for them. The pending requests are the PendingSignRequest, PendingEncryptRequest and PendingDecryptRequest of dostr_signer.
  • Only a refusal of the user, which NIP-55 marks with rejected, throws a SignerRequestRejectedException. A request with no usable answer throws a SignerRequestFailedException instead: no activity to open the signer app from, a signer app that cannot be opened, a result code other than RESULT_OK, or an answer with no result.
  • When the user told the signer app to always reject a request, the Content Resolver answer rejects it, instead of opening the signer app to ask again, as NIP-55 requires.
  • The Content Resolver is queried on a background thread instead of the main thread, which froze the UI while the signer app answered.
  • Off Android, Nip55Signer.canSign is false and every request throws an UnsupportedError, as NostrSigner requires, instead of a SignerRequestRejectedException. isAppInstalled is false there, and Nip55SignerApp.isSupported tells whether the platform has NIP-55 signer apps. canSign follows Nip55SignerApp.isAvailable, which a fake signer app can override to run off Android.
  • isAppInstalled checks the signer app of package when it is set.
  • Nip55Signer takes an optional verifier, which checks the signature of every event the signer app signs.
  • getPublicKey and getPublicKeyHex are gone: login returns the pubkey and the signer app package. Instead of returning null, login throws a SignerRequestRejectedException when the user refuses, and a SignerRequestFailedException when no key comes back, such as when the signer app cannot be opened.
  • cancelRequest also stops the plugin from waiting for the answer of the signer app, through Nip55SignerApp.cancelRequest, which frees the slot of the request. A request cancelled while the plugin queries the Content Resolver no longer opens the signer app.
  • Two Nip55Signer never use the same request id, so the answers and cancellations of two accounts no longer get mixed up.
  • When the signer app answers a request through the Intent of another request, that other request fails instead of waiting forever. It no longer takes the answer when the request it names is not waiting anymore, such as after cancelRequest.
0
likes
160
points
--
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

NIP-55 Android signer for Nostr, to log in, sign and encrypt with a signer app from a Flutter app, without depending on dostr_flutter.

Repository (GitHub)
View/report issues

Topics

#nostr #dostr #nip55 #signer

License

MIT (license)

Dependencies

dostr_nip01, dostr_nip19, dostr_signer, flutter, rxdart

More

Packages that depend on dostr_nip55

Packages that implement dostr_nip55