checkAAD method

void checkAAD()

Implementation

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