Contact
A contact that can be used to send or receive secure messages. Essentially an abstraction of a public/private key.
Static Method Summary
| Static Public Methods | ||
| public static |
create(key: String | Buffer | Uint8Array | Array=, salt: String | Buffer | Uint8Array | Array=, scryptConfig: Object=, params: Object=): ContactPromise Creates a contact from the given key / salt. |
|
| public static |
fromJSON(json: String | Object | Promise, sync: Boolean=): ContactPromise Processes a JSON string or object, and converts it into a Contact class. |
|
| public static |
Alias for fromJSON |
|
| Static Private Methods | ||
| private static |
_fromJSONAsync(json: String | Object | Promise): * Imports the asynchronous version of a DiscreteCrypt Contact |
|
| private static |
_fromJSONSync(json: String | Object): * Imports the synchronous version of a DiscreteCrypt Contact |
|
| private static |
_modifyPromise(prom: *): * |
|
Member Summary
| Public Members | ||
| public |
params: {"prime": *, "gen": *} |
|
| public |
private: * |
|
| public |
scryptConfig: * |
|
Method Summary
| Public Methods | ||
| public |
Converts the object to the fully asynchronous Contact |
|
| public |
|
|
| 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 for sharing. |
|
| public |
Opens an encrypted payload for the contact. |
|
| public |
privateKey(): bigInt Returns the private key |
|
| public |
publicKey(): bigInt Returns the public key |
|
| public |
send(recipient: Contact | ContactPromise, data: *): Promise<Object> Sends the data to the recipient, encrypted. |
|
| public |
Signs data using the Contact, using the Schnorr Signature algorithm. |
|
| public |
Verifies the signed data. |
|
| Protected Methods | ||
| protected |
|
|
| protected |
|
|
Static Public Methods
public static create(key: String | Buffer | Uint8Array | Array=, salt: String | Buffer | Uint8Array | Array=, scryptConfig: Object=, params: Object=): ContactPromise source
Creates a contact from the given key / salt.
Params:
| Name | Type | Attribute | Description |
| key | String | Buffer | Uint8Array | Array= | Key, can be passed in as a string or Buffer-like object. |
|
| salt | String | Buffer | Uint8Array | Array= | Salt, can be passed in as a hex string or Buffer-like object. |
|
| scryptConfig | Object= | Configuration for Scrypt |
|
| params | Object= | Discrete Log Parameters |
public static fromJSON(json: String | Object | Promise, sync: Boolean=): ContactPromise source
Processes a JSON string or object, and converts it into a Contact class.
public static import(json: String | Object, sync: Boolean): ContactPromise | Contact source
Alias for fromJSON
See:
Static Private Methods
private static _fromJSONAsync(json: String | Object | Promise): * source
Imports the asynchronous version of a DiscreteCrypt Contact
Return:
| * |
private static _fromJSONSync(json: String | Object): * source
Imports the synchronous version of a DiscreteCrypt Contact
Return:
| * |
private static _modifyPromise(prom: *): * source
Params:
| Name | Type | Attribute | Description |
| prom | * |
Return:
| * |
Public Members
public params: {"prime": *, "gen": *} source
public private: * source
public scryptConfig: * source
Public Methods
public compute(key: String | Buffer | Array): ContactPromise source
Computes the private key for a contact from an input key.
public export(extra: Object): Object source
Used to export the (safe) JSON for the Contact for sharing.
Params:
| Name | Type | Attribute | Description |
| extra | Object |
public open(data: *): Promise<Object> source
Opens an encrypted payload for the contact.
Params:
| Name | Type | Attribute | Description |
| data | * |
public send(recipient: Contact | ContactPromise, data: *): Promise<Object> source
Sends the data to the recipient, encrypted.
Params:
| Name | Type | Attribute | Description |
| recipient | Contact | ContactPromise | ||
| data | * |
public sign(data: Object | Promise<Object>, bundle: Boolean): Promise<Object> source
Signs data using the Contact, using the Schnorr Signature algorithm.
This is not how DiscreteCrypt (C++) currently handles signatures, but that will be changed.
public verify(data: Object | Promise<Object>, source: Object | Promise.<Object>=): Promise<Boolean> source
Verifies the signed data.
