🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

@secux/app-xrp

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@secux/app-xrp

SecuX Hardware Wallet XRP API

latest
npmnpm
Version
3.0.4
Version published
Maintainers
2
Created
Source

lerna view on npm npm module downloads

@secux/app-xrp

SecuX Hardware Wallet XRP API

Usage

import { SecuxXRP } from "@secux/app-xrp";

First, create instance of ITransport


Examples

  • Get address of bip44 path
const address = await device.getAddress("m/44'/144'/0'/0/0");

/*

// transfer data to hardware wallet by custom transport layer.
const data = SecuxXRP.prepareAddress("m/44'/144'/0'/0/0");
const response = await device.Exchange(data);
const address = SecuxXRP.resolveAddress(response);

*/
  • Sign transaction
let payment = {
    TransactionType: "Payment",
    Account: "rD17Ez7fBpuwVp6smfjYhPKD3pwiN5QGKX",
    Destination: "rGNitVptpmpCNYC23LbQ9yfCnAf1Z6gq7X",
    amount: 1e6
};

// fetch data from XRP api
const { BroadcastClient } = require("xrpl");
client = new BroadcastClient(["wss://s1.ripple.com"]);
await client.connect();
payment = await client.autofill(payment);

// sign
const raw_tx = await device.sign("m/44'/144'/0'/0/0", payment);

/*

// transfer data to hardware wallet by custom transport layer.
const { commandData, serialized } = SecuxXRP.prepareSign("m/44'/144'/0'/0/0", {
    ...payment,
    SigningPubKey: "026771406ace54da2cae8b168862697ca35bc3db56c90f4270adb307ac9a38fe9c"
});
const response = await device.Exchange(data);
const raw_tx = SecuxXRP.resolveTransaction(response, serialized);

*/

// broadcast
await client.submit(raw_tx);

API Reference

XRP package for SecuX device

Kind: global class


SecuxXRP.prepareAddress ⇒ communicationData

Prepare data for XRP address.

Returns: communicationData - data for sending to device

ParamTypeDescription
pathstringm/44'/144'/...

SecuxXRP.addressConvert(publickey) ⇒ string

Convert secp256k1 publickey to XRP address.

Returns: string - XRP address

ParamTypeDescription
publickeystring | Buffersecp256k1 publickey

SecuxXRP.resolveAddress(response) ⇒ string

Generate XRP address from response data.

Returns: string - XRP address

ParamTypeDescription
responsecommunicationDatadata from device

SecuxXRP.preparePublickey(path) ⇒ communicationData

Prepare data for secp256k1 publickey.

Returns: communicationData - data for sending to device

ParamTypeDescription
pathstringm/44'/144'/...

SecuxXRP.resolvePublickey(response) ⇒ string

Resolve secp256k1 publickey from response data.

Returns: string - secp256k1 publickey (hex string)

ParamTypeDescription
responsecommunicationDatadata from device

SecuxXRP.prepareXPublickey(path) ⇒ communicationData

Prepare data for xpub.

Returns: communicationData - data for sending to device

ParamTypeDescription
pathstringm/44'/144'/...

SecuxXRP.resolveXPublickey(response, path) ⇒ string

Generate xpub from response data.

Returns: string - xpub

ParamTypeDescription
responsecommunicationDatadata from device
pathstringm/44'/144'/...

SecuxXRP.prepareSign(path, json) ⇒ prepared

Prepare data for signing.

Returns: prepared - prepared object

ParamTypeDescription
pathstringm/44'/144'/...
jsonbaseObjecttransaction object (same as XRP api)

SecuxXRP.resolveSignature(response) ⇒ string

Resolve signature from response data.

Returns: string - signature (hex string)

ParamTypeDescription
responsecommunicationDatadata from device

SecuxXRP.resolveTransaction(response, serialized) ⇒ string

Generate raw transaction for broadcasting.

Returns: string - signed raw transaction

ParamTypeDescription
responsecommunicationDatadata from device
serializedcommunicationData


baseObject

Properties

NameTypeDescription
TransactionTypestring
SigningPubKeystring | Buffered25519 publickey
Sequencenumber
Feestring | number
LastLedgerSequencenumber
[Account]stringsending address
[Destination]stringreceiving address
[Amount]string | number
[SourceTag]number
[DestinationTag]number

prepared

Properties

NameTypeDescription
commandDatacommandDatadata for sending to device
serializedcommandData

© 2018-21 SecuX Technology Inc.

authors:
andersonwu@secuxtech.com

Keywords

secux

FAQs

Package last updated on 13 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts