encodeRecoveryKey static method

String encodeRecoveryKey(
  1. Uint8List recoveryKey
)

Implementation

static String encodeRecoveryKey(Uint8List recoveryKey) {
  final keyToEncode = <int>[...olmRecoveryKeyPrefix, ...recoveryKey];
  final parity = keyToEncode.fold<int>(0, (a, b) => a ^ b);
  keyToEncode.add(parity);
  // base58-encode and add a space every four chars
  return base58
      .encode(keyToEncode)
      .replaceAllMapped(RegExp(r'.{4}'), (s) => '${s.group(0)} ')
      .trim();
}