KeyManagementApi
All URIs are relative to http://localhost
Method | HTTP request | Description |
---|---|---|
addPubkey | POST /pubkeys/{pubkey} | Add pubkey for current user |
addPubkeyForUser | POST /users/{user_id}/pubkeys/{pubkey} | Add pubkey for user by user_id |
createWallet | POST /pubkeys | Generate custodial wallet |
getPubkeys | GET /pubkeys | Retrieve pubkeys |
getPubkeysForUser | GET /users/{user_id}/pubkeys | Retrieve pubkeys by user_id |
#
addPubkey/*** @returns String**/async function addPubkey(pubkey: String)
Add pubkey for current user
#
Notes:This call expects empty body
#
Exampleconst yat = require('yatjs');const api = new yat.YatJs();
await api.login("[email protected]", "your_password");
let pubkey = "pubkey_example"; // String // populate pubkey...
try { let res = await api.keyManagement().addPubkey(pubkey); // res is of type String console.log('API called successfully. Result: ', res);} catch (error) { console.error(error);}
#
ParametersName | Type | Description | Notes |
---|---|---|---|
pubkey | String |
#
Return typeString
#
Authorization#
HTTP request headers- Content-Type: Not defined
- Accept: /
#
addPubkeyForUser/*** @returns String**/async function addPubkeyForUser(userId: String, pubkey: String)
Add pubkey for user by user_id
#
Notes:NOTE: user should have scope UserPubkeyWrite
This call expects empty body
#
Exampleconst yat = require('yatjs');const api = new yat.YatJs();
await api.login("[email protected]", "your_password");
let userId = "userId_example"; // String | Public key to add// populate userId...
let pubkey = null; // String | `user_id` to grant public key ownership to// populate pubkey...
try { let res = await api.keyManagement().addPubkeyForUser(userId, pubkey); // res is of type String console.log('API called successfully. Result: ', res);} catch (error) { console.error(error);}
#
ParametersName | Type | Description | Notes |
---|---|---|---|
userId | String | Public key to add | |
pubkey | String | ||
`user_id` to grant public key ownership to |
#
Return typeString
#
Authorization#
HTTP request headers- Content-Type: Not defined
- Accept: /
#
createWallet/*** @returns String**/async function createWallet()
Generate custodial wallet
#
Notes:Generates custodial wallet with pubkey for currently authenticated user. This call expects empty body.
#
Exampleconst yat = require('yatjs');const api = new yat.YatJs();
await api.login("[email protected]", "your_password");
try { let res = await api.keyManagement().createWallet(); // res is of type String console.log('API called successfully. Result: ', res);} catch (error) { console.error(error);}
#
ParametersThis endpoint does not have any parameters.
#
Return typeString
#
Authorization#
HTTP request headers- Content-Type: Not defined
- Accept: /
#
getPubkeys/*** @returns [String]**/async function getPubkeys()
Retrieve pubkeys
#
Notes:Retrieves pubkeys owned by currently authenticated user. This call expects empty body.
#
Exampleconst yat = require('yatjs');const api = new yat.YatJs();
await api.login("[email protected]", "your_password");
try { let res = await api.keyManagement().getPubkeys(); // res is of type [String] console.log('API called successfully. Result: ', res);} catch (error) { console.error(error);}
#
ParametersThis endpoint does not have any parameters.
#
Return type[String]
#
Authorization#
HTTP request headers- Content-Type: Not defined
- Accept: /
#
getPubkeysForUser/*** @returns [String]**/async function getPubkeysForUser(userId: String)
Retrieve pubkeys by user_id
#
Notes:NOTE: user should have scope UserPubkeyList
#
Exampleconst yat = require('yatjs');const api = new yat.YatJs();
await api.login("[email protected]", "your_password");
let userId = null; // String // populate userId...
try { let res = await api.keyManagement().getPubkeysForUser(userId); // res is of type [String] console.log('API called successfully. Result: ', res);} catch (error) { console.error(error);}
#
ParametersName | Type | Description | Notes |
---|---|---|---|
userId | String | ||
#
Return type[String]
#
Authorization#
HTTP request headers- Content-Type: Not defined
- Accept: /