Home Manual Reference Source
import {ContactPromise} from 'discretecrypt.js/src/discretecrypt.js'
public class | source

ContactPromise

A stub class that doesn't actually get used, but helps with autocompletion. Allows you to use Contacts asynchronously.

Method Summary

Public Methods
public
public

clean(extra: *): ContactPromise

public

compute(key: String | Buffer | Array): ContactPromise

Computes the private key for a contact from an input key.

public

Used to export the (safe) JSON for the Contact

public

open(data: *): Promise<Object>

Sends the data to the recipient, encrypted.

public

Returns the private key

public

Returns the public key

public

send(recipient: Contact, data: *): Promise<Object>

Sends the data to the recipient, encrypted.

public

sign(data: *, bundle: Boolean): ContactPromise

Signs data using the Contact, using the Schnorr Signature algorithm.

public
public

verify(data: Object | Promise.<Object>=, source: Object | Promise.<Object>=): ContactPromise

Verifies the signed data.

Public Methods

public catch(err: Function): ContactPromise source

Params:

NameTypeAttributeDescription
err Function

Return:

ContactPromise

public clean(extra: *): ContactPromise source

Params:

NameTypeAttributeDescription
extra *

Return:

ContactPromise

public compute(key: String | Buffer | Array): ContactPromise source

Computes the private key for a contact from an input key.

Params:

NameTypeAttributeDescription
key String | Buffer | Array

Return:

ContactPromise

public export(extra: Object): ContactPromise source

Used to export the (safe) JSON for the Contact

Params:

NameTypeAttributeDescription
extra Object

Return:

ContactPromise

public open(data: *): Promise<Object> source

Sends the data to the recipient, encrypted.

Params:

NameTypeAttributeDescription
data *

Return:

Promise<Object>

public privateKey(): ContactPromise<bigInt> source

Returns the private key

Return:

ContactPromise<bigInt>

public publicKey(): ContactPromise<bigInt> source

Returns the public key

Return:

ContactPromise<bigInt>

public send(recipient: Contact, data: *): Promise<Object> source

Sends the data to the recipient, encrypted.

Params:

NameTypeAttributeDescription
recipient Contact
data *

Return:

Promise<Object>

public sign(data: *, bundle: Boolean): ContactPromise source

Signs data using the Contact, using the Schnorr Signature algorithm.
This is not how DiscreteCrypt (C++) does it, but it will be modified to match this approach.

Params:

NameTypeAttributeDescription
data *
bundle Boolean

Return:

ContactPromise

public then(data: Function): ContactPromise source

Params:

NameTypeAttributeDescription
data Function

Return:

ContactPromise

public verify(data: Object | Promise.<Object>=, source: Object | Promise.<Object>=): ContactPromise source

Verifies the signed data.

Params:

NameTypeAttributeDescription
data Object | Promise.<Object>=
source Object | Promise.<Object>=

Return:

ContactPromise