001/**
002 *
003 * Copyright 2018 Paul Schaub.
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * You may obtain a copy of the License at
008 *
009 *     http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.jivesoftware.smackx.ox.store.definition;
018
019import java.io.IOException;
020import java.util.Date;
021import java.util.Map;
022
023import org.jxmpp.jid.BareJid;
024import org.pgpainless.key.OpenPgpV4Fingerprint;
025
026public interface OpenPgpMetadataStore {
027
028    /**
029     * Return a {@link Map} containing all announced fingerprints of a contact, as well as the dates on which they were
030     * last modified by {@code contact}.
031     * This method MUST NOT return null.
032     *
033     * @param contact contact in which we are interested.
034     * @return announced fingerprints
035     *
036     * @throws IOException IO is dangerous
037     */
038    Map<OpenPgpV4Fingerprint, Date> getAnnouncedFingerprintsOf(BareJid contact) throws IOException;
039
040    /**
041     * Store a contacts announced fingerprints and dates of last modification.
042     *
043     * @param contact contact in which we are interested.
044     * @param data {@link Map} containing the contacts announced fingerprints and dates of last modification.
045     *
046     * @throws IOException IO is dangerous
047     */
048    void setAnnouncedFingerprintsOf(BareJid contact, Map<OpenPgpV4Fingerprint, Date> data) throws IOException;
049}