checkData method

void checkData()

Implementation

void checkData() {
  switch (_state) {
    case State.DEC_INIT:
    case State.DEC_AAD:
      finishAAD(State.DEC_DATA);
      break;
    case State.ENC_INIT:
    case State.ENC_AAD:
      finishAAD(State.ENC_DATA);
      break;
    case State.DEC_DATA:
    case State.ENC_DATA:
      break;
    case State.ENC_FINAL:
      throw StateError('ChaCha20Poly1305 cannot be reused for encryption');
    default:
      throw StateError('');
  }
}