001/*
002 * acme4j - Java ACME client
003 *
004 * Copyright (C) 2021 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.provider;
015
016import org.shredzone.acme4j.Login;
017import org.shredzone.acme4j.challenge.Challenge;
018import org.shredzone.acme4j.toolbox.JSON;
019
020/**
021 * A provider that creates a Challenge from a matching JSON.
022 *
023 * @since 2.12
024 */
025@FunctionalInterface
026public interface ChallengeProvider {
027
028    /**
029     * Creates a Challenge.
030     *
031     * @param login
032     *         {@link Login} of the user's account
033     * @param data
034     *         {@link JSON} of the challenge as sent by the CA
035     * @return Created and initialized {@link Challenge}. It must match the JSON type.
036     */
037    Challenge create(Login login, JSON data);
038
039}