Onboarding Identity

To start using activeledger sdk, the user need to create an identity first to register himself in the activeledger network, this step is called onboarding. If you are an existed user and wish to reuse you identity assigned by the network before, please check other documents.

Create Identity

Identity is a handle for key management, however, the user need to understand that any key generated by this sdk should be safely stored separately by the user and we have no responsibility for key infromation lost.

To create an identity, simplely:

from activeLedger-sdk import onboard

user = onboard.createIdentity([‘identity name’])

The identity name expects a string and if any other types are used,the default will be ‘identity’

Generate Key Pairs

To create a new key pair, simplely:

user.generate_key([‘key type’], [‘key length’])

Supported key types are rsa and secp256k1(for eliptic curve), the default key length for rsa is 2048.

Import Key Pairs

To import a existing key pair, simplely:

user.import_key([‘key type’], [‘public key file name’], [‘private key file name’])

Public key and private key must in pkcs8pem format and must be played in /sdk-keypairs folder

Export Key Pairs

To export key pair from the identity, simplely:

user.export_key()

Exporting keys are highly encouraged and new key pair must be exported first once generated to make sure sdk user will not lost their key pair. This sdk is not made for key stored purposes and the user is responsible for any key lost if key is not exported.

Onboarding

Http address need to be set before onboarding, this can be done with:

user.setHTTP([‘activeledger server address:port’])

Onboardign the user after http address set:

res = onboard.onboardIdentity(user)

Stream ID

After onboarding, the user identity will receive a stream id which is the actual identity for the user to manage their transactions and user other functionalities on the ledger, user must set the stream id to this identity. This will also generate a files containing the stream id information.

user.setStreamID(res)