Skip to main content

cosmosGetPublicKey

Use requirement

  • Firmware version required
    • UKey Lite 24 / UKey Lite 25: 2.10.0
    • UKey Core 26: 4.0.0

Cosmos: get public key

Retrieves BIP32 extended public derived by given BIP32 path. User is presented with a description of the requested key and asked to confirm the export.

const result = await HardwareSDK.cosmosGetPublicKey(
connectId,
deviceId,
params,
);

Params

Optional common params

Exporting single public key

  • path - required string | Array<number> minimum length is 1.
  • curve - optional string of the elliptic curve algorithm, default is secp256k1
  • showOnUKey - optional boolean determines if address will be displayed on device. Default is set to true

Exporting bundle of public keys

  • bundle - Array of Objects with path, showOnUKey , curve fields

Example

Return public key of fifth cosmos account:

HardwareSDK.cosmosGetPublicKey(connectId, deviceId, {
path: "m/44'/118'/0'/0/0",
curve: "secp256k1",
showOnUKey: true,
});

Return a bundle of public keys for multiple cosmos accounts:

HardwareSDK.cosmosGetPublicKey(connectId, deviceId, {
bundle: [
{ path: "m/44'/118'/0'/0/0" }, // account 1
{ path: "m/44'/118'/1'/0/0" }, // account 2
{ path: "m/44'/118'/2'/0/0" }, // account 3
],
});

Result

Result with only one public key

{
success: true,
payload: {
path: string, // hardended path
publicKey: string
}
}

Read more about BIP32 serialization format

Result with bundle of public keys

{
success: true,
payload: [
{ path: serializedPath, publicKey }, // account 1
{ path: serializedPath, publicKey }, // account 2
{ path: serializedPath, publicKey }, // account 3
]
}

Error

{
success: false,
payload: {
error: string, // error message
code: number // error code
}
}