backup method

Future<void> backup({
  1. required String email,
  2. required String pin,
  3. required Uint8List ciphertext,
  4. dynamic onError(
    1. Object
    )?,
  5. dynamic onSuccess()?,
})

Implementation

Future<void> backup(
        {required String email,
        required String pin,
        required Uint8List ciphertext,
        Function(Object)? onError,
        Function()? onSuccess}) =>
    _auth(_accessToken(), onError, (token, onError) {
      RegExp pinCheck = RegExp(r'[0-9]{6,}$');
      if (!pinCheck.hasMatch(pin)) {
        throw ArgumentError('pin must be 6+ digits');
      }
      return _repository.add(
          client: _client,
          accessToken: token,
          body: TikiBkupModelAddReq(
              email: _hash(email),
              pin: _hash(pin),
              ciphertext: base64.encode(ciphertext)),
          onSuccess: onSuccess,
          onError: onError);
    });