Nip55Signer class

Dart bridge to a NIP-55 "Android Signer Application".

NIP-55 is a protocol implemented by several external signer apps (Amber, Primal, Aegis, ...). This class talks to whichever compatible signer is installed through the native ndk method channel (DartNdkPlugin).

Every method resolves to a Map that contains (at least) a signature key with the result, mirroring the historical amberflutter API.

Constructors

Nip55Signer({String? package})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
package String?
The signer app package (e.g. Amber, Primal), captured at login. Used to target the right signer for both the ContentResolver and the Intent. When null, the native side lets Android route through a compatible signer app.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decryptZapEvent({required String eventJson, required String currentUser, String? id}) Future<Map>
getPublicKey({List<Nip55Permission>? permissions}) Future<Map>
Requests the user's public key (login). Optionally pre-authorizes permissions so subsequent requests can be answered silently.
getPublicKeyHex({List<Nip55Permission>? permissions}) Future<String?>
Requests the user's public key and returns it as a hex pubkey, or null if the user rejected or no key was returned.
isAppInstalled() Future<bool>
Whether a NIP-55 compatible external signer is installed.
login({List<Nip55Permission>? permissions}) Future<Nip55LoginResult?>
Logs in: requests the user's public key, pre-authorizing permissions (defaults to defaultPermissions), and captures the signer app package. Returns null if the user rejected or no key was returned.
nip04Decrypt({required String ciphertext, required String currentUser, required String pubKey, String? id}) Future<Map>
nip04Encrypt({required String plaintext, required String currentUser, required String pubKey, String? id}) Future<Map>
nip44Decrypt({required String ciphertext, required String currentUser, required String pubKey, String? id}) Future<Map>
nip44Encrypt({required String plaintext, required String currentUser, required String pubKey, String? id}) Future<Map>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
signEvent({required String currentUser, required String eventJson, String? id}) Future<Map>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultPermissions → const List<Nip55Permission>
Default permissions requested at login so common operations can be answered silently (via ContentResolver) without reopening the signer.