PrivateKeyCiphertext
Overview
Represents an encrypted private key. The PrivateKeyCiphertext class provides methods for encrypting and decrypting private keys using a secret string. This allows for secure storage of private keys.
Methods
encryptPrivateKey
Encrypt a private key using a secret string. The secret is sensitive and will be needed to decrypt the private key later, so it should be stored securely.
encryptPrivateKey(private_key, secret) ► PrivateKeyCiphertext
| Param | Type | Description |
|---|---|---|
| private_key | PrivateKey | Private key to encrypt |
| secret | string | Secret to encrypt the private key with |
| return | PrivateKeyCiphertext | Private key ciphertext |
decryptToPrivateKey
Decrypts a private ciphertext using a secret string. This must be the same secret used to encrypt the private key.
decryptToPrivateKey(secret) ► PrivateKey
| Param | Type | Description |
|---|---|---|
| secret | string | Secret used to encrypt the private key |
| return | PrivateKey | Private key |
toString
Returns the ciphertext string
toString() ► string
| Param | Type |
|---|---|
| return | string |
fromString
Creates a PrivateKeyCiphertext from a string
fromString(ciphertext) ► PrivateKeyCiphertext
| Param | Type | Description |
|---|---|---|
| ciphertext | string | Ciphertext string |
| return | PrivateKeyCiphertext | Private key ciphertext |