@zondax/ledger-stacks
Version:
Node API for Stacks App (Ledger Nano S+, X, Stax, Flex and Apex)
51 lines (50 loc) • 2.9 kB
TypeScript
/** ******************************************************************************
* (c) 2019-2022 Zondax AG
* (c) 2016-2017 Ledger
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************* */
import Transport from '@ledgerhq/hw-transport';
import type { AddressVersion } from '@stacks/transactions';
import { LedgerError } from './common';
import { MultisigAddressOptions, ResponseAddress, ResponseAppInfo, ResponseMasterFingerprint, ResponseSign, ResponseVersion } from './types';
export { LedgerError };
export * from './types';
export default class StacksApp {
transport: Transport;
constructor(transport: Transport);
static prepareChunks(serializedPathBuffer: Buffer, message: Buffer): Buffer<ArrayBufferLike>[];
signGetChunks(path: string, message: Buffer): Buffer<ArrayBufferLike>[];
getVersion(): Promise<ResponseVersion>;
getAppInfo(): Promise<ResponseAppInfo>;
getAddressAndPubKey(path: string, version: AddressVersion): Promise<ResponseAddress>;
getIdentityPubKey(path: string): Promise<ResponseAddress>;
getMasterFingerprint(): Promise<ResponseMasterFingerprint>;
showAddressAndPubKey(path: string, version: AddressVersion): Promise<ResponseAddress>;
/**
* Derive a multisig (P2SH) address. The device derives its own key from
* `path` and combines it with the supplied cosigner keys to compute the
* address; the response's `publicKey` is this device's own key.
*
* `version` is the c32 multisig version byte (20 mainnet `SM…`, 21 testnet `SN…`).
*/
getMultisigAddressAndPubKey(path: string, version: AddressVersion, options: MultisigAddressOptions): Promise<ResponseAddress>;
/** Same as {@link getMultisigAddressAndPubKey} but shows the address on-device for verification. */
showMultisigAddressAndPubKey(path: string, version: AddressVersion, options: MultisigAddressOptions): Promise<ResponseAddress>;
private sendMultisigChunks;
signSendChunk(chunkIdx: number, chunkNum: number, chunk: Buffer, ins: number): Promise<ResponseSign>;
sign(path: string, message: Buffer): Promise<any>;
sign_msg(path: string, message: string): Promise<any>;
sign_jwt(path: string, message: string): Promise<any>;
sign_structured_msg(path: string, domain: string, message: string): Promise<any>;
}