All Downloads are FREE. Search and download functionalities are using the official Maven repository.

it.auties.whatsapp.model.signal.keypair.ISignalKeyPair Maven / Gradle / Ivy

There is a newer version: 2.7.2
Show newest version
package it.auties.whatsapp.model.signal.keypair;

import it.auties.whatsapp.model.request.Node;
import it.auties.whatsapp.util.BytesHelper;
import it.auties.whatsapp.util.KeyHelper;

public sealed interface ISignalKeyPair permits SignalKeyPair, SignalPreKeyPair, SignalSignedKeyPair {
    byte[] privateKey();

    Node toNode();

    SignalKeyPair toGenericKeyPair();

    default byte[] encodedPublicKey() {
        return KeyHelper.withHeader(publicKey());
    }

    byte[] publicKey();

    default byte[] encodedId() {
        return BytesHelper.intToBytes(id(), 3);
    }

    default int id() {
        throw new UnsupportedOperationException(getClass().getName() + " doesn't provide an id");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy