Package org.drasyl.identity
Class IdentityPublicKey
- java.lang.Object
-
- org.drasyl.identity.IdentityPublicKey
-
- All Implemented Interfaces:
DrasylAddress
,Key
,PublicKey
,Address
public abstract class IdentityPublicKey extends Object implements PublicKey, Address, DrasylAddress
This class models a ed25519 public key that is used as node's unique overlay address.This is an immutable object.
-
-
Field Summary
Fields Modifier and Type Field Description static short
KEY_LENGTH_AS_BYTES
static short
KEY_LENGTH_AS_STRING
-
Constructor Summary
Constructors Constructor Description IdentityPublicKey()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description KeyAgreementPublicKey
getLongTimeKeyAgreementKey()
IdentityPublicKey
intern()
static IdentityPublicKey
of(byte[] bytes)
Converts a byte[] into aIdentityPublicKey
.static IdentityPublicKey
of(com.google.protobuf.ByteString bytes)
static IdentityPublicKey
of(String bytes)
Converts aString
into aIdentityPublicKey
.byte[]
toByteArray()
com.goterl.lazysodium.utils.Key
toSodiumKey()
String
toString()
-
-
-
Field Detail
-
KEY_LENGTH_AS_BYTES
public static final short KEY_LENGTH_AS_BYTES
- See Also:
- Constant Field Values
-
KEY_LENGTH_AS_STRING
public static final short KEY_LENGTH_AS_STRING
- See Also:
- Constant Field Values
-
-
Method Detail
-
getLongTimeKeyAgreementKey
public KeyAgreementPublicKey getLongTimeKeyAgreementKey()
- Returns:
- this public key as key agreement key (curve25519)
-
intern
public IdentityPublicKey intern()
-
toByteArray
public byte[] toByteArray()
- Specified by:
toByteArray
in interfaceKey
-
toSodiumKey
public com.goterl.lazysodium.utils.Key toSodiumKey()
- Specified by:
toSodiumKey
in interfaceKey
- Returns:
- this key as
Key
-
of
public static IdentityPublicKey of(com.google.protobuf.ByteString bytes)
-
of
public static IdentityPublicKey of(byte[] bytes)
Converts a byte[] into aIdentityPublicKey
.- Parameters:
bytes
- public key- Returns:
IdentityPublicKey
- Throws:
NullPointerException
- ifkey
isnull
-
of
public static IdentityPublicKey of(String bytes)
Converts aString
into aIdentityPublicKey
.- Parameters:
bytes
- keyAsHexString as String- Returns:
IdentityPublicKey
- Throws:
NullPointerException
- ifkeyAsHexString
isnull
IllegalArgumentException
- ifkeyAsHexString
does not conform to a valid keyAsHexString string
-
-