toAtProtocolFragment method
Creates a fragment which can be included in any atProtocol commands which use
Metadata - e.g. update
, update:meta
and notify
Implementation
String toAtProtocolFragment() {
StringBuffer sb = StringBuffer();
// NB The order of the verb parameters is important - it MUST match the order
// in the regular expressions [VerbSyntax.update] and [VerbSyntax.update_meta]
if (ttl != null) {
sb.write(':ttl:$ttl');
}
if (ttb != null) {
sb.write(':ttb:$ttb');
}
if (ttr != null) {
sb.write(':ttr:$ttr');
}
if (ccd != null) {
sb.write(':ccd:$ccd');
}
if (dataSignature.isNotNullOrEmpty) {
sb.write(':${AtConstants.publicDataSignature}:$dataSignature');
}
if (sharedKeyStatus.isNotNullOrEmpty) {
sb.write(':${AtConstants.sharedKeyStatus}:$sharedKeyStatus');
}
if (isBinary) {
sb.write(':isBinary:$isBinary');
}
if (isEncrypted) {
sb.write(':isEncrypted:$isEncrypted');
}
if (sharedKeyEnc.isNotNullOrEmpty) {
sb.write(':${AtConstants.sharedKeyEncrypted}:$sharedKeyEnc');
}
// ignore: deprecated_member_use_from_same_package
if (pubKeyCS.isNotNullOrEmpty) {
// ignore: deprecated_member_use_from_same_package
sb.write(':${AtConstants.sharedWithPublicKeyCheckSum}:$pubKeyCS');
}
if (pubKeyHash != null) {
sb.write(
':${AtConstants.sharedWithPublicKeyHashValue}:${pubKeyHash!.hash}');
sb.write(
':${AtConstants.sharedWithPublicKeyHashAlgo}:${pubKeyHash!.publicKeyHashingAlgo.name}');
}
if (encoding.isNotNullOrEmpty) {
sb.write(':${AtConstants.encoding}:$encoding');
}
if (encKeyName.isNotNullOrEmpty) {
sb.write(':${AtConstants.encryptingKeyName}:$encKeyName');
}
if (encAlgo.isNotNullOrEmpty) {
sb.write(':${AtConstants.encryptingAlgo}:$encAlgo');
}
if (ivNonce.isNotNullOrEmpty) {
sb.write(':${AtConstants.ivOrNonce}:$ivNonce');
}
if (skeEncKeyName.isNotNullOrEmpty) {
sb.write(
':${AtConstants.sharedKeyEncryptedEncryptingKeyName}:$skeEncKeyName');
}
if (skeEncAlgo.isNotNullOrEmpty) {
sb.write(':${AtConstants.sharedKeyEncryptedEncryptingAlgo}:$skeEncAlgo');
}
return sb.toString();
}