KeepassX format implementation in pure dart.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

import 'package:kdbx/src/internal/extension_utils.dart';
import 'package:kdbx/src/kdbx_custom_data.dart';
import 'package:kdbx/src/kdbx_object.dart';
import 'package:kdbx/src/kdbx_xml.dart';
import 'package:meta/meta.dart';
import 'package:xml/xml.dart' as xml;
class KdbxMeta extends KdbxNode {
KdbxMeta.create({
@required String databaseName,
String generator = 'kdbx.dart',
}) : customData = KdbxCustomData.create(),
super.create('Meta') {
this.databaseName.set(databaseName);
this.generator.set(generator);
}
KdbxMeta.read(xml.XmlElement node)
: customData = node
.singleElement('CustomData')
?.let((e) => KdbxCustomData.read(e)) ??
KdbxCustomData.create(),
super.read(node);
final KdbxCustomData customData;
StringNode get generator => StringNode(this, 'Generator');
StringNode get databaseName => StringNode(this, 'DatabaseName');
Base64Node get headerHash => Base64Node(this, 'HeaderHash');
BooleanNode get recycleBinEnabled => BooleanNode(this, 'RecycleBinEnabled');
UuidNode get recycleBinUUID => UuidNode(this, 'RecycleBinUUID');
DateTimeUtcNode get recycleBinChanged =>
DateTimeUtcNode(this, 'RecycleBinChanged');
@override
xml.XmlElement toXml() => super.toXml()..replaceSingle(customData.toXml());
}