Package org.drasyl.identity
Class Identity
java.lang.Object
org.drasyl.identity.Identity
Represents the private identity of a peer (includes the proof of work, the public and private
key). Should be kept secret!.
This is an immutable object.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
hashCode()
boolean
isValid()
Validates the identity by checking whether the proof of work matches the public key.static Identity
static Identity
of
(ProofOfWork proofOfWork, String publicKey, String privateKey) static Identity
of
(ProofOfWork proofOfWork, CompressedKeyPair keyPair) static Identity
of
(ProofOfWork proofOfWork, CompressedPublicKey publicKey, CompressedPrivateKey privateKey) toString()
-
Constructor Details
-
Identity
- Throws:
CryptoException
-
-
Method Details
-
getKeyPair
-
getPublicKey
-
getPrivateKey
-
hashCode
public int hashCode() -
equals
-
toString
-
getProofOfWork
-
isValid
public boolean isValid()Validates the identity by checking whether the proof of work matches the public key.- Returns:
true
if this identity is valid. Otherwisefalse
-
of
public static Identity of(ProofOfWork proofOfWork, CompressedPublicKey publicKey, CompressedPrivateKey privateKey) -
of
-
of
public static Identity of(ProofOfWork proofOfWork, String publicKey, String privateKey) throws CryptoException - Throws:
CryptoException
-
of
public static Identity of(int proofOfWork, String publicKey, String privateKey) throws CryptoException - Throws:
CryptoException
-