0.6.1
MyFactomWallet Ledger API
(Transport<any>)
import Fct from "@factoid.org/hw-app-fct";
const fct = new Fct(transport)
get Factom address for a given BIP 32 path.
(string)
a path in BIP 32 format (note: all paths muth be hardened (e.g. .../0'/0' )
(boolean)
(boolean)
Promise<{publicKey: string, address: string, chaincode: string, chainid: string}>
:
an object with a publicKey and address with optional chainCode and chainid
const fctaddr = await fct.getAddress("44'/131'/0'/0/0")
const ecaddr = await fct.getAddress("44'/132'/0'/0/0")
const idaddr = await fct.getAddress("44'/281'/0'/0/0")
You can sign a transaction and retrieve v, r, s given the raw transaction and the BIP 32 path of the account to sign
(string)
a path in BIP 32 format (note: all paths muth be hardened (e.g. .../0'/0' )
(string)
The raw fct transaction request
Promise<{v: string, r: string, s: string}>
const result = await fct.signTransaction("44'/131'/0'/0/0", "02016253dfaa7301010087db406ff65cb9dd72a1e99bcd51da5e03b0ccafc237dbf1318a8d7438e22371c892d6868d20f02894db071e2eb38fdc56c697caaeba7dc19bddae2c6e7084cc3120d667b49f")
You can sign an entry or chain commit and retrieve v, k, s given the raw transaction and the BIP 32 path of the account to sign
(string)
a path in BIP 32 format (note: all paths muth be hardened (e.g. .../0'/0' )
(string)
this is the ledger for a entry or chain commit
(boolean)
set this to true if the rawTxHex is a chain commit ledger.
Promise<{k: string, s: string}>
fct.signCommit("44'/132'/0'/0/0", "00016227acddfe57cf6740c4f30ae39d71f75710fb4ea9c843d5c01755329a42ccab52034e1f7901d5b8efdb52a15c4007d341eb1193903a021ed7aaa9a3cf4234c32ef8a213de00",false).then(result => ...)
You can sign an arbitrary message and retrieve v, k, s given the raw transaction and the BIP 32 path of the account to sign The message will be automatically hashed by the device using either sha256 (default) or sha512 if tosha512 is set to true. If coin types 131 or 132 are used "FCT Signed Message\n" or "EC Signed Message\n" is prepended to the message inside the ledger prior to the device hashing then signing the hash. If the identity coin type 281 is used, then the message is directly hashed then signed by the ledger.
(string)
a path in BIP 32 format (note: all paths muth be hardened (e.g. .../0'/0' )
(Buffer)
this is the raw data Buffer to be signed
(boolean)
set this to true to hash the rawMessage using sha512, the default (or false) is sha256.
Promise<{k: string, s: string, h: string}>
fct.signMessageHash("44'/281'/0'/0/0", "The quick brown fox jumps over the lazy dog.",true).then(result => ...)
You can sign an entry or chain commit and retrieve v, k, s given the raw transaction and the BIP 32 path of the account to sign
(string)
(any)
a path in BIP 32 format (note: all paths muth be hardened (e.g. .../0'/0' )
(any)
this is the ledger for a entry or chain commit
(any)
set this to true if the rawTxHex is a chain commit ledger.
Promise<{}>
fct.storeChainId("44'/132'/0'/0'/0", "00016227acddfe57cf6740c4f30ae39d71f75710fb4ea9c843d5c01755329a42ccab52034e1f7901d5b8efdb52a15c4007d341eb1193903a021ed7aaa9a3cf4234c32ef8a213de00",false).then(result => ...)
This function will sign a raw message using the identity coin type only. Attempts to sign with FCT or EC addresses will be rejected by the device.
Promise<{s: string, v: string, r: string}>
fct.signMessageRaw("44'/281'/0'/0/0", "The quick brown fox jumps over the lazy dog.").then(result => ...)
This function will sign a FAT 0 or 1 transaction using the Factoid Address.
(string)
a path in BIP 32 format
(number)
FAT protocol transaction type index 0: FAT-0, 1: FAT-1
(Buffer)
(any)
this is the raw data fat transaction to be hashed then signed by device, Buffer.concat(
[index, timestamp, chainId, content]
)
Promise<{s: string, v: string, r: string}>
fct.signFatTransaction("44'/131'/0'/0/0", "The quick brown fox jumps over the lazy dog.").then(result => ...)