@RestrictedApi(
      explanation = "Accessing parts of keys can produce unexpected incompatibilities, annotate the function with @AccessesPartialKey",
      link = "https://developers.google.com/tink/design/access_control#accessing_partial_keys",
      allowedOnPath = ".*Test\\.java",
      allowlistAnnotations = {AccessesPartialKey.class})
  public static XChaCha20Poly1305Key create(
      XChaCha20Poly1305Parameters.Variant variant,
      SecretBytes secretBytes,
      @Nullable Integer idRequirement)
      throws GeneralSecurityException {
    if (variant != XChaCha20Poly1305Parameters.Variant.NO_PREFIX && idRequirement == null) {
      throw new GeneralSecurityException(
          "For given Variant " + variant + " the value of idRequirement must be non-null");
    }
    if (variant == XChaCha20Poly1305Parameters.Variant.NO_PREFIX && idRequirement != null) {
      throw new GeneralSecurityException(
          "For given Variant NO_PREFIX the value of idRequirement must be null");
    }
    if (secretBytes.size() != 32) {
      throw new GeneralSecurityException(
          "XChaCha20Poly1305 key must be constructed with key of length 32 bytes, not "
              + secretBytes.size());
    }
    XChaCha20Poly1305Parameters parameters = XChaCha20Poly1305Parameters.create(variant);
    return new XChaCha20Poly1305Key(
        parameters, secretBytes, getOutputPrefix(parameters, idRequirement), idRequirement);
  }
Represents the Aead XChaCha20-Poly1305 proposed in the RFC draft at
https://datatracker.ietf.org/doc/html/draft-arciszewski-xchacha-03.

<p>XChaCha20-Poly1305 allows no parameters; hence the main part here is really just the key
material. However, Tink allows prefixing every ciphertext with an ID-dependent prefix, see {@link
XChaCha20Poly1305Parameters.Variant}.
java_src/src/main/java/com/google/crypto/tink/aead/XChaCha20Poly1305Key.java