Passnote class

The app-level handle for Passnote.

Build one with Passnote.builder and share it across the app. It owns exactly one Transport and any number of open Database instances.

final passnote = await Passnote.builder(
  appId: 'notes',
  salt: 'notes:v1',
).open();

passnoteLowLevel is the same wiring with every dependency passed explicitly, for custom adapters or tests.

Properties

discoveryUnavailableReason → String?
Why peer discovery is unavailable, or null when it works.
no setter
events → Stream<PassnoteEvent>
Peer-lifecycle (PeerAppeared / PeerDisappeared / PeerIncompatible), discovery (PeerDiscoveryUnavailable), store-recovery (StoreRecovered), and frame-handling (FrameHandlingFailed) events. Broadcast; safe to ignore, worth logging.
no setter
hashCode → int
The hash code for this object.
no setterinherited
identity → Identity
This device's cryptographic Identity.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancelPairing() → void
Drops an armed pairing session started with startPairing.
close() → Future<void>
Closes all open databases (keeping their keys) and stops the transport.
devices(String localId) → Future<List<DeviceInfo>>
The device roster for the open database localId (id, label, paired-at, revoked, is-this-device). Empty when no Identity is configured.
enableRecovery(String localId, {String label = 'recovery phrase'}) → Future<List<String>>
Mints a recovery phrase for the open database localId and registers it in the roster: 24 BIP39 words whose derived keypair is admitted as a virtual device holding a wrap of the group key, so a fresh install can later regain access with recoverFrom — even when the device that called this is gone.
forceSync() → Future<void>
Triggers a full bidirectional re-sync on every open database with all connected peers.
forget(String localId) → Future<void>
Permanently forgets localId: removes it from the open set and deletes its encryption key from the KeyStore.
generatePassphrase() → List<String>
Generates a BIP39 mnemonic of the length configured in PassnoteConfig.passphrasePolicy.
hasPendingRotation(String localId) → Future<bool>
Whether a passphrase rotation for localId was interrupted and has not been finished.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openDatabase(String localId, {required String passphrase}) → Future<Database>
Opens the database identified by localId using passphrase to derive its encryption key and room tag.
pairWith(String localId, PairingCode code) → Future<Database>
Joins the database sponsored under code, opening it locally as localId.
recoverFrom(String localId, String phrase, {required String passphrase, String deviceLabel = 'recovered device'}) → Future<Database>
Regains access to the database localId on a fresh install, using a recovery phrase minted by enableRecovery plus the database passphrase.
renameDevice(String localId, String deviceId, String label) → Future<void>
Renames device deviceId in localId's roster.
reopenDatabase(String localId) → Future<Database>
Reopens a database previously opened with openDatabase, reusing the key already held in the KeyStore — no passphrase required.
resumePendingRotation(String localId) → Future<void>
Finishes a rotation that was interrupted, if there is one.
revokeDevice(String localId, String deviceId) → Future<void>
Revokes device deviceId from localId: rotates the group key, re-wraps it to every other device, and re-keys this database. Peers adopt the new key on sync; the revoked device can no longer read or write.
rotatePassphrase(String localId, {required String oldPassphrase, required String newPassphrase}) → Future<void>
Re-encrypts localId under a key derived from newPassphrase.
startPairing(String localId, {String joinerLabel = 'paired device'}) → Future<PairingCode>
Starts sponsoring a device join for the already-open database localId.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

builder({required String appId, required String salt}) → PassnoteBuilder
Starts a staged configuration for a Passnote instance.