Options
All
  • Public
  • Public/Protected
  • All
Menu

Crypto API that interfaces manages a background crypto thread for the execution of expensive operations.

Hierarchy

  • CryptoApi

Index

Constructors

constructor

Properties

Private nextRpcId

nextRpcId: number = 1

Private numBusy

numBusy: number = 0

Number of busy workers.

Private stopped

stopped: boolean = false

Did we stop accepting new requests?

Private workQueues

workQueues: WorkItem[][]

Private workerFactory

workerFactory: CryptoWorkerFactory

Private workers

workers: WorkerState[]

Methods

benchmark

  • benchmark(repetitions: number): Promise<BenchmarkResult>
  • Parameters

    • repetitions: number

    Returns Promise<BenchmarkResult>

createEddsaKeypair

  • createEddsaKeypair(): Promise<{ priv: string; pub: string }>
  • Returns Promise<{ priv: string; pub: string }>

createPlanchet

  • createPlanchet(req: PlanchetCreationRequest): Promise<PlanchetCreationResult>
  • Parameters

    • req: PlanchetCreationRequest

    Returns Promise<PlanchetCreationResult>

createRecoupRequest

  • createRecoupRequest(coin: CoinRecord): Promise<RecoupRequest>
  • Parameters

    Returns Promise<RecoupRequest>

createTipPlanchet

  • createTipPlanchet(req: DeriveTipRequest): Promise<DerivedTipPlanchet>
  • Parameters

    • req: DeriveTipRequest

    Returns Promise<DerivedTipPlanchet>

deriveRefreshSession

  • deriveRefreshSession(req: DeriveRefreshSessionRequest): Promise<DerivedRefreshSession>
  • Parameters

    • req: DeriveRefreshSessionRequest

    Returns Promise<DerivedRefreshSession>

Private doRpc

  • doRpc<T>(operation: string, priority: number, ...args: any[]): Promise<T>
  • Type parameters

    • T

    Parameters

    • operation: string
    • priority: number
    • Rest ...args: any[]

    Returns Promise<T>

Private findWork

  • findWork(ws: WorkerState): void
  • Parameters

    • ws: WorkerState

    Returns void

handleWorkerError

  • handleWorkerError(ws: WorkerState, e: any): void
  • Parameters

    • ws: WorkerState
    • e: any

    Returns void

handleWorkerMessage

  • handleWorkerMessage(ws: WorkerState, msg: any): void
  • Parameters

    • ws: WorkerState
    • msg: any

    Returns void

hashEncoded

  • hashEncoded(encodedBytes: string): Promise<string>
  • Parameters

    • encodedBytes: string

    Returns Promise<string>

hashString

  • hashString(str: string): Promise<string>
  • Parameters

    • str: string

    Returns Promise<string>

isValidContractTermsSignature

  • isValidContractTermsSignature(contractTermsHash: string, sig: string, merchantPub: string): Promise<boolean>
  • Parameters

    • contractTermsHash: string
    • sig: string
    • merchantPub: string

    Returns Promise<boolean>

isValidDenom

  • Parameters

    Returns Promise<boolean>

isValidPaymentSignature

  • isValidPaymentSignature(sig: string, contractHash: string, merchantPub: string): Promise<boolean>
  • Parameters

    • sig: string
    • contractHash: string
    • merchantPub: string

    Returns Promise<boolean>

isValidWireAccount

  • isValidWireAccount(paytoUri: string, sig: string, masterPub: string): Promise<boolean>
  • Parameters

    • paytoUri: string
    • sig: string
    • masterPub: string

    Returns Promise<boolean>

isValidWireFee

  • isValidWireFee(type: string, wf: WireFee, masterPub: string): Promise<boolean>
  • Parameters

    • type: string
    • wf: WireFee
    • masterPub: string

    Returns Promise<boolean>

makeSyncSignature

  • makeSyncSignature(req: MakeSyncSignatureRequest): Promise<string>
  • Parameters

    • req: MakeSyncSignatureRequest

    Returns Promise<string>

resetWorkerTimeout

  • resetWorkerTimeout(ws: WorkerState): void
  • Parameters

    • ws: WorkerState

    Returns void

rsaUnblind

  • rsaUnblind(sig: string, bk: string, pk: string): Promise<string>
  • Parameters

    • sig: string
    • bk: string
    • pk: string

    Returns Promise<string>

rsaVerify

  • rsaVerify(hm: string, sig: string, pk: string): Promise<boolean>
  • Parameters

    • hm: string
    • sig: string
    • pk: string

    Returns Promise<boolean>

signCoinLink

  • signCoinLink(oldCoinPriv: string, newDenomHash: string, oldCoinPub: string, transferPub: string, coinEv: string): Promise<string>
  • Parameters

    • oldCoinPriv: string
    • newDenomHash: string
    • oldCoinPub: string
    • transferPub: string
    • coinEv: string

    Returns Promise<string>

signDepositPermission

  • signDepositPermission(depositInfo: DepositInfo): Promise<CoinDepositPermission>
  • Parameters

    • depositInfo: DepositInfo

    Returns Promise<CoinDepositPermission>

signTrackTransaction

  • signTrackTransaction(req: SignTrackTransactionRequest): Promise<string>
  • Parameters

    • req: SignTrackTransactionRequest

    Returns Promise<string>

stop

  • stop(): void
  • Returns void

terminateWorkers

  • terminateWorkers(): void
  • Terminate all worker threads.

    Returns void

wake

  • wake(ws: WorkerState, work: WorkItem): void
  • Start a worker (if not started) and set as busy.

    Parameters

    • ws: WorkerState
    • work: WorkItem

    Returns void

Generated using TypeDoc