Installation and usage of the platform
Authorization in the blockchain¶
Authorization can be done both in the browser and in the Node.js environment.
When authorizing in a browser, the Fetch API interface is used.
For authorization via Node.js, the Axios HTTP client is used.
If the blockchain node used by the application uses the oAuth authorization method, it is recommended to use the api-token-refresher library for its authorization. This library automatically updates access tokens when their usage time expires. For more information about the oAuth authorization and the api-token-refresher library, see the Using the JS SDK in a node with oAuth authorization section.
Seed phrase generation¶
The JS SDK-based application can work with seed phrases in the following variants:
create a new randomized seed phrase;
create a seed phrase from an existing phrase;
encrypt the seed phrase with a password or decrypt it.
Examples of how the JS SDK works with seed phrases are given in the Variants of generation of a seed phrase and work with it in the JS SDK section.
Signing and sending transactions¶
For JS SDK-based applications, any platform transactions can be signed and sent to the blockchain. A list of all transactions is given in the Description of transactions.
The process of signing and sending transactions to the network is as follows:
The application initiates generation of a transaction.
All transaction fields are serialized into bytecode using the transactions-factory auxiliary component of the JS SDK.
The transaction is then signed using the signature-generator component with the user’s private key in the browser or in the Node.js environment. The transaction is signed using a POST request
The application gets a response in the form of a transaction hash to a POST request.
Examples of signing and sending different types of transactions are given in the Creating and sending transactions with the use of the JS SDK section.
crypto/encryptCommon– data encryption with a single CEK key for all recipients, which in turn is wrapped by unique KEK keys for each recipient;
crypto/encryptSeparate– separate text encryption with a unique key for each recipient;
crypto/decrypt– data decryption, provided that the key of the message recipient is in the keystore of the node.
The signature-generator component also supports both GOST and Waves cryptography algorithms.