Package org.xrpl.xrpl4j.crypto
Interface PrivateKey
- All Known Implementing Classes:
ImmutableDefaultPrivateKey
,PrivateKey.DefaultPrivateKey
public interface PrivateKey
A typed instance of an XRPL private-key.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
Abstract implementation for immutables. -
Field Summary
Modifier and TypeFieldDescriptionstatic final UnsignedByte
Keys generated from the secp256k1 curve have 33 bytes in XRP Ledger. -
Method Summary
Modifier and TypeMethodDescriptionThe key, as a Base16-encoded (i.e., HEX) string.The key, as a Base58-encoded string.builder()
Instantiates a new builder.static PrivateKey
fromBase16EncodedPrivateKey
(String base16EncodedPrivateKey) Construct aPrivateKey
from a base16-encoded (HEX)String
.static PrivateKey
fromBase58EncodedPrivateKey
(String base58EncodedPrivateKey) Construct aPrivateKey
from a base58-encodedString
.value()
The key, in binary (Note: will be 33 bytes).The type of this key (eitherVersionType.ED25519
orVersionType.SECP256K1
).
-
Field Details
-
PREFIX
Keys generated from the secp256k1 curve have 33 bytes in XRP Ledger. However, keys derived from the ed25519 curve have only 32 bytes, and so get prefixed with this HEX value so that all keys in the ledger are 33 bytes.
-
-
Method Details
-
builder
Instantiates a new builder.- Returns:
- A
ImmutableDefaultPrivateKey.Builder
.
-
fromBase58EncodedPrivateKey
Construct aPrivateKey
from a base58-encodedString
.- Parameters:
base58EncodedPrivateKey
- A base58-encodedString
.- Returns:
- A
PrivateKey
.
-
fromBase16EncodedPrivateKey
Construct aPrivateKey
from a base16-encoded (HEX)String
.- Parameters:
base16EncodedPrivateKey
- A base16-encoded (HEX)String
.- Returns:
- A
PrivateKey
.
-
value
UnsignedByteArray value()The key, in binary (Note: will be 33 bytes).- Returns:
- An instance of
UnsignedByteArray
.
-
base58Encoded
String base58Encoded()The key, as a Base58-encoded string.- Returns:
- A
String
.
-
base16Encoded
String base16Encoded()The key, as a Base16-encoded (i.e., HEX) string. Note that if this is an Ed25519 private-key, then this value contains a leading prefix of `ED`, in hex.- Returns:
- A
String
.
-
versionType
VersionType versionType()The type of this key (eitherVersionType.ED25519
orVersionType.SECP256K1
).- Returns:
- A
VersionType
.
-