Package org.stellar.sdk
Class StrKey
java.lang.Object
org.stellar.sdk.StrKey
StrKey is a helper class that allows encoding and decoding Stellar keys to/from strings, i.e.
between their binary and string (i.e. "GABCD...", etc.) representations.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
decodeContract
(String data) Decodes strkey contract ID (C...) to raw bytes.static byte[]
decodeEd25519PublicKey
(String data) Decodes strkey ed25519 public key (G...) to raw datastatic byte[]
decodeEd25519SecretSeed
(char[] data) Decodes strkey ed25519 seed char array (S...) to raw bytesstatic MuxedAccount
decodeMuxedAccount
(String address) Decodes strkey Stellar account ID (G...) or muxed account ID (M...) toMuxedAccount
.static byte[]
decodePreAuthTx
(String data) Decodes strkey PreAuthTx (T...) to raw bytesstatic byte[]
decodeSha256Hash
(String data) Decodes strkey SHA256 hash (X...) to raw bytesstatic SignedPayloadSigner
decodeSignedPayload
(String data) Decodes strkey signed payload (P...) toSignedPayloadSigner
static String
encodeContract
(byte[] data) Encodes raw data to strkey contract ID (C...)static String
encodeEd25519PublicKey
(byte[] data) Encodes raw data to strkey ed25519 public key (G...)static String
encodeEd25519PublicKey
(AccountID accountID) Encodes raw data to strkey Stellar account ID (G...)static char[]
encodeEd25519SecretSeed
(byte[] data) Encodes raw data to strkey ed25519 seed in char array (S...)static String
encodeMuxedAccount
(MuxedAccount muxedAccount) Encodes raw data to strkey Stellar muxed account ID (M...static String
encodePreAuthTx
(byte[] data) Encodes raw data to strkey PreAuthTx (T...)static String
encodeSha256Hash
(byte[] data) Encodes raw data to strkey SHA256 hash (X...)static String
encodeSignedPayload
(SignedPayloadSigner signedPayloadSigner) EncodesSignedPayloadSigner
to strkey signed payload (P...)static AccountID
encodeToXDRAccountId
(String data) Encodes strkey Stellar account ID (G...) toAccountID
.static MuxedAccount
Encodes strkey Stellar account ID (G...) or muxed account ID (M...) toMuxedAccount
.
-
Constructor Details
-
StrKey
public StrKey()
-
-
Method Details
-
encodeEd25519PublicKey
Encodes raw data to strkey ed25519 public key (G...)- Parameters:
data
- data to encode- Returns:
- "G..." representation of the key
-
decodeEd25519PublicKey
Decodes strkey ed25519 public key (G...) to raw data- Parameters:
data
- data to decode- Returns:
- raw bytes
-
encodeEd25519SecretSeed
public static char[] encodeEd25519SecretSeed(byte[] data) Encodes raw data to strkey ed25519 seed in char array (S...)- Parameters:
data
- data to encode- Returns:
- "S..." representation of the key in char array
-
decodeEd25519SecretSeed
public static byte[] decodeEd25519SecretSeed(char[] data) Decodes strkey ed25519 seed char array (S...) to raw bytes- Parameters:
data
- data to decode- Returns:
- raw bytes
-
encodePreAuthTx
Encodes raw data to strkey PreAuthTx (T...)- Parameters:
data
- data to encode- Returns:
- "T..." representation of the key
-
decodePreAuthTx
Decodes strkey PreAuthTx (T...) to raw bytes- Parameters:
data
- data to decode- Returns:
- raw bytes
-
encodeSha256Hash
Encodes raw data to strkey SHA256 hash (X...)- Parameters:
data
- data to encode- Returns:
- "X..." representation of the key
-
decodeSha256Hash
Decodes strkey SHA256 hash (X...) to raw bytes- Parameters:
data
- data to decode- Returns:
- raw bytes
-
encodeSignedPayload
EncodesSignedPayloadSigner
to strkey signed payload (P...)- Parameters:
signedPayloadSigner
- the signed payload signer- Returns:
- "P..." representation of the key
-
decodeSignedPayload
Decodes strkey signed payload (P...) toSignedPayloadSigner
- Parameters:
data
- data to decode- Returns:
- raw bytes
-
encodeContract
Encodes raw data to strkey contract ID (C...)- Parameters:
data
- data to encode- Returns:
- "C..." representation of the key
-
decodeContract
Decodes strkey contract ID (C...) to raw bytes.- Parameters:
data
- data to decode- Returns:
- raw bytes
-
encodeEd25519PublicKey
Encodes raw data to strkey Stellar account ID (G...)- Parameters:
accountID
- data to encode- Returns:
- "G..." representation of the key
-
encodeMuxedAccount
Encodes raw data to strkey Stellar muxed account ID (M... or G...)- Parameters:
muxedAccount
- the muxed account to encode- Returns:
- "M..." or "G..." representation of the key
-
decodeMuxedAccount
Decodes strkey Stellar account ID (G...) or muxed account ID (M...) toMuxedAccount
.- Parameters:
address
- the address to decode- Returns:
MuxedAccount
representation of the key
-
encodeToXDRAccountId
Encodes strkey Stellar account ID (G...) toAccountID
.- Parameters:
data
- the data to encode- Returns:
AccountID
representation of the key
-
encodeToXDRMuxedAccount
Encodes strkey Stellar account ID (G...) or muxed account ID (M...) toMuxedAccount
.- Parameters:
data
- the data to encode- Returns:
MuxedAccount
representation of the key
-