public static void depositSecretKey(XMPPConnection connection, SecretkeyElement element)
            throws InterruptedException, PubSubException.NotALeafNodeException,
            XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException,
            SmackException.FeatureNotSupportedException {
        if (!OpenPgpManager.serverSupportsSecretKeyBackups(connection)) {
            throw new SmackException.FeatureNotSupportedException("http://jabber.org/protocol/pubsub#access-whitelist");
        }
        PubSubManager pm = PepManager.getInstanceFor(connection).getPepPubSubManager();
        LeafNode secretKeyNode = pm.getOrCreateLeafNode(PEP_NODE_SECRET_KEY);
        OpenPgpPubSubUtil.changeAccessModelIfNecessary(secretKeyNode, AccessModel.whitelist);

        secretKeyNode.publish(new PayloadItem<>(element));
    }
public static void depositSecretKey ( XMPPConnection connection , SecretkeyElement element ) throws InterruptedException , PubSubException . NotALeafNodeException , XMPPException . XMPPErrorException , SmackException . NotConnectedException , SmackException . NoResponseException , SmackException . FeatureNotSupportedException { if ( ! OpenPgpManager . serverSupportsSecretKeyBackups ( connection ) ) { throw new SmackException . FeatureNotSupportedException ( "http://jabber.org/protocol/pubsub#access-whitelist" ) ; } PubSubManager pm = PepManager . getInstanceFor ( connection ) . getPepPubSubManager ( ) ; LeafNode secretKeyNode = pm . getOrCreateLeafNode ( PEP_NODE_SECRET_KEY ) ; OpenPgpPubSubUtil . changeAccessModelIfNecessary ( secretKeyNode , AccessModel . whitelist ) ; secretKeyNode . publish ( new PayloadItem < > ( element ) ) ; }
Publishes a {@link SecretkeyElement} to the secret key node.
The node will be configured to use the whitelist access model to prevent access from subscribers.

@see <a href="https://xmpp.org/extensions/xep-0373.html#synchro-pep">
XEP-0373 §5. Synchronizing the Secret Key with a Private PEP Node</a>

@param connection {@link XMPPConnection} of the user
@param element a {@link SecretkeyElement} containing the encrypted secret key of the user

@throws InterruptedException if the thread gets interrupted.
@throws PubSubException.NotALeafNodeException if something is wrong with the PubSub node
@throws XMPPException.XMPPErrorException in case of an protocol related error
@throws SmackException.NotConnectedException if we are not connected
@throws SmackException.NoResponseException /watch?v=0peBq89ZTrc
@throws SmackException.FeatureNotSupportedException if the Server doesn't support the whitelist access model