Creates a Public/Private Key Pair which can be applied to Identities during creation or when replacing a key. An Identity's keys are used to sign and verify messages.
Note: You do not need to use our SDK utility to create Public/Private Key Pairs. Key Pairs can also be generated by applying ed25519 algorithm, however a special encoding scheme is used rather than simply the raw 32 byte arrays. For details, please refer to Identity API Documentation here.
Sample
factom_client.utils.generate_key_pair()
Returns
A key pair object with Public and Private keys.
- private_key: string
The private key in base58 Idsec format. - public_key: string
The public key in base58 Idpub format.
{
'private_key':'idsec2rk3MH1kwZVeKD4Br3UTaU2VHxZF99kdkx27ryAhfMGYBgPgQH',
'public_key':'idpub2WL2aH5Y2s7atB1LwjEyaKa62pnuJXUaL5kcbahzwahc1Hiba6'
}
Very similar to generateKeyPair()
in that it creates a public/private key pair which can be applied to Identity creation or replacement. However, this method allows you to pass in your own standard ed25519 key, which is converted into a key pair.
Sample
factom_client.utils.convert_raw_to_key_pair("abcdefghijklmnopqrstuvwxyz123456")
Parameters
| |
Returns
A key pair object with public and private keys.
- privateKey: string
The private key in base58 Idsec format. - publicKey: string
The public key in base58 Idpub format.
Response
{
'private_key': 'idseaoBBq4DskQwXGffkKQgYxT7zCuQFAPqVic3ZFayDZThXas1z2jv',
'public_key': 'idpub3g5z2JPJCRqvPB1S4NtD6BWiVhDtV15CxdrgQadX1L9qzYzQKC'
}
This method converts an idpub/idsec key to a raw Uint8Array.
Sample
factom_client.utils.covert_to_raw("idsec2ioPQqJvJzzwqskEW67yrWd2GwQMs1oCuLHsLHxejmBbEFpEY8")
Parameters
|
Returns
A key bytes array
Response
[
206,
52,
64,
7,
230,
61,
24,
192,
43,
186,
215,
44,
182,
4,
8,
81,
1,
203,
226,
186,
148,
125,
4,
67,
251,
60,
240,
170,
194,
252,
23,
203 ]