Package org.drasyl.identity
Class Identity
- java.lang.Object
-
- org.drasyl.identity.Identity
-
public class Identity extends Object
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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
CompressedKeyPair
getKeyPair()
CompressedPrivateKey
getPrivateKey()
ProofOfWork
getProofOfWork()
CompressedPublicKey
getPublicKey()
int
hashCode()
boolean
isValid()
Validates the identity by checking whether the proof of work matches the public key.static Identity
of(int proofOfWork, String publicKey, String privateKey)
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)
String
toString()
-
-
-
Method Detail
-
getKeyPair
public CompressedKeyPair getKeyPair()
-
getPublicKey
public CompressedPublicKey getPublicKey()
-
getPrivateKey
public CompressedPrivateKey getPrivateKey()
-
getProofOfWork
public ProofOfWork 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
public static Identity of(ProofOfWork proofOfWork, CompressedKeyPair keyPair)
-
of
public static Identity of(ProofOfWork proofOfWork, String publicKey, String privateKey)
-
-