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 “Using the JS SDK in a node with oAuth”.
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 section “Options for creating a seed phrase”.
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 :ref:` Transaction description <tx-list>`.
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 section “Examples of creating and sending transactions”.
crypto/encryptCommon- encryption of data for all recipients with a single key CEK, which in turn is wrapped by unique keys KEK for each recipient;
crypto/encryptSeparate- encrypt text separately for each recipient with a unique key;
crypto/decrypt- decrypt data, 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.