@zondax/ledger-stacks
Version:
Node API for Stacks App (Ledger Nano S/S+/X)
40 lines (39 loc) • 2.06 kB
TypeScript
/// <reference types="node" />
/** ******************************************************************************
* (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 { ResponseAddress, ResponseAppInfo, ResponseSign, ResponseVersion } from './types';
import { LedgerError } from './common';
import type { AddressVersion } from '@stacks/transactions';
export { LedgerError };
export * from './types';
export default class StacksApp {
transport: Transport;
constructor(transport: Transport);
static prepareChunks(serializedPathBuffer: Buffer, message: Buffer): Buffer[];
signGetChunks(path: string, message: Buffer): Promise<Buffer[]>;
getVersion(): Promise<ResponseVersion>;
getAppInfo(): Promise<ResponseAppInfo>;
getAddressAndPubKey(path: string, version: AddressVersion): Promise<ResponseAddress>;
getIdentityPubKey(path: string): Promise<ResponseAddress>;
showAddressAndPubKey(path: string, version: AddressVersion): Promise<ResponseAddress>;
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>;
}