Skip to main content

KeyManagementApi

All URIs are relative to http://localhost

MethodHTTP requestDescription
addPubkeyPOST /pubkeys/{pubkey}Add pubkey for current user
addPubkeyForUserPOST /users/{user_id}/pubkeys/{pubkey}Add pubkey for user by user_id
createWalletPOST /pubkeysGenerate custodial wallet
getPubkeysGET /pubkeysRetrieve pubkeys
getPubkeysForUserGET /users/{user_id}/pubkeysRetrieve pubkeys by user_id

addPubkey#

/*** @returns String**/async function addPubkey(pubkey: String)

Add pubkey for current user

Notes:#

This call expects empty body

Example#

const 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);}

Parameters#

NameTypeDescriptionNotes
pubkeyString

Return type#

String

Authorization#

two_factor

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

Example#

const 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);}

Parameters#

NameTypeDescriptionNotes
userIdStringPublic key to add
pubkeyString
`user_id` to grant public key ownership to

Return type#

String

Authorization#

two_factor

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.

Example#

const 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);}

Parameters#

This endpoint does not have any parameters.

Return type#

String

Authorization#

two_factor

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.

Example#

const 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);}

Parameters#

This endpoint does not have any parameters.

Return type#

[String]

Authorization#

apiKey

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

Example#

const 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);}

Parameters#

NameTypeDescriptionNotes
userIdString

Return type#

[String]

Authorization#

apiKey

HTTP request headers#

  • Content-Type: Not defined
  • Accept: /