openalias 0.0.1
openalias: ^0.0.1 copied to clipboard
Pure Dart OpenAlias TXT record parser and recipient selector.
openalias #
Pure Dart parser and recipient selector for OpenAlias (oa1:) TXT records.
No networking, no dependencies.
Usage #
import 'package:openalias/openalias.dart';
final domain = normalizeOpenAlias('donate@getmonero.org');
final recipient = selectOpenAliasRecipient(
domain: domain,
records: txtRecords, // raw TXT bytes for [domain]
application: 'xmr',
validateAddress: isValidMoneroAddress,
);
print(recipient.address);
normalizeOpenAliaslowercases an alias and turnsuser@domainintouser.domain. Non-ASCII names must be given as punycode.parseOpenAliasRecordparses one record and returns null for records of another application.selectOpenAliasRecipienttakesrecordsas raw TXT bytes, each record's character-strings concatenated. Records without theoa1:<application>prefix are ignored undecoded; matching records must be UTF-8. It requires one valid address.selection: firststops at the first matching record;tx_payment_idis rejected unlessallowPaymentIdis set;validateRecordadds field checks. At most 64 records are accepted.isOpenAliasApplicationtells whether a tag may followoa1:; the selector throwsArgumentErrorfor any otherapplication.- Failures are final leaves of sealed
OpenAliasException. Messages are diagnostics; map the types to your own text.
Trust model #
checksum and address_signature are carried but not verified.
recipient_name and tx_description are untrusted display text. Fetching
TXT records and deciding whether to trust them is the caller's job.
Development #
dart tool/check.dart, in the repository, runs format, analyze, tests and
pub publish --dry-run.
License #
MIT; see LICENSE.