001/*
002 * acme4j - Java ACME client
003 *
004 * Copyright (C) 2026 Richard "Shred" Körber
005 *   http://acme4j.shredzone.org
006 *
007 * Licensed under the Apache License, Version 2.0 (the "License");
008 * you may not use this file except in compliance with the License.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
013 */
014package org.shredzone.acme4j.connector;
015
016import edu.umd.cs.findbugs.annotations.Nullable;
017
018/**
019 * Keeps the current nonce for a request. Make sure that the {@link #close()} method is
020 * always invoked, otherwise the related {@link org.shredzone.acme4j.Session} will be
021 * blocked.
022 * <p>
023 * This object is for internal use only.
024 *
025 * @since 4.0.0
026 */
027public interface NonceHolder extends AutoCloseable {
028    /**
029     * Gets the last base64 encoded nonce, or {@code null} if the session is new.
030     */
031    @Nullable
032    String getNonce();
033
034    /**
035     * Sets the base64 encoded nonce received by the server.
036     */
037    void setNonce(@Nullable String nonce);
038
039    /**
040     * Closes the NonceHolder. Must be invoked!
041     */
042    void close();
043}