001/**
002 *
003 * Copyright 2017 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.omemo.util;
018
019/**
020 * Some constants related to OMEMO.
021 * @author Paul Schaub
022 */
023public final class OmemoConstants {
024
025    // Constants
026    /**
027     * Omemo related namespace.
028     */
029    public static final String OMEMO_NAMESPACE_V_AXOLOTL = "eu.siacs.conversations.axolotl";
030    public static final String OMEMO = "OMEMO";
031
032    // PubSub Node names
033    public static final String PEP_NODE_DEVICE_LIST = OMEMO_NAMESPACE_V_AXOLOTL + ".devicelist";
034    public static final String PEP_NODE_DEVICE_LIST_NOTIFY = PEP_NODE_DEVICE_LIST + "+notify";
035    public static final String PEP_NODE_BUNDLES = OMEMO_NAMESPACE_V_AXOLOTL + ".bundles";
036
037    /**
038     * How many preKeys do we want to publish?
039     */
040    public static final int TARGET_PRE_KEY_COUNT = 100;
041
042    /**
043     * Return the node name of the PEP node containing the device bundle of the device with device id deviceId.
044     *
045     * @param deviceId id of the device
046     * @return node name of the devices bundle node
047     */
048    public static String PEP_NODE_BUNDLE_FROM_DEVICE_ID(int deviceId) {
049        return PEP_NODE_BUNDLES + ":" + deviceId;
050    }
051
052    public static final String BODY_OMEMO_HINT = "I sent you an OMEMO encrypted message but your client doesn’t seem to support that. Find more information on https://conversations.im/omemo";
053
054    /**
055     * Information about the keys used for message encryption.
056     */
057    public static final class Crypto {
058        public static final String KEYTYPE = "AES";
059        public static final int KEYLENGTH = 128;
060        public static final String CIPHERMODE = "AES/GCM/NoPadding";
061        public static final String PROVIDER = "BC";
062    }
063}