Constructor
new Keypair(keys)
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
keys |
object
|
At least one of keys must be provided.
|
Classes
Methods
canSign() → {boolean}
Returns true
if this Keypair
object contains secret key and can sign.
- Source:
Returns:
- Type:
-
boolean
publicKey() → {string}
Returns public key associated with this Keypair
object.
- Source:
Returns:
- Type:
-
string
rawPublicKey() → {Buffer}
Returns raw public key
- Source:
Returns:
- Type:
-
Buffer
rawSecretKey() → {Buffer}
Returns raw secret key.
- Source:
Returns:
- Type:
-
Buffer
secret() → {string}
Returns secret key associated with this Keypair
object
- Source:
Returns:
- Type:
-
string
sign(data) → {Buffer}
Signs data.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer
|
Data to sign |
Returns:
- Type:
-
Buffer
signDecorated(data) → {xdr.DecoratedSignature}
Returns the decorated signature (hint+sig) for arbitrary data.
- Source:
- See:
-
- TransactionBase.addDecoratedSignature
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer
|
arbitrary data to sign |
Returns:
- Type:
-
xdr.DecoratedSignature
the raw signature structure which can be added directly to a transaction envelope
signPayloadDecorated(data) → {xdr.DecoratedSignature}
Returns the raw decorated signature (hint+sig) for a signed payload signer.
The hint is defined as the last 4 bytes of the signer key XORed with last 4 bytes of the payload (zero-left-padded if necessary).
- Source:
- See:
-
- https://github.com/stellar/stellar-protocol/blob/master/core/cap-0040.md#signature-hint
- TransactionBase.addDecoratedSignature
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer
|
data to both sign and treat as the payload |
Returns:
- Type:
-
xdr.DecoratedSignature
verify(data, signature) → {boolean}
Verifies if signature
for data
is valid.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer
|
Signed data |
signature |
Buffer
|
Signature |
Returns:
- Type:
-
boolean
xdrMuxedAccount(idopt) → {xdr.MuxedAccount}
Creates a xdr.MuxedAccount object from the public key.
You will get a different type of muxed account depending on whether or not you pass an ID.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
string
|
<optional> |
stringified integer indicating the underlying muxed ID of the new account object |
Returns:
- Type:
-
xdr.MuxedAccount
(static) fromPublicKey(publicKey) → {Keypair}
Creates a new Keypair
object from public key.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
publicKey |
string
|
public key (ex. |
Returns:
- Type:
-
Keypair
(static) fromRawEd25519Seed(rawSeed) → {Keypair}
Creates a new Keypair
object from ed25519 secret key seed raw bytes.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
rawSeed |
Buffer
|
Raw 32-byte ed25519 secret key seed |
Returns:
- Type:
-
Keypair
(static) fromSecret(secret) → {Keypair}
Creates a new Keypair
instance from secret. This can either be secret key or secret seed depending
on underlying public-key signature system. Currently Keypair
only supports ed25519.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
secret |
string
|
secret key (ex. |
Returns:
- Type:
-
Keypair
(static) master(networkPassphrase) → {Keypair}
Returns Keypair
object representing network master key.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
networkPassphrase |
string
|
passphrase of the target stellar network (e.g. "Public Global Stellar Network ; September 2015"). |
Returns:
- Type:
-
Keypair