encodeCbor method

String encodeCbor(
  1. List<int> password,
  2. List<int> data,
  3. String uuid
)

Implementation

String encodeCbor(List<int> password, List<int> data, String uuid) {
  final derived = List<int>.unmodifiable(kdf.deriveKey(password));
  final macBytes = List<int>.unmodifiable(derived.sublist(16, 32));
  final aesKey = List<int>.from(derived.sublist(0, 16));
  final encryptOut = QuickCrypto.processCtr(key: aesKey, iv: iv, data: data);
  return CborTagValue(
          CborListValue.dynamicLength([
            CborListValue.fixedLength([
              CborStringValue("aes-128-ctr"),
              CborBytesValue(iv),
              CborBytesValue(encryptOut),
              kdf.cborEncode(),
              CborStringValue(_mac(macBytes, encryptOut)),
            ]),
            CborStringValue(uuid),
            const CborIntValue(3),
          ]),
          _SecretStorageConst.tag)
      .toCborHex();
}