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 = kdf.deriveKey(password);
  final macBytes = derived.sublist(16, 32);
  final aesKey = derived.sublist(0, 16);
  final encryptOut = QuickCrypto.processCtr(key: aesKey, iv: iv, data: data);
  return CborTagValue(
    CborListValue<CborObject>.inDefinite([
      CborListValue<CborObject>.definite([
        CborStringValue("aes-128-ctr"),
        CborBytesValue.unsafe(iv),
        CborBytesValue.unsafe(encryptOut),
        kdf.cborEncode(),
        CborStringValue(_mac(macBytes, encryptOut)),
      ]),
      CborStringValue(uuid),
      const CborIntValue(3),
    ]),
    _SecretStorageConst.tag,
  ).toCborHex();
}