UNPKG

eosjs-signature-provider-interface

Version:

An abstract class that implements the EOSJS SignatureProvider interface, and provides helper methods for interacting with an authenticator using the EOSIO Authentication Transport Protocol Specification.

142 lines (141 loc) 3.58 kB
/** * EOSIO Interfaces * TODO: These should be moved somewhere else. Most are duplicated in other repos */ export interface Uint8BinaryAbi { accountName: string; abi: Uint8Array; } export interface HexAbi { accountName: string; abi: string; } export interface ContractAction { contract: string; action: string; } export interface AppMetadata { spec_version: string; name: string; shortname: string; scope: string; apphome: string; icon: string; appIdentifiers?: string[]; description?: string; sslfingerprint?: string; chains: ChainInfo[]; } export interface ChainInfo { chainId: string; chainName: string; icon: string; } export interface AppManifest { spec_version: string; manifests: ChainManifest[]; } export interface ChainManifest { chainId: string; manifest: Manifest; } export interface Manifest { account: string; domain: string; appmeta: string; whitelist: ContractAction[]; } export interface Transaction { signatures: string[]; compression: number; packedContextFreeData: string; packedTrx: string; } export interface SecurityExclusions { addAssertToTransactions?: boolean; appMetadataIntegrity?: boolean; domainMatch?: boolean; whitelistedActions?: boolean; iconIntegrity?: boolean; relaxedContractParsing?: boolean; } /** * EOSIO Authentication Transport Protocol Specifications interfaces */ export declare enum EnvelopeDataType { SELECTIVE_DISCLOSURE = "selectiveDisclosure", TRANSACTION_SIGNATURE = "transactionSignature" } export declare enum SelectiveDisclosureType { AUTHORIZERS = "authorizers" } export interface Authorizer { publicKey: string; } export interface SelectiveDisclosureRequest { selectiveDisclosure: { disclosures: Array<{ type: SelectiveDisclosureType; }>; }; } export interface TransactionSignatureRequest { transactionSignature: { chainId: string; publicKeys: string[]; abis: HexAbi[]; transaction: Transaction; }; } export interface SignatureProviderRequest extends Partial<SelectiveDisclosureRequest>, Partial<TransactionSignatureRequest> { } export interface SignatureProviderRequestEnvelope { version: string; id: string; declaredDomain: string; returnUrl: string; callbackUrl?: string; responseKey?: string; securityExclusions?: SecurityExclusions; manifest?: AppManifest; request: SignatureProviderRequest; } export interface SelectiveDisclosureResponse { selectiveDisclosure: { authorizers?: Authorizer[]; error?: ErrorResponse; }; } export interface TransactionSignatureResponse { transactionSignature: { signedTransaction: Transaction; error?: ErrorResponse; }; } export interface SignatureProviderResponse extends Partial<SelectiveDisclosureResponse>, Partial<TransactionSignatureResponse> { } export interface SignatureProviderResponseEnvelope { id: string; deviceKey?: string; response: SignatureProviderResponse; } export interface ErrorResponse { errorCode: ErrorCodes; reason: string; contextualInfo: string; } export declare enum ErrorCodes { biometricsDisabled = 0, keychainError = 1, manifestError = 2, metadataError = 3, networkError = 4, parsingError = 5, resourceIntegrityError = 6, resourceRetrievalError = 7, signingError = 8, transactionError = 9, vaultError = 10, whitelistingError = 11, unexpectedError = 12 }