Constructor
new Keypair(keys)
Parameters:
| Name | Type | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
keys |
object | At least one of keys must be provided.
Properties
|
- Source:
Methods
(static) fromBase58Seed(seed) → {Keypair}
Base58 address encoding is **DEPRECATED**! Use this method only for transition to strkey encoding.
Parameters:
| Name | Type | Description |
|---|---|---|
seed |
string | Base58 secret seed |
- Deprecated:
- Source:
Returns:
- Type
- Keypair
(static) fromContractKey(contractKey) → {Keypair}
Creates a new `Keypair` object from contract key.
Parameters:
| Name | Type | Description |
|---|---|---|
contractKey |
string | contract key (ex. `CB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA`) |
- Source:
Returns:
- Type
- Keypair
(static) fromPublicKey(publicKey) → {Keypair}
Creates a new `Keypair` object from public key.
Parameters:
| Name | Type | Description |
|---|---|---|
publicKey |
string | public key (ex. `GB3KJPLFUYN5VL6R3GU3EGCGVCKFDSD7BEDX42HWG5BWFKB3KQGJJRMA`) |
- Source:
Returns:
- Type
- Keypair
(static) fromRawEd25519Seed(rawSeed) → {Keypair}
Creates a new `Keypair` object from ed25519 secret key seed raw bytes.
Parameters:
| Name | Type | Description |
|---|---|---|
rawSeed |
Buffer | Raw 32-byte ed25519 secret key seed |
- Source:
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.
Parameters:
| Name | Type | Description |
|---|---|---|
secret |
string | secret key (ex. `SDAKFNYEIAORZKKCYRILFQKLLOCNPL5SWJ3YY5NM3ZH6GJSZGXHZEPQS`) |
- Source:
Returns:
- Type
- Keypair
(static) master() → {Keypair}
Returns `Keypair` object representing network master key.
- Source:
Returns:
- Type
- Keypair
(static) random() → {Keypair}
Create a random `Keypair` object.
- Source:
Returns:
- Type
- Keypair
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.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Buffer | Data to sign |
- Source:
Returns:
- Type
- Buffer
verify(data, signature) → {boolean}
Verifies if `signature` for `data` is valid.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
Buffer | Signed data |
signature |
Buffer | Signature |
- Source:
Returns:
- Type
- boolean