public class KeyPair
extends java.lang.Object
Constructor and Description |
---|
KeyPair(EdDSAPublicKey publicKey)
Creates a new KeyPair without a private key.
|
KeyPair(EdDSAPublicKey publicKey,
EdDSAPrivateKey privateKey)
Creates a new KeyPair from the given public and private keys.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canSign()
Returns true if this Keypair is capable of signing
|
boolean |
equals(java.lang.Object obj) |
static KeyPair |
fromAccountId(java.lang.String accountId)
Creates a new DigitalBits KeyPair from a strkey encoded DigitalBits account ID.
|
static KeyPair |
fromPublicKey(byte[] publicKey)
Creates a new DigitalBits keypair from a 32 byte address.
|
static KeyPair |
fromSecretSeed(byte[] seed)
Creates a new DigitalBits keypair from a raw 32 byte secret seed.
|
static KeyPair |
fromSecretSeed(char[] seed)
Creates a new DigitalBits KeyPair from a strkey encoded DigitalBits secret seed.
|
static KeyPair |
fromSecretSeed(java.lang.String seed)
Insecure Creates a new DigitalBits KeyPair from a strkey encoded DigitalBits secret seed.
|
static KeyPair |
fromXdrPublicKey(io.digitalbits.sdk.xdr.PublicKey key) |
static KeyPair |
fromXdrSignerKey(io.digitalbits.sdk.xdr.SignerKey key) |
java.lang.String |
getAccountId()
Returns the human readable account ID encoded in strkey.
|
byte[] |
getPublicKey() |
char[] |
getSecretSeed()
Returns the human readable secret seed encoded in strkey.
|
io.digitalbits.sdk.xdr.SignatureHint |
getSignatureHint() |
io.digitalbits.sdk.xdr.PublicKey |
getXdrPublicKey() |
io.digitalbits.sdk.xdr.SignerKey |
getXdrSignerKey() |
static KeyPair |
random()
Generates a random DigitalBits keypair.
|
byte[] |
sign(byte[] data)
Sign the provided data with the keypair's private key.
|
io.digitalbits.sdk.xdr.DecoratedSignature |
signDecorated(byte[] data)
Sign the provided data with the keypair's private key and returns
DecoratedSignature . |
boolean |
verify(byte[] data,
byte[] signature)
Verify the provided data and signature match this keypair's public key.
|
public KeyPair(EdDSAPublicKey publicKey)
publicKey
- public KeyPair(EdDSAPublicKey publicKey, EdDSAPrivateKey privateKey)
publicKey
- privateKey
- public boolean canSign()
public static KeyPair fromSecretSeed(char[] seed)
seed
- Char array containing strkey encoded DigitalBits secret seed.KeyPair
public static KeyPair fromSecretSeed(java.lang.String seed)
seed
- The strkey encoded DigitalBits secret seed.KeyPair
public static KeyPair fromSecretSeed(byte[] seed)
seed
- The 32 byte secret seed.KeyPair
public static KeyPair fromAccountId(java.lang.String accountId)
accountId
- The strkey encoded DigitalBits account ID.KeyPair
public static KeyPair fromPublicKey(byte[] publicKey)
publicKey
- The 32 byte public key.KeyPair
public static KeyPair random()
public java.lang.String getAccountId()
public char[] getSecretSeed()
public byte[] getPublicKey()
public io.digitalbits.sdk.xdr.SignatureHint getSignatureHint()
public io.digitalbits.sdk.xdr.PublicKey getXdrPublicKey()
public io.digitalbits.sdk.xdr.SignerKey getXdrSignerKey()
public static KeyPair fromXdrPublicKey(io.digitalbits.sdk.xdr.PublicKey key)
public static KeyPair fromXdrSignerKey(io.digitalbits.sdk.xdr.SignerKey key)
public byte[] sign(byte[] data)
data
- The data to sign.public io.digitalbits.sdk.xdr.DecoratedSignature signDecorated(byte[] data)
DecoratedSignature
.data
- public boolean verify(byte[] data, byte[] signature)
data
- The data that was signed.signature
- The signature.java.lang.RuntimeException
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object