get proxy key

API details

Retrieve the delegate key. The obtained delegate key is encrypted. The Hibit SDK uses a signed message from the source chain wallet to generate the decryption password and then returns the decrypted key.

Get the proxy key

post
Body
chainstringOptional
chainNetworkstring | nullableOptional
messagestring | nullableOptional
signaturestring | nullableOptional
Responses
200
OK
post
POST /v1/proxy-key HTTP/1.1
Host: testnetopenapi.hibit.app
Content-Type: application/json
Accept: */*
Content-Length: 74

{
  "chain": "text",
  "chainNetwork": "text",
  "message": "text",
  "signature": "text"
}
{
  "code": 1,
  "message": "text",
  "data": {
    "ex3KeyPair": {
      "privateKeyHex": "text",
      "publicKeyHex": "text",
      "schema": 1
    },
    "userId": "text"
  }
}

Code example

import { hibitClient, Chain, WalletSignatureSchema, HibitNetwork, GetProxyKeyInput } from '@delandlabs/hibit-sdk';
import { MyWalletApi } from './my-wallet-api'; // Your IWalletApi implementation

// Set client options
hibitClient.setOptions({
  network: HibitNetwork.Testnet,
  hin: 10000n,
  proxyKey: 'your proxy key in hex'
});

// Set your wallet API implementation
hibitClient.setWalletApi(new MyWalletApi());

// Prepare input for getting the proxy key
const getProxyKeyInput: GetProxyKeyInput = {
  chain: Chain.Ethereum,
  signatureSchema: WalletSignatureSchema.EvmEcdsa,
  timestamp: Date.now()
};

// Example get proxy key message generated by IWalletApi:
// subject: retrieve encrypted proxy key
// wallet_id: 0x2710
// sign_schema: 0x1
// timestamp: 1710000000000

const proxyKeypair = await hibitClient.getProxyKeypair(getProxyKeyInput);
console.log('Proxy keypair:', proxyKeypair);

SDK

Source code https://github.com/Deland-Labs/hibit-sdk

References

What is HIN?

How to Obtain your HIN and Proxy Key?

Last updated