Refactor order of item to follow alphabetical order.
This commit is contained in:
@@ -506,16 +506,16 @@
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">interface AccountDetails {
|
||||
/** Age of user */
|
||||
age?: string;
|
||||
/** Token balance on account */
|
||||
balance?: number;
|
||||
/** Business category of user. */
|
||||
category?: string;
|
||||
/** Account registration day */
|
||||
date_registered: number;
|
||||
/** User's gender */
|
||||
gender: string;
|
||||
/** Age of user */
|
||||
age?: string;
|
||||
/** Type of account */
|
||||
type?: string;
|
||||
/** Token balance on account */
|
||||
balance?: number;
|
||||
/** Account identifiers */
|
||||
identities: {
|
||||
evm: {
|
||||
@@ -533,8 +533,8 @@
|
||||
};
|
||||
/** Products or services provided by user. */
|
||||
products: string[];
|
||||
/** Business category of user. */
|
||||
category?: string;
|
||||
/** Type of account */
|
||||
type?: string;
|
||||
/** Personal identifying information of user */
|
||||
vcard: {
|
||||
email: [
|
||||
|
||||
@@ -292,32 +292,32 @@
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">interface Action {
|
||||
/** Action ID */
|
||||
id: number;
|
||||
/** Admin who initialized the action. */
|
||||
user: string;
|
||||
/** Admin's role in the system */
|
||||
role: string;
|
||||
/** Action performed */
|
||||
action: string;
|
||||
/** Action approval status. */
|
||||
approval: boolean;
|
||||
/** Action ID */
|
||||
id: number;
|
||||
/** Admin's role in the system */
|
||||
role: string;
|
||||
/** Admin who initialized the action. */
|
||||
user: string;
|
||||
}
|
||||
|
||||
/** Area name object interface */
|
||||
interface AreaName {
|
||||
/** Name of area */
|
||||
name: string;
|
||||
/** Locations that map to that area name. */
|
||||
locations: Array<string>;
|
||||
/** Name of area */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** Area type object interface */
|
||||
interface AreaType {
|
||||
/** Type of area */
|
||||
name: string;
|
||||
/** Areas that map to that area type. */
|
||||
area: Array<string>;
|
||||
/** Type of area */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** Category object interface */
|
||||
|
||||
@@ -178,32 +178,32 @@
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">interface Action {
|
||||
/** Action ID */
|
||||
id: number;
|
||||
/** Admin who initialized the action. */
|
||||
user: string;
|
||||
/** Admin's role in the system */
|
||||
role: string;
|
||||
/** Action performed */
|
||||
action: string;
|
||||
/** Action approval status. */
|
||||
approval: boolean;
|
||||
/** Action ID */
|
||||
id: number;
|
||||
/** Admin's role in the system */
|
||||
role: string;
|
||||
/** Admin who initialized the action. */
|
||||
user: string;
|
||||
}
|
||||
|
||||
/** Area name object interface */
|
||||
interface AreaName {
|
||||
/** Name of area */
|
||||
name: string;
|
||||
/** Locations that map to that area name. */
|
||||
locations: Array<string>;
|
||||
/** Name of area */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** Area type object interface */
|
||||
interface AreaType {
|
||||
/** Type of area */
|
||||
name: string;
|
||||
/** Areas that map to that area type. */
|
||||
area: Array<string>;
|
||||
/** Type of area */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** Category object interface */
|
||||
|
||||
@@ -178,32 +178,32 @@
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">interface Action {
|
||||
/** Action ID */
|
||||
id: number;
|
||||
/** Admin who initialized the action. */
|
||||
user: string;
|
||||
/** Admin's role in the system */
|
||||
role: string;
|
||||
/** Action performed */
|
||||
action: string;
|
||||
/** Action approval status. */
|
||||
approval: boolean;
|
||||
/** Action ID */
|
||||
id: number;
|
||||
/** Admin's role in the system */
|
||||
role: string;
|
||||
/** Admin who initialized the action. */
|
||||
user: string;
|
||||
}
|
||||
|
||||
/** Area name object interface */
|
||||
interface AreaName {
|
||||
/** Name of area */
|
||||
name: string;
|
||||
/** Locations that map to that area name. */
|
||||
locations: Array<string>;
|
||||
/** Name of area */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** Area type object interface */
|
||||
interface AreaType {
|
||||
/** Type of area */
|
||||
name: string;
|
||||
/** Areas that map to that area type. */
|
||||
area: Array<string>;
|
||||
/** Type of area */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** Category object interface */
|
||||
|
||||
@@ -178,32 +178,32 @@
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">interface Action {
|
||||
/** Action ID */
|
||||
id: number;
|
||||
/** Admin who initialized the action. */
|
||||
user: string;
|
||||
/** Admin's role in the system */
|
||||
role: string;
|
||||
/** Action performed */
|
||||
action: string;
|
||||
/** Action approval status. */
|
||||
approval: boolean;
|
||||
/** Action ID */
|
||||
id: number;
|
||||
/** Admin's role in the system */
|
||||
role: string;
|
||||
/** Admin who initialized the action. */
|
||||
user: string;
|
||||
}
|
||||
|
||||
/** Area name object interface */
|
||||
interface AreaName {
|
||||
/** Name of area */
|
||||
name: string;
|
||||
/** Locations that map to that area name. */
|
||||
locations: Array<string>;
|
||||
/** Name of area */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** Area type object interface */
|
||||
interface AreaType {
|
||||
/** Type of area */
|
||||
name: string;
|
||||
/** Areas that map to that area type. */
|
||||
area: Array<string>;
|
||||
/** Type of area */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** Category object interface */
|
||||
|
||||
@@ -381,30 +381,30 @@ interface Conversion {
|
||||
toValue: number;
|
||||
/** Address of the initiator of the conversion. */
|
||||
trader: string;
|
||||
/** Account information of the initiator of the conversion. */
|
||||
user: AccountDetails;
|
||||
/** Conversion mining information. */
|
||||
tx: Tx;
|
||||
/** Account information of the initiator of the conversion. */
|
||||
user: AccountDetails;
|
||||
}
|
||||
|
||||
/** Transaction object interface */
|
||||
interface Transaction {
|
||||
/** Address of the transaction sender. */
|
||||
from: string;
|
||||
/** Account information of the transaction recipient. */
|
||||
recipient: AccountDetails;
|
||||
/** Account information of the transaction sender. */
|
||||
sender: AccountDetails;
|
||||
/** Address of the transaction recipient. */
|
||||
to: string;
|
||||
/** Account information of the transaction recipient. */
|
||||
recipient: AccountDetails;
|
||||
/** Transaction token information. */
|
||||
token: TxToken;
|
||||
/** Transaction mining information. */
|
||||
tx: Tx;
|
||||
/** Amount of tokens transacted. */
|
||||
value: number;
|
||||
/** Type of transaction. */
|
||||
type?: string;
|
||||
/** Amount of tokens transacted. */
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** Transaction data interface */
|
||||
|
||||
@@ -216,16 +216,16 @@
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">interface AccountDetails {
|
||||
/** Age of user */
|
||||
age?: string;
|
||||
/** Token balance on account */
|
||||
balance?: number;
|
||||
/** Business category of user. */
|
||||
category?: string;
|
||||
/** Account registration day */
|
||||
date_registered: number;
|
||||
/** User's gender */
|
||||
gender: string;
|
||||
/** Age of user */
|
||||
age?: string;
|
||||
/** Type of account */
|
||||
type?: string;
|
||||
/** Token balance on account */
|
||||
balance?: number;
|
||||
/** Account identifiers */
|
||||
identities: {
|
||||
evm: {
|
||||
@@ -243,8 +243,8 @@
|
||||
};
|
||||
/** Products or services provided by user. */
|
||||
products: string[];
|
||||
/** Business category of user. */
|
||||
category?: string;
|
||||
/** Type of account */
|
||||
type?: string;
|
||||
/** Personal identifying information of user */
|
||||
vcard: {
|
||||
email: [
|
||||
|
||||
@@ -178,16 +178,16 @@
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">interface AccountDetails {
|
||||
/** Age of user */
|
||||
age?: string;
|
||||
/** Token balance on account */
|
||||
balance?: number;
|
||||
/** Business category of user. */
|
||||
category?: string;
|
||||
/** Account registration day */
|
||||
date_registered: number;
|
||||
/** User's gender */
|
||||
gender: string;
|
||||
/** Age of user */
|
||||
age?: string;
|
||||
/** Type of account */
|
||||
type?: string;
|
||||
/** Token balance on account */
|
||||
balance?: number;
|
||||
/** Account identifiers */
|
||||
identities: {
|
||||
evm: {
|
||||
@@ -205,8 +205,8 @@
|
||||
};
|
||||
/** Products or services provided by user. */
|
||||
products: string[];
|
||||
/** Business category of user. */
|
||||
category?: string;
|
||||
/** Type of account */
|
||||
type?: string;
|
||||
/** Personal identifying information of user */
|
||||
vcard: {
|
||||
email: [
|
||||
|
||||
@@ -200,8 +200,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="154"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:154</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="16"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:16</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -241,8 +241,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="64"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:64</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="24"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:24</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -288,8 +288,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="93"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:93</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="29"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:29</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -335,8 +335,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="99"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:99</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="35"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:35</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -415,8 +415,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="110"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:110</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="41"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:41</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -495,8 +495,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="74"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:74</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="46"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:46</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -542,8 +542,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="122"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:122</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="52"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:52</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -622,8 +622,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="104"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:104</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="57"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:57</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -669,8 +669,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="69"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:69</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="62"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:62</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -716,8 +716,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="116"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:116</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="68"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:68</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -796,8 +796,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="128"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:128</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="74"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:74</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -876,8 +876,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="46"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:46</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="79"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:79</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -923,8 +923,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="134"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:134</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="85"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:85</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1003,8 +1003,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="56"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:56</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="90"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:90</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1050,8 +1050,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="51"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:51</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="95"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:95</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1097,8 +1097,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="27"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:27</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="103"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:103</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1194,8 +1194,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="41"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:41</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="110"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:110</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1273,8 +1273,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="34"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:34</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="117"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:117</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1352,8 +1352,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="88"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:88</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="124"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:124</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1432,8 +1432,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="81"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:81</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="131"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:131</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1512,8 +1512,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="19"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:19</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="136"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:136</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1553,8 +1553,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="140"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:140</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="142"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:142</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1633,8 +1633,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="152"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:152</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="148"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:148</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1713,8 +1713,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="146"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:146</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="154"
|
||||
class="link-to-prism">src/app/_pgp/pgp-key-store.ts:154</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1870,48 +1870,8 @@ const keyring = new openpgp.Keyring();
|
||||
* @extends KeyStore
|
||||
*/
|
||||
interface MutableKeyStore extends KeyStore {
|
||||
/**
|
||||
* Instantiate the keyring in the keystore.
|
||||
* @async
|
||||
*/
|
||||
loadKeyring(): void;
|
||||
/**
|
||||
* Add a key pair to keyring.
|
||||
* @async
|
||||
* @param publicKey - The public key to be added to the keyring.
|
||||
* @param privateKey - The private key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
importKeyPair(publicKey: any, privateKey: any): Promise<void>;
|
||||
/**
|
||||
* Add public key to keyring.
|
||||
* @async
|
||||
* @param publicKey - The public key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
importPublicKey(publicKey: any): Promise<void>;
|
||||
/**
|
||||
* Add private key to keyring.
|
||||
* @async
|
||||
* @param privateKey - The private key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
importPrivateKey(privateKey: any): Promise<void>;
|
||||
/**
|
||||
* Get all the public keys.
|
||||
* @returns An array of public keys.
|
||||
*/
|
||||
getPublicKeys(): Array<any>;
|
||||
/**
|
||||
* Get all the trusted keys.
|
||||
* @returns An array of trusted keys.
|
||||
*/
|
||||
getTrustedKeys(): Array<any>;
|
||||
/**
|
||||
* Get all the trusted active keys.
|
||||
* @returns An array of trusted active keys.
|
||||
*/
|
||||
getTrustedActiveKeys(): Array<any>;
|
||||
/** Remove all keys from the keyring. */
|
||||
clearKeysInKeyring(): void;
|
||||
/**
|
||||
* Get all the encryption keys.
|
||||
* @returns An array of encryption keys.
|
||||
@@ -1920,30 +1880,6 @@ interface MutableKeyStore extends KeyStore {
|
||||
* This is included to appease the implemented Keystore interface.
|
||||
*/
|
||||
getEncryptKeys(): Array<any>;
|
||||
/**
|
||||
* Get all private keys.
|
||||
* @returns An array of all private keys.
|
||||
*/
|
||||
getPrivateKeys(): Array<any>;
|
||||
/**
|
||||
* Get the first private key.
|
||||
* @returns The first private key.
|
||||
*/
|
||||
getPrivateKey(): any;
|
||||
/**
|
||||
* Test if the input is a valid key.
|
||||
* @async
|
||||
* @param key - The input to be validated.
|
||||
* @returns true - If the input is a valid key.
|
||||
*/
|
||||
isValidKey(key: any): Promise<boolean>;
|
||||
/**
|
||||
* Verify that a private key is encrypted.
|
||||
* @async
|
||||
* @param privateKey - The private key to verify.
|
||||
* @returns true - If private key is encrypted.
|
||||
*/
|
||||
isEncryptedPrivateKey(privateKey: any): Promise<boolean>;
|
||||
/**
|
||||
* Get the first private key's fingerprint.
|
||||
* @returns The first private key's fingerprint.
|
||||
@@ -1955,11 +1891,6 @@ interface MutableKeyStore extends KeyStore {
|
||||
* @returns The key's keyId.
|
||||
*/
|
||||
getKeyId(key: any): string;
|
||||
/**
|
||||
* Get the first private key's keyID.
|
||||
* @returns The first private key's keyId.
|
||||
*/
|
||||
getPrivateKeyId(): string;
|
||||
/**
|
||||
* Get keys from the keyring using their keyId.
|
||||
* @param keyId - The keyId of the keys to be fetched from the keyring.
|
||||
@@ -1967,49 +1898,118 @@ interface MutableKeyStore extends KeyStore {
|
||||
*/
|
||||
getKeysForId(keyId: string): Array<any>;
|
||||
/**
|
||||
* Get a public key from the keyring using it's keyId.
|
||||
* @param keyId - The keyId of the public key to be fetched from the keyring.
|
||||
* @returns The public key with that keyId.
|
||||
* Get the first private key.
|
||||
* @returns The first private key.
|
||||
*/
|
||||
getPublicKeyForId(keyId: string): any;
|
||||
getPrivateKey(): any;
|
||||
/**
|
||||
* Get a private key from the keyring using it's keyId.
|
||||
* @param keyId - The keyId of the private key to be fetched from the keyring.
|
||||
* @returns The private key with that keyId.
|
||||
*/
|
||||
getPrivateKeyForId(keyId: string): any;
|
||||
/**
|
||||
* Get the first private key's keyID.
|
||||
* @returns The first private key's keyId.
|
||||
*/
|
||||
getPrivateKeyId(): string;
|
||||
/**
|
||||
* Get all private keys.
|
||||
* @returns An array of all private keys.
|
||||
*/
|
||||
getPrivateKeys(): Array<any>;
|
||||
/**
|
||||
* Get a public key from the keyring using it's keyId.
|
||||
* @param keyId - The keyId of the public key to be fetched from the keyring.
|
||||
* @returns The public key with that keyId.
|
||||
*/
|
||||
getPublicKeyForId(keyId: string): any;
|
||||
/**
|
||||
* Get a public key from the keyring using it's subkeyId.
|
||||
* @param subkeyId - The subkeyId of the public key to be fetched from the keyring.
|
||||
* @returns The public key with that subkeyId.
|
||||
*/
|
||||
getPublicKeyForSubkeyId(subkeyId: string): any;
|
||||
/**
|
||||
* Get all the public keys.
|
||||
* @returns An array of public keys.
|
||||
*/
|
||||
getPublicKeys(): Array<any>;
|
||||
/**
|
||||
* Get public keys from the keyring using their address.
|
||||
* @param address - The address of the public keys to be fetched from the keyring.
|
||||
* @returns An array of the public keys with that address.
|
||||
*/
|
||||
getPublicKeysForAddress(address: string): Array<any>;
|
||||
/**
|
||||
* Get all the trusted active keys.
|
||||
* @returns An array of trusted active keys.
|
||||
*/
|
||||
getTrustedActiveKeys(): Array<any>;
|
||||
/**
|
||||
* Get all the trusted keys.
|
||||
* @returns An array of trusted keys.
|
||||
*/
|
||||
getTrustedKeys(): Array<any>;
|
||||
/**
|
||||
* Add a key pair to keyring.
|
||||
* @async
|
||||
* @param publicKey - The public key to be added to the keyring.
|
||||
* @param privateKey - The private key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
importKeyPair(publicKey: any, privateKey: any): Promise<void>;
|
||||
/**
|
||||
* Add private key to keyring.
|
||||
* @async
|
||||
* @param privateKey - The private key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
importPrivateKey(privateKey: any): Promise<void>;
|
||||
/**
|
||||
* Add public key to keyring.
|
||||
* @async
|
||||
* @param publicKey - The public key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
importPublicKey(publicKey: any): Promise<void>;
|
||||
/**
|
||||
* Verify that a private key is encrypted.
|
||||
* @async
|
||||
* @param privateKey - The private key to verify.
|
||||
* @returns true - If private key is encrypted.
|
||||
*/
|
||||
isEncryptedPrivateKey(privateKey: any): Promise<boolean>;
|
||||
/**
|
||||
* Test if the input is a valid key.
|
||||
* @async
|
||||
* @param key - The input to be validated.
|
||||
* @returns true - If the input is a valid key.
|
||||
*/
|
||||
isValidKey(key: any): Promise<boolean>;
|
||||
/**
|
||||
* Instantiate the keyring in the keystore.
|
||||
* @async
|
||||
*/
|
||||
loadKeyring(): void;
|
||||
/**
|
||||
* Remove a public key from the keyring using it's keyId.
|
||||
* @param keyId - The keyId of the keys to be removed from the keyring.
|
||||
* @returns An array of the removed keys.
|
||||
*/
|
||||
removeKeysForId(keyId: string): Array<any>;
|
||||
/**
|
||||
* Remove a public key from the keyring using it's keyId.
|
||||
* @param keyId - The keyId of the public key to be removed from the keyring.
|
||||
* @returns The removed public key.
|
||||
*/
|
||||
removePublicKeyForId(keyId: string): any;
|
||||
/**
|
||||
* Remove a public key from the keyring.
|
||||
* @param publicKey - The public key to be removed from the keyring.
|
||||
* @returns The removed public key.
|
||||
*/
|
||||
removePublicKey(publicKey: any): any;
|
||||
/** Remove all keys from the keyring. */
|
||||
clearKeysInKeyring(): void;
|
||||
/**
|
||||
* Remove a public key from the keyring using it's keyId.
|
||||
* @param keyId - The keyId of the public key to be removed from the keyring.
|
||||
* @returns The removed public key.
|
||||
*/
|
||||
removePublicKeyForId(keyId: string): any;
|
||||
/**
|
||||
* Sign message using private key.
|
||||
* @async
|
||||
@@ -2021,81 +2021,9 @@ interface MutableKeyStore extends KeyStore {
|
||||
|
||||
/** Provides a keyring for pgp keys. */
|
||||
class MutablePgpKeyStore implements MutableKeyStore {
|
||||
/**
|
||||
* Instantiate the keyring in the keystore.
|
||||
* @async
|
||||
*/
|
||||
async loadKeyring(): Promise<void> {
|
||||
await keyring.load();
|
||||
await keyring.store();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a key pair to keyring.
|
||||
* @async
|
||||
* @param publicKey - The public key to be added to the keyring.
|
||||
* @param privateKey - The private key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
async importKeyPair(publicKey: any, privateKey: any): Promise<void> {
|
||||
try {
|
||||
await keyring.publicKeys.importKey(publicKey);
|
||||
await keyring.privateKeys.importKey(privateKey);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add public key to keyring.
|
||||
* @async
|
||||
* @param publicKey - The public key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
async importPublicKey(publicKey: any): Promise<void> {
|
||||
try {
|
||||
await keyring.publicKeys.importKey(publicKey);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add private key to keyring.
|
||||
* @async
|
||||
* @param privateKey - The private key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
async importPrivateKey(privateKey: any): Promise<void> {
|
||||
try {
|
||||
await keyring.privateKeys.importKey(privateKey);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the public keys.
|
||||
* @returns An array of public keys.
|
||||
*/
|
||||
getPublicKeys(): Array<any> {
|
||||
return keyring.publicKeys && keyring.publicKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the trusted keys.
|
||||
* @returns An array of trusted keys.
|
||||
*/
|
||||
getTrustedKeys(): Array<any> {
|
||||
return keyring.publicKeys && keyring.publicKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the trusted active keys.
|
||||
* @returns An array of trusted active keys.
|
||||
*/
|
||||
getTrustedActiveKeys(): Array<any> {
|
||||
return keyring.publicKeys && keyring.publicKeys.keys;
|
||||
/** Remove all keys from the keyring. */
|
||||
clearKeysInKeyring(): void {
|
||||
keyring.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2109,50 +2037,6 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all private keys.
|
||||
* @returns An array of all private keys.
|
||||
*/
|
||||
getPrivateKeys(): Array<any> {
|
||||
return keyring.privateKeys && keyring.privateKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first private key.
|
||||
* @returns The first private key.
|
||||
*/
|
||||
getPrivateKey(): any {
|
||||
return keyring.privateKeys && keyring.privateKeys.keys[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the input is a valid key.
|
||||
* @async
|
||||
* @param key - The input to be validated.
|
||||
* @returns true - If the input is a valid key.
|
||||
*/
|
||||
async isValidKey(key): Promise<boolean> {
|
||||
// There is supposed to be an openpgp.readKey() method but I can't find it?
|
||||
const testKey = await openpgp.key.readArmored(key);
|
||||
return !testKey.err;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that a private key is encrypted.
|
||||
* @async
|
||||
* @param privateKey - The private key to verify.
|
||||
* @returns true - If private key is encrypted.
|
||||
*/
|
||||
async isEncryptedPrivateKey(privateKey: any): Promise<boolean> {
|
||||
const imported = await openpgp.key.readArmored(privateKey);
|
||||
for (const key of imported.keys) {
|
||||
if (key.isDecrypted()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first private key's fingerprint.
|
||||
* @returns The first private key's fingerprint.
|
||||
@@ -2176,6 +2060,32 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return key.getKeyId().toHex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get keys from the keyring using their keyId.
|
||||
* @param keyId - The keyId of the keys to be fetched from the keyring.
|
||||
* @returns An array of the keys with that keyId.
|
||||
*/
|
||||
getKeysForId(keyId: string): Array<any> {
|
||||
return keyring.getKeysForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first private key.
|
||||
* @returns The first private key.
|
||||
*/
|
||||
getPrivateKey(): any {
|
||||
return keyring.privateKeys && keyring.privateKeys.keys[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a private key from the keyring using it's keyId.
|
||||
* @param keyId - The keyId of the private key to be fetched from the keyring.
|
||||
* @returns The private key with that keyId.
|
||||
*/
|
||||
getPrivateKeyForId(keyId): any {
|
||||
return keyring.privateKeys && keyring.privateKeys.getForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the first private key's keyID.
|
||||
* @returns The first private key's keyId.
|
||||
@@ -2190,12 +2100,11 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get keys from the keyring using their keyId.
|
||||
* @param keyId - The keyId of the keys to be fetched from the keyring.
|
||||
* @returns An array of the keys with that keyId.
|
||||
* Get all private keys.
|
||||
* @returns An array of all private keys.
|
||||
*/
|
||||
getKeysForId(keyId: string): Array<any> {
|
||||
return keyring.getKeysForId(keyId);
|
||||
getPrivateKeys(): Array<any> {
|
||||
return keyring.privateKeys && keyring.privateKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2207,15 +2116,6 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return keyring.publicKeys && keyring.publicKeys.getForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a private key from the keyring using it's keyId.
|
||||
* @param keyId - The keyId of the private key to be fetched from the keyring.
|
||||
* @returns The private key with that keyId.
|
||||
*/
|
||||
getPrivateKeyForId(keyId): any {
|
||||
return keyring.privateKeys && keyring.privateKeys.getForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a public key from the keyring using it's subkeyId.
|
||||
* @param subkeyId - The subkeyId of the public key to be fetched from the keyring.
|
||||
@@ -2225,6 +2125,14 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return keyring.publicKeys && keyring.publicKeys.getForId(subkeyId, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the public keys.
|
||||
* @returns An array of public keys.
|
||||
*/
|
||||
getPublicKeys(): Array<any> {
|
||||
return keyring.publicKeys && keyring.publicKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get public keys from the keyring using their address.
|
||||
* @param address - The address of the public keys to be fetched from the keyring.
|
||||
@@ -2234,6 +2142,103 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return keyring.publicKeys && keyring.publicKeys.getForAddress(address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the trusted active keys.
|
||||
* @returns An array of trusted active keys.
|
||||
*/
|
||||
getTrustedActiveKeys(): Array<any> {
|
||||
return keyring.publicKeys && keyring.publicKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the trusted keys.
|
||||
* @returns An array of trusted keys.
|
||||
*/
|
||||
getTrustedKeys(): Array<any> {
|
||||
return keyring.publicKeys && keyring.publicKeys.keys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a key pair to keyring.
|
||||
* @async
|
||||
* @param publicKey - The public key to be added to the keyring.
|
||||
* @param privateKey - The private key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
async importKeyPair(publicKey: any, privateKey: any): Promise<void> {
|
||||
try {
|
||||
await keyring.publicKeys.importKey(publicKey);
|
||||
await keyring.privateKeys.importKey(privateKey);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add private key to keyring.
|
||||
* @async
|
||||
* @param privateKey - The private key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
async importPrivateKey(privateKey: any): Promise<void> {
|
||||
try {
|
||||
await keyring.privateKeys.importKey(privateKey);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add public key to keyring.
|
||||
* @async
|
||||
* @param publicKey - The public key to be added to the keyring.
|
||||
* @throws Error
|
||||
*/
|
||||
async importPublicKey(publicKey: any): Promise<void> {
|
||||
try {
|
||||
await keyring.publicKeys.importKey(publicKey);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that a private key is encrypted.
|
||||
* @async
|
||||
* @param privateKey - The private key to verify.
|
||||
* @returns true - If private key is encrypted.
|
||||
*/
|
||||
async isEncryptedPrivateKey(privateKey: any): Promise<boolean> {
|
||||
const imported = await openpgp.key.readArmored(privateKey);
|
||||
for (const key of imported.keys) {
|
||||
if (key.isDecrypted()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the input is a valid key.
|
||||
* @async
|
||||
* @param key - The input to be validated.
|
||||
* @returns true - If the input is a valid key.
|
||||
*/
|
||||
async isValidKey(key): Promise<boolean> {
|
||||
// There is supposed to be an openpgp.readKey() method but I can't find it?
|
||||
const testKey = await openpgp.key.readArmored(key);
|
||||
return !testKey.err;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate the keyring in the keystore.
|
||||
* @async
|
||||
*/
|
||||
async loadKeyring(): Promise<void> {
|
||||
await keyring.load();
|
||||
await keyring.store();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a public key from the keyring using it's keyId.
|
||||
* @param keyId - The keyId of the keys to be removed from the keyring.
|
||||
@@ -2243,15 +2248,6 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return keyring.removeKeysForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a public key from the keyring using it's keyId.
|
||||
* @param keyId - The keyId of the public key to be removed from the keyring.
|
||||
* @returns The removed public key.
|
||||
*/
|
||||
removePublicKeyForId(keyId): any {
|
||||
return keyring.publicKeys && keyring.publicKeys.removeForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a public key from the keyring.
|
||||
* @param publicKey - The public key to be removed from the keyring.
|
||||
@@ -2262,9 +2258,13 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
return keyring.publicKeys && keyring.publicKeys.removeForId(keyId);
|
||||
}
|
||||
|
||||
/** Remove all keys from the keyring. */
|
||||
clearKeysInKeyring(): void {
|
||||
keyring.clear();
|
||||
/**
|
||||
* Remove a public key from the keyring using it's keyId.
|
||||
* @param keyId - The keyId of the public key to be removed from the keyring.
|
||||
* @returns The removed public key.
|
||||
*/
|
||||
removePublicKeyForId(keyId): any {
|
||||
return keyring.publicKeys && keyring.publicKeys.removeForId(keyId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2290,7 +2290,7 @@ class MutablePgpKeyStore implements MutableKeyStore {
|
||||
}
|
||||
|
||||
/** @exports */
|
||||
export { MutablePgpKeyStore, MutableKeyStore };
|
||||
export { MutableKeyStore, MutablePgpKeyStore };
|
||||
</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -161,65 +161,65 @@ interface Signable {
|
||||
|
||||
/** Signature object interface */
|
||||
interface Signature {
|
||||
/** Encryption engine used. */
|
||||
engine: string;
|
||||
/** Encryption algorithm used */
|
||||
algo: string;
|
||||
/** Data to be signed. */
|
||||
data: string;
|
||||
/** Message digest */
|
||||
digest: string;
|
||||
/** Encryption engine used. */
|
||||
engine: string;
|
||||
}
|
||||
|
||||
/** Signer interface */
|
||||
interface Signer {
|
||||
/** Event triggered on successful signing of message. */
|
||||
onsign(signature: Signature): void;
|
||||
/** Event triggered on successful verification of a signature. */
|
||||
onverify(flag: boolean): void;
|
||||
/**
|
||||
* Get the private key fingerprint.
|
||||
* @returns A private key fingerprint.
|
||||
*/
|
||||
fingerprint(): string;
|
||||
/** Event triggered on successful signing of message. */
|
||||
onsign(signature: Signature): void;
|
||||
/** Event triggered on successful verification of a signature. */
|
||||
onverify(flag: boolean): void;
|
||||
/**
|
||||
* Load the message digest.
|
||||
* @param material - A signable object.
|
||||
* @returns true - If digest has been loaded successfully.
|
||||
*/
|
||||
prepare(material: Signable): boolean;
|
||||
/**
|
||||
* Verify that signature is valid.
|
||||
* @param digest - The message that was signed.
|
||||
* @param signature - The generated signature.
|
||||
*/
|
||||
verify(digest: string, signature: Signature): void;
|
||||
/**
|
||||
* Signs a message using a private key.
|
||||
* @async
|
||||
* @param digest - The message to be signed.
|
||||
*/
|
||||
sign(digest: string): Promise<void>;
|
||||
/**
|
||||
* Verify that signature is valid.
|
||||
* @param digest - The message that was signed.
|
||||
* @param signature - The generated signature.
|
||||
*/
|
||||
verify(digest: string, signature: Signature): void;
|
||||
}
|
||||
|
||||
/** Provides functionality for signing and verifying signed messages. */
|
||||
class PGPSigner implements Signer {
|
||||
/** Encryption engine used. */
|
||||
engine = 'pgp';
|
||||
/** Encryption algorithm used */
|
||||
algo = 'sha256';
|
||||
/** Message digest */
|
||||
dgst: string;
|
||||
/** Generated signature */
|
||||
signature: Signature;
|
||||
/** Encryption engine used. */
|
||||
engine = 'pgp';
|
||||
/** A keystore holding pgp keys. */
|
||||
keyStore: MutableKeyStore;
|
||||
/** A service that provides logging capabilities. */
|
||||
loggingService: LoggingService;
|
||||
/** Event triggered on successful signing of message. */
|
||||
onsign: (signature: Signature) => void;
|
||||
/** Event triggered on successful verification of a signature. */
|
||||
onverify: (flag: boolean) => void;
|
||||
/** A service that provides logging capabilities. */
|
||||
loggingService: LoggingService;
|
||||
/** Generated signature */
|
||||
signature: Signature;
|
||||
|
||||
/**
|
||||
* Initializing the Signer.
|
||||
@@ -249,6 +249,41 @@ class PGPSigner implements Signer {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Signs a message using a private key.
|
||||
* @async
|
||||
* @param digest - The message to be signed.
|
||||
*/
|
||||
public async sign(digest: string): Promise<void> {
|
||||
const m = openpgp.cleartext.fromText(digest);
|
||||
const pk = this.keyStore.getPrivateKey();
|
||||
if (!pk.isDecrypted()) {
|
||||
const password = window.prompt('password');
|
||||
await pk.decrypt(password);
|
||||
}
|
||||
const opts = {
|
||||
message: m,
|
||||
privateKeys: [pk],
|
||||
detached: true,
|
||||
};
|
||||
openpgp
|
||||
.sign(opts)
|
||||
.then((s) => {
|
||||
this.signature = {
|
||||
engine: this.engine,
|
||||
algo: this.algo,
|
||||
data: s.signature,
|
||||
// TODO: fix for browser later
|
||||
digest,
|
||||
};
|
||||
this.onsign(this.signature);
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loggingService.sendErrorLevelMessage(e.message, this, { error: e });
|
||||
this.onsign(undefined);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that signature is valid.
|
||||
* @param digest - The message that was signed.
|
||||
@@ -285,45 +320,10 @@ class PGPSigner implements Signer {
|
||||
this.onverify(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Signs a message using a private key.
|
||||
* @async
|
||||
* @param digest - The message to be signed.
|
||||
*/
|
||||
public async sign(digest: string): Promise<void> {
|
||||
const m = openpgp.cleartext.fromText(digest);
|
||||
const pk = this.keyStore.getPrivateKey();
|
||||
if (!pk.isDecrypted()) {
|
||||
const password = window.prompt('password');
|
||||
await pk.decrypt(password);
|
||||
}
|
||||
const opts = {
|
||||
message: m,
|
||||
privateKeys: [pk],
|
||||
detached: true,
|
||||
};
|
||||
openpgp
|
||||
.sign(opts)
|
||||
.then((s) => {
|
||||
this.signature = {
|
||||
engine: this.engine,
|
||||
algo: this.algo,
|
||||
data: s.signature,
|
||||
// TODO: fix for browser later
|
||||
digest,
|
||||
};
|
||||
this.onsign(this.signature);
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loggingService.sendErrorLevelMessage(e.message, this, { error: e });
|
||||
this.onsign(undefined);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** @exports */
|
||||
export { Signable, Signature, Signer, PGPSigner };
|
||||
export { PGPSigner, Signable, Signature, Signer };
|
||||
</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -61,14 +61,14 @@
|
||||
<h3>File</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<code>src/app/_models/account.ts</code>
|
||||
<code>src/app/_pgp/pgp-signer.ts</code>
|
||||
</p>
|
||||
|
||||
<p class="comment">
|
||||
<h3>Description</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<p>Meta signature interface </p>
|
||||
<p>Signature object interface </p>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Algorithm used </p>
|
||||
<div class="io-description"><p>Encryption algorithm used </p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -172,7 +172,7 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Data that was signed. </p>
|
||||
<div class="io-description"><p>Data to be signed. </p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -253,74 +253,23 @@
|
||||
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">interface AccountDetails {
|
||||
/** Account registration day */
|
||||
date_registered: number;
|
||||
/** User's gender */
|
||||
gender: string;
|
||||
/** Age of user */
|
||||
age?: string;
|
||||
/** Type of account */
|
||||
type?: string;
|
||||
/** Token balance on account */
|
||||
balance?: number;
|
||||
/** Account identifiers */
|
||||
identities: {
|
||||
evm: {
|
||||
'bloxberg:8996': string[];
|
||||
'oldchain:1': string[];
|
||||
};
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
};
|
||||
/** User's location */
|
||||
location: {
|
||||
area?: string;
|
||||
area_name: string;
|
||||
area_type?: string;
|
||||
};
|
||||
/** Products or services provided by user. */
|
||||
products: string[];
|
||||
/** Business category of user. */
|
||||
category?: string;
|
||||
/** Personal identifying information of user */
|
||||
vcard: {
|
||||
email: [
|
||||
{
|
||||
value: string;
|
||||
}
|
||||
];
|
||||
fn: [
|
||||
{
|
||||
value: string;
|
||||
}
|
||||
];
|
||||
n: [
|
||||
{
|
||||
value: string[];
|
||||
}
|
||||
];
|
||||
tel: [
|
||||
{
|
||||
meta: {
|
||||
TYP: string[];
|
||||
};
|
||||
value: string;
|
||||
}
|
||||
];
|
||||
version: [
|
||||
{
|
||||
value: string;
|
||||
}
|
||||
];
|
||||
};
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import * as openpgp from 'openpgp';
|
||||
|
||||
// Application imports
|
||||
import { MutableKeyStore } from '@app/_pgp/pgp-key-store';
|
||||
import { LoggingService } from '@app/_services/logging.service';
|
||||
|
||||
/** Signable object interface */
|
||||
interface Signable {
|
||||
/** The message to be signed. */
|
||||
digest(): string;
|
||||
}
|
||||
|
||||
/** Meta signature interface */
|
||||
/** Signature object interface */
|
||||
interface Signature {
|
||||
/** Algorithm used */
|
||||
/** Encryption algorithm used */
|
||||
algo: string;
|
||||
/** Data that was signed. */
|
||||
/** Data to be signed. */
|
||||
data: string;
|
||||
/** Message digest */
|
||||
digest: string;
|
||||
@@ -328,74 +277,159 @@ interface Signature {
|
||||
engine: string;
|
||||
}
|
||||
|
||||
/** Meta object interface */
|
||||
interface Meta {
|
||||
/** Account details */
|
||||
data: AccountDetails;
|
||||
/** Meta store id */
|
||||
id: string;
|
||||
/** Signature used during write. */
|
||||
/** Signer interface */
|
||||
interface Signer {
|
||||
/**
|
||||
* Get the private key fingerprint.
|
||||
* @returns A private key fingerprint.
|
||||
*/
|
||||
fingerprint(): string;
|
||||
/** Event triggered on successful signing of message. */
|
||||
onsign(signature: Signature): void;
|
||||
/** Event triggered on successful verification of a signature. */
|
||||
onverify(flag: boolean): void;
|
||||
/**
|
||||
* Load the message digest.
|
||||
* @param material - A signable object.
|
||||
* @returns true - If digest has been loaded successfully.
|
||||
*/
|
||||
prepare(material: Signable): boolean;
|
||||
/**
|
||||
* Signs a message using a private key.
|
||||
* @async
|
||||
* @param digest - The message to be signed.
|
||||
*/
|
||||
sign(digest: string): Promise<void>;
|
||||
/**
|
||||
* Verify that signature is valid.
|
||||
* @param digest - The message that was signed.
|
||||
* @param signature - The generated signature.
|
||||
*/
|
||||
verify(digest: string, signature: Signature): void;
|
||||
}
|
||||
|
||||
/** Provides functionality for signing and verifying signed messages. */
|
||||
class PGPSigner implements Signer {
|
||||
/** Encryption algorithm used */
|
||||
algo = 'sha256';
|
||||
/** Message digest */
|
||||
dgst: string;
|
||||
/** Encryption engine used. */
|
||||
engine = 'pgp';
|
||||
/** A keystore holding pgp keys. */
|
||||
keyStore: MutableKeyStore;
|
||||
/** A service that provides logging capabilities. */
|
||||
loggingService: LoggingService;
|
||||
/** Event triggered on successful signing of message. */
|
||||
onsign: (signature: Signature) => void;
|
||||
/** Event triggered on successful verification of a signature. */
|
||||
onverify: (flag: boolean) => void;
|
||||
/** Generated signature */
|
||||
signature: Signature;
|
||||
}
|
||||
|
||||
/** Meta response interface */
|
||||
interface MetaResponse {
|
||||
/** Meta store id */
|
||||
id: string;
|
||||
/** Meta object */
|
||||
m: Meta;
|
||||
}
|
||||
/**
|
||||
* Initializing the Signer.
|
||||
* @param keyStore - A keystore holding pgp keys.
|
||||
*/
|
||||
constructor(keyStore: MutableKeyStore) {
|
||||
this.keyStore = keyStore;
|
||||
this.onsign = (signature: Signature) => {};
|
||||
this.onverify = (flag: boolean) => {};
|
||||
}
|
||||
|
||||
/** Default account data object */
|
||||
const defaultAccount: AccountDetails = {
|
||||
date_registered: Date.now(),
|
||||
gender: 'other',
|
||||
identities: {
|
||||
evm: {
|
||||
'bloxberg:8996': [''],
|
||||
'oldchain:1': [''],
|
||||
},
|
||||
latitude: 0,
|
||||
longitude: 0,
|
||||
},
|
||||
location: {
|
||||
area_name: 'Kilifi',
|
||||
},
|
||||
products: [],
|
||||
vcard: {
|
||||
email: [
|
||||
{
|
||||
value: '',
|
||||
},
|
||||
],
|
||||
fn: [
|
||||
{
|
||||
value: 'Sarafu Contract',
|
||||
},
|
||||
],
|
||||
n: [
|
||||
{
|
||||
value: ['Sarafu', 'Contract'],
|
||||
},
|
||||
],
|
||||
tel: [
|
||||
{
|
||||
meta: {
|
||||
TYP: [],
|
||||
},
|
||||
value: '',
|
||||
},
|
||||
],
|
||||
version: [
|
||||
{
|
||||
value: '3.0',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
/**
|
||||
* Get the private key fingerprint.
|
||||
* @returns A private key fingerprint.
|
||||
*/
|
||||
public fingerprint(): string {
|
||||
return this.keyStore.getFingerprint();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the message digest.
|
||||
* @param material - A signable object.
|
||||
* @returns true - If digest has been loaded successfully.
|
||||
*/
|
||||
public prepare(material: Signable): boolean {
|
||||
this.dgst = material.digest();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Signs a message using a private key.
|
||||
* @async
|
||||
* @param digest - The message to be signed.
|
||||
*/
|
||||
public async sign(digest: string): Promise<void> {
|
||||
const m = openpgp.cleartext.fromText(digest);
|
||||
const pk = this.keyStore.getPrivateKey();
|
||||
if (!pk.isDecrypted()) {
|
||||
const password = window.prompt('password');
|
||||
await pk.decrypt(password);
|
||||
}
|
||||
const opts = {
|
||||
message: m,
|
||||
privateKeys: [pk],
|
||||
detached: true,
|
||||
};
|
||||
openpgp
|
||||
.sign(opts)
|
||||
.then((s) => {
|
||||
this.signature = {
|
||||
engine: this.engine,
|
||||
algo: this.algo,
|
||||
data: s.signature,
|
||||
// TODO: fix for browser later
|
||||
digest,
|
||||
};
|
||||
this.onsign(this.signature);
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loggingService.sendErrorLevelMessage(e.message, this, { error: e });
|
||||
this.onsign(undefined);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that signature is valid.
|
||||
* @param digest - The message that was signed.
|
||||
* @param signature - The generated signature.
|
||||
*/
|
||||
public verify(digest: string, signature: Signature): void {
|
||||
openpgp.signature
|
||||
.readArmored(signature.data)
|
||||
.then((sig) => {
|
||||
const opts = {
|
||||
message: openpgp.cleartext.fromText(digest),
|
||||
publicKeys: this.keyStore.getTrustedKeys(),
|
||||
signature: sig,
|
||||
};
|
||||
openpgp.verify(opts).then((v) => {
|
||||
let i = 0;
|
||||
for (i = 0; i < v.signatures.length; i++) {
|
||||
const s = v.signatures[i];
|
||||
if (s.valid) {
|
||||
this.onverify(s);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.loggingService.sendErrorLevelMessage(
|
||||
`Checked ${i} signature(s) but none valid`,
|
||||
this,
|
||||
{ error: '404 Not found!' }
|
||||
);
|
||||
this.onverify(false);
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loggingService.sendErrorLevelMessage(e.message, this, { error: e });
|
||||
this.onverify(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** @exports */
|
||||
export { AccountDetails, Meta, MetaResponse, Signature, defaultAccount };
|
||||
export { PGPSigner, Signable, Signature, Signer };
|
||||
</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -61,14 +61,14 @@
|
||||
<h3>File</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<code>src/app/_pgp/pgp-signer.ts</code>
|
||||
<code>src/app/_models/account.ts</code>
|
||||
</p>
|
||||
|
||||
<p class="comment">
|
||||
<h3>Description</h3>
|
||||
</p>
|
||||
<p class="comment">
|
||||
<p>Signature object interface </p>
|
||||
<p>Meta signature interface </p>
|
||||
|
||||
</p>
|
||||
|
||||
@@ -137,7 +137,7 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Encryption algorithm used </p>
|
||||
<div class="io-description"><p>Algorithm used </p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -172,7 +172,7 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-description"><p>Data to be signed. </p>
|
||||
<div class="io-description"><p>Data that was signed. </p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -253,183 +253,149 @@
|
||||
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import * as openpgp from 'openpgp';
|
||||
|
||||
// Application imports
|
||||
import { MutableKeyStore } from '@app/_pgp/pgp-key-store';
|
||||
import { LoggingService } from '@app/_services/logging.service';
|
||||
|
||||
/** Signable object interface */
|
||||
interface Signable {
|
||||
/** The message to be signed. */
|
||||
digest(): string;
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">interface AccountDetails {
|
||||
/** Age of user */
|
||||
age?: string;
|
||||
/** Token balance on account */
|
||||
balance?: number;
|
||||
/** Business category of user. */
|
||||
category?: string;
|
||||
/** Account registration day */
|
||||
date_registered: number;
|
||||
/** User's gender */
|
||||
gender: string;
|
||||
/** Account identifiers */
|
||||
identities: {
|
||||
evm: {
|
||||
'bloxberg:8996': string[];
|
||||
'oldchain:1': string[];
|
||||
};
|
||||
latitude: number;
|
||||
longitude: number;
|
||||
};
|
||||
/** User's location */
|
||||
location: {
|
||||
area?: string;
|
||||
area_name: string;
|
||||
area_type?: string;
|
||||
};
|
||||
/** Products or services provided by user. */
|
||||
products: string[];
|
||||
/** Type of account */
|
||||
type?: string;
|
||||
/** Personal identifying information of user */
|
||||
vcard: {
|
||||
email: [
|
||||
{
|
||||
value: string;
|
||||
}
|
||||
];
|
||||
fn: [
|
||||
{
|
||||
value: string;
|
||||
}
|
||||
];
|
||||
n: [
|
||||
{
|
||||
value: string[];
|
||||
}
|
||||
];
|
||||
tel: [
|
||||
{
|
||||
meta: {
|
||||
TYP: string[];
|
||||
};
|
||||
value: string;
|
||||
}
|
||||
];
|
||||
version: [
|
||||
{
|
||||
value: string;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
/** Signature object interface */
|
||||
/** Meta signature interface */
|
||||
interface Signature {
|
||||
/** Encryption engine used. */
|
||||
engine: string;
|
||||
/** Encryption algorithm used */
|
||||
/** Algorithm used */
|
||||
algo: string;
|
||||
/** Data to be signed. */
|
||||
/** Data that was signed. */
|
||||
data: string;
|
||||
/** Message digest */
|
||||
digest: string;
|
||||
}
|
||||
|
||||
/** Signer interface */
|
||||
interface Signer {
|
||||
/** Event triggered on successful signing of message. */
|
||||
onsign(signature: Signature): void;
|
||||
/** Event triggered on successful verification of a signature. */
|
||||
onverify(flag: boolean): void;
|
||||
/**
|
||||
* Get the private key fingerprint.
|
||||
* @returns A private key fingerprint.
|
||||
*/
|
||||
fingerprint(): string;
|
||||
/**
|
||||
* Load the message digest.
|
||||
* @param material - A signable object.
|
||||
* @returns true - If digest has been loaded successfully.
|
||||
*/
|
||||
prepare(material: Signable): boolean;
|
||||
/**
|
||||
* Verify that signature is valid.
|
||||
* @param digest - The message that was signed.
|
||||
* @param signature - The generated signature.
|
||||
*/
|
||||
verify(digest: string, signature: Signature): void;
|
||||
/**
|
||||
* Signs a message using a private key.
|
||||
* @async
|
||||
* @param digest - The message to be signed.
|
||||
*/
|
||||
sign(digest: string): Promise<void>;
|
||||
}
|
||||
|
||||
/** Provides functionality for signing and verifying signed messages. */
|
||||
class PGPSigner implements Signer {
|
||||
/** Encryption engine used. */
|
||||
engine = 'pgp';
|
||||
/** Encryption algorithm used */
|
||||
algo = 'sha256';
|
||||
/** Message digest */
|
||||
dgst: string;
|
||||
/** Generated signature */
|
||||
signature: Signature;
|
||||
/** A keystore holding pgp keys. */
|
||||
keyStore: MutableKeyStore;
|
||||
/** Event triggered on successful signing of message. */
|
||||
onsign: (signature: Signature) => void;
|
||||
/** Event triggered on successful verification of a signature. */
|
||||
onverify: (flag: boolean) => void;
|
||||
/** A service that provides logging capabilities. */
|
||||
loggingService: LoggingService;
|
||||
|
||||
/**
|
||||
* Initializing the Signer.
|
||||
* @param keyStore - A keystore holding pgp keys.
|
||||
*/
|
||||
constructor(keyStore: MutableKeyStore) {
|
||||
this.keyStore = keyStore;
|
||||
this.onsign = (signature: Signature) => {};
|
||||
this.onverify = (flag: boolean) => {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the private key fingerprint.
|
||||
* @returns A private key fingerprint.
|
||||
*/
|
||||
public fingerprint(): string {
|
||||
return this.keyStore.getFingerprint();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the message digest.
|
||||
* @param material - A signable object.
|
||||
* @returns true - If digest has been loaded successfully.
|
||||
*/
|
||||
public prepare(material: Signable): boolean {
|
||||
this.dgst = material.digest();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that signature is valid.
|
||||
* @param digest - The message that was signed.
|
||||
* @param signature - The generated signature.
|
||||
*/
|
||||
public verify(digest: string, signature: Signature): void {
|
||||
openpgp.signature
|
||||
.readArmored(signature.data)
|
||||
.then((sig) => {
|
||||
const opts = {
|
||||
message: openpgp.cleartext.fromText(digest),
|
||||
publicKeys: this.keyStore.getTrustedKeys(),
|
||||
signature: sig,
|
||||
};
|
||||
openpgp.verify(opts).then((v) => {
|
||||
let i = 0;
|
||||
for (i = 0; i < v.signatures.length; i++) {
|
||||
const s = v.signatures[i];
|
||||
if (s.valid) {
|
||||
this.onverify(s);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.loggingService.sendErrorLevelMessage(
|
||||
`Checked ${i} signature(s) but none valid`,
|
||||
this,
|
||||
{ error: '404 Not found!' }
|
||||
);
|
||||
this.onverify(false);
|
||||
});
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loggingService.sendErrorLevelMessage(e.message, this, { error: e });
|
||||
this.onverify(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Signs a message using a private key.
|
||||
* @async
|
||||
* @param digest - The message to be signed.
|
||||
*/
|
||||
public async sign(digest: string): Promise<void> {
|
||||
const m = openpgp.cleartext.fromText(digest);
|
||||
const pk = this.keyStore.getPrivateKey();
|
||||
if (!pk.isDecrypted()) {
|
||||
const password = window.prompt('password');
|
||||
await pk.decrypt(password);
|
||||
}
|
||||
const opts = {
|
||||
message: m,
|
||||
privateKeys: [pk],
|
||||
detached: true,
|
||||
};
|
||||
openpgp
|
||||
.sign(opts)
|
||||
.then((s) => {
|
||||
this.signature = {
|
||||
engine: this.engine,
|
||||
algo: this.algo,
|
||||
data: s.signature,
|
||||
// TODO: fix for browser later
|
||||
digest,
|
||||
};
|
||||
this.onsign(this.signature);
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loggingService.sendErrorLevelMessage(e.message, this, { error: e });
|
||||
this.onsign(undefined);
|
||||
});
|
||||
}
|
||||
engine: string;
|
||||
}
|
||||
|
||||
/** Meta object interface */
|
||||
interface Meta {
|
||||
/** Account details */
|
||||
data: AccountDetails;
|
||||
/** Meta store id */
|
||||
id: string;
|
||||
/** Signature used during write. */
|
||||
signature: Signature;
|
||||
}
|
||||
|
||||
/** Meta response interface */
|
||||
interface MetaResponse {
|
||||
/** Meta store id */
|
||||
id: string;
|
||||
/** Meta object */
|
||||
m: Meta;
|
||||
}
|
||||
|
||||
/** Default account data object */
|
||||
const defaultAccount: AccountDetails = {
|
||||
date_registered: Date.now(),
|
||||
gender: 'other',
|
||||
identities: {
|
||||
evm: {
|
||||
'bloxberg:8996': [''],
|
||||
'oldchain:1': [''],
|
||||
},
|
||||
latitude: 0,
|
||||
longitude: 0,
|
||||
},
|
||||
location: {
|
||||
area_name: 'Kilifi',
|
||||
},
|
||||
products: [],
|
||||
vcard: {
|
||||
email: [
|
||||
{
|
||||
value: '',
|
||||
},
|
||||
],
|
||||
fn: [
|
||||
{
|
||||
value: 'Sarafu Contract',
|
||||
},
|
||||
],
|
||||
n: [
|
||||
{
|
||||
value: ['Sarafu', 'Contract'],
|
||||
},
|
||||
],
|
||||
tel: [
|
||||
{
|
||||
meta: {
|
||||
TYP: [],
|
||||
},
|
||||
value: '',
|
||||
},
|
||||
],
|
||||
version: [
|
||||
{
|
||||
value: '3.0',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
/** @exports */
|
||||
export { Signable, Signature, Signer, PGPSigner };
|
||||
export { AccountDetails, Meta, MetaResponse, Signature, defaultAccount };
|
||||
</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -137,8 +137,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="36"
|
||||
class="link-to-prism">src/app/_pgp/pgp-signer.ts:36</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="32"
|
||||
class="link-to-prism">src/app/_pgp/pgp-signer.ts:32</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -184,8 +184,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="29"
|
||||
class="link-to-prism">src/app/_pgp/pgp-signer.ts:29</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="34"
|
||||
class="link-to-prism">src/app/_pgp/pgp-signer.ts:34</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -256,8 +256,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="31"
|
||||
class="link-to-prism">src/app/_pgp/pgp-signer.ts:31</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="36"
|
||||
class="link-to-prism">src/app/_pgp/pgp-signer.ts:36</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -408,8 +408,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="54"
|
||||
class="link-to-prism">src/app/_pgp/pgp-signer.ts:54</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="48"
|
||||
class="link-to-prism">src/app/_pgp/pgp-signer.ts:48</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -487,8 +487,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="48"
|
||||
class="link-to-prism">src/app/_pgp/pgp-signer.ts:48</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="54"
|
||||
class="link-to-prism">src/app/_pgp/pgp-signer.ts:54</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -582,65 +582,65 @@ interface Signable {
|
||||
|
||||
/** Signature object interface */
|
||||
interface Signature {
|
||||
/** Encryption engine used. */
|
||||
engine: string;
|
||||
/** Encryption algorithm used */
|
||||
algo: string;
|
||||
/** Data to be signed. */
|
||||
data: string;
|
||||
/** Message digest */
|
||||
digest: string;
|
||||
/** Encryption engine used. */
|
||||
engine: string;
|
||||
}
|
||||
|
||||
/** Signer interface */
|
||||
interface Signer {
|
||||
/** Event triggered on successful signing of message. */
|
||||
onsign(signature: Signature): void;
|
||||
/** Event triggered on successful verification of a signature. */
|
||||
onverify(flag: boolean): void;
|
||||
/**
|
||||
* Get the private key fingerprint.
|
||||
* @returns A private key fingerprint.
|
||||
*/
|
||||
fingerprint(): string;
|
||||
/** Event triggered on successful signing of message. */
|
||||
onsign(signature: Signature): void;
|
||||
/** Event triggered on successful verification of a signature. */
|
||||
onverify(flag: boolean): void;
|
||||
/**
|
||||
* Load the message digest.
|
||||
* @param material - A signable object.
|
||||
* @returns true - If digest has been loaded successfully.
|
||||
*/
|
||||
prepare(material: Signable): boolean;
|
||||
/**
|
||||
* Verify that signature is valid.
|
||||
* @param digest - The message that was signed.
|
||||
* @param signature - The generated signature.
|
||||
*/
|
||||
verify(digest: string, signature: Signature): void;
|
||||
/**
|
||||
* Signs a message using a private key.
|
||||
* @async
|
||||
* @param digest - The message to be signed.
|
||||
*/
|
||||
sign(digest: string): Promise<void>;
|
||||
/**
|
||||
* Verify that signature is valid.
|
||||
* @param digest - The message that was signed.
|
||||
* @param signature - The generated signature.
|
||||
*/
|
||||
verify(digest: string, signature: Signature): void;
|
||||
}
|
||||
|
||||
/** Provides functionality for signing and verifying signed messages. */
|
||||
class PGPSigner implements Signer {
|
||||
/** Encryption engine used. */
|
||||
engine = 'pgp';
|
||||
/** Encryption algorithm used */
|
||||
algo = 'sha256';
|
||||
/** Message digest */
|
||||
dgst: string;
|
||||
/** Generated signature */
|
||||
signature: Signature;
|
||||
/** Encryption engine used. */
|
||||
engine = 'pgp';
|
||||
/** A keystore holding pgp keys. */
|
||||
keyStore: MutableKeyStore;
|
||||
/** A service that provides logging capabilities. */
|
||||
loggingService: LoggingService;
|
||||
/** Event triggered on successful signing of message. */
|
||||
onsign: (signature: Signature) => void;
|
||||
/** Event triggered on successful verification of a signature. */
|
||||
onverify: (flag: boolean) => void;
|
||||
/** A service that provides logging capabilities. */
|
||||
loggingService: LoggingService;
|
||||
/** Generated signature */
|
||||
signature: Signature;
|
||||
|
||||
/**
|
||||
* Initializing the Signer.
|
||||
@@ -670,6 +670,41 @@ class PGPSigner implements Signer {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Signs a message using a private key.
|
||||
* @async
|
||||
* @param digest - The message to be signed.
|
||||
*/
|
||||
public async sign(digest: string): Promise<void> {
|
||||
const m = openpgp.cleartext.fromText(digest);
|
||||
const pk = this.keyStore.getPrivateKey();
|
||||
if (!pk.isDecrypted()) {
|
||||
const password = window.prompt('password');
|
||||
await pk.decrypt(password);
|
||||
}
|
||||
const opts = {
|
||||
message: m,
|
||||
privateKeys: [pk],
|
||||
detached: true,
|
||||
};
|
||||
openpgp
|
||||
.sign(opts)
|
||||
.then((s) => {
|
||||
this.signature = {
|
||||
engine: this.engine,
|
||||
algo: this.algo,
|
||||
data: s.signature,
|
||||
// TODO: fix for browser later
|
||||
digest,
|
||||
};
|
||||
this.onsign(this.signature);
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loggingService.sendErrorLevelMessage(e.message, this, { error: e });
|
||||
this.onsign(undefined);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that signature is valid.
|
||||
* @param digest - The message that was signed.
|
||||
@@ -706,45 +741,10 @@ class PGPSigner implements Signer {
|
||||
this.onverify(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Signs a message using a private key.
|
||||
* @async
|
||||
* @param digest - The message to be signed.
|
||||
*/
|
||||
public async sign(digest: string): Promise<void> {
|
||||
const m = openpgp.cleartext.fromText(digest);
|
||||
const pk = this.keyStore.getPrivateKey();
|
||||
if (!pk.isDecrypted()) {
|
||||
const password = window.prompt('password');
|
||||
await pk.decrypt(password);
|
||||
}
|
||||
const opts = {
|
||||
message: m,
|
||||
privateKeys: [pk],
|
||||
detached: true,
|
||||
};
|
||||
openpgp
|
||||
.sign(opts)
|
||||
.then((s) => {
|
||||
this.signature = {
|
||||
engine: this.engine,
|
||||
algo: this.algo,
|
||||
data: s.signature,
|
||||
// TODO: fix for browser later
|
||||
digest,
|
||||
};
|
||||
this.onsign(this.signature);
|
||||
})
|
||||
.catch((e) => {
|
||||
this.loggingService.sendErrorLevelMessage(e.message, this, { error: e });
|
||||
this.onsign(undefined);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** @exports */
|
||||
export { Signable, Signature, Signer, PGPSigner };
|
||||
export { PGPSigner, Signable, Signature, Signer };
|
||||
</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -418,16 +418,16 @@
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">interface Token {
|
||||
/** Name of the token. */
|
||||
name: string;
|
||||
/** The unique token symbol. */
|
||||
symbol: string;
|
||||
/** Address of the deployed token contract. */
|
||||
address: string;
|
||||
/** Total token supply. */
|
||||
supply: string;
|
||||
/** Number of decimals to convert to smallest denomination of the token. */
|
||||
decimals: string;
|
||||
/** Name of the token. */
|
||||
name: string;
|
||||
/** Address of account that deployed token. */
|
||||
owner?: string;
|
||||
/** Token reserve to token minting ratio. */
|
||||
reserveRatio?: string;
|
||||
/** Token reserve information */
|
||||
reserves: {
|
||||
'0xa686005CE37Dce7738436256982C3903f2E4ea8E'?: {
|
||||
@@ -435,10 +435,10 @@
|
||||
balance: string;
|
||||
};
|
||||
};
|
||||
/** Token reserve to token minting ratio. */
|
||||
reserveRatio?: string;
|
||||
/** Address of account that deployed token. */
|
||||
owner?: string;
|
||||
/** Total token supply. */
|
||||
supply: string;
|
||||
/** The unique token symbol. */
|
||||
symbol: string;
|
||||
}
|
||||
|
||||
/** @exports */
|
||||
|
||||
@@ -425,30 +425,30 @@ interface Conversion {
|
||||
toValue: number;
|
||||
/** Address of the initiator of the conversion. */
|
||||
trader: string;
|
||||
/** Account information of the initiator of the conversion. */
|
||||
user: AccountDetails;
|
||||
/** Conversion mining information. */
|
||||
tx: Tx;
|
||||
/** Account information of the initiator of the conversion. */
|
||||
user: AccountDetails;
|
||||
}
|
||||
|
||||
/** Transaction object interface */
|
||||
interface Transaction {
|
||||
/** Address of the transaction sender. */
|
||||
from: string;
|
||||
/** Account information of the transaction recipient. */
|
||||
recipient: AccountDetails;
|
||||
/** Account information of the transaction sender. */
|
||||
sender: AccountDetails;
|
||||
/** Address of the transaction recipient. */
|
||||
to: string;
|
||||
/** Account information of the transaction recipient. */
|
||||
recipient: AccountDetails;
|
||||
/** Transaction token information. */
|
||||
token: TxToken;
|
||||
/** Transaction mining information. */
|
||||
tx: Tx;
|
||||
/** Amount of tokens transacted. */
|
||||
value: number;
|
||||
/** Type of transaction. */
|
||||
type?: string;
|
||||
/** Amount of tokens transacted. */
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** Transaction data interface */
|
||||
|
||||
@@ -305,30 +305,30 @@ interface Conversion {
|
||||
toValue: number;
|
||||
/** Address of the initiator of the conversion. */
|
||||
trader: string;
|
||||
/** Account information of the initiator of the conversion. */
|
||||
user: AccountDetails;
|
||||
/** Conversion mining information. */
|
||||
tx: Tx;
|
||||
/** Account information of the initiator of the conversion. */
|
||||
user: AccountDetails;
|
||||
}
|
||||
|
||||
/** Transaction object interface */
|
||||
interface Transaction {
|
||||
/** Address of the transaction sender. */
|
||||
from: string;
|
||||
/** Account information of the transaction recipient. */
|
||||
recipient: AccountDetails;
|
||||
/** Account information of the transaction sender. */
|
||||
sender: AccountDetails;
|
||||
/** Address of the transaction recipient. */
|
||||
to: string;
|
||||
/** Account information of the transaction recipient. */
|
||||
recipient: AccountDetails;
|
||||
/** Transaction token information. */
|
||||
token: TxToken;
|
||||
/** Transaction mining information. */
|
||||
tx: Tx;
|
||||
/** Amount of tokens transacted. */
|
||||
value: number;
|
||||
/** Type of transaction. */
|
||||
type?: string;
|
||||
/** Amount of tokens transacted. */
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** Transaction data interface */
|
||||
|
||||
@@ -229,30 +229,30 @@ interface Conversion {
|
||||
toValue: number;
|
||||
/** Address of the initiator of the conversion. */
|
||||
trader: string;
|
||||
/** Account information of the initiator of the conversion. */
|
||||
user: AccountDetails;
|
||||
/** Conversion mining information. */
|
||||
tx: Tx;
|
||||
/** Account information of the initiator of the conversion. */
|
||||
user: AccountDetails;
|
||||
}
|
||||
|
||||
/** Transaction object interface */
|
||||
interface Transaction {
|
||||
/** Address of the transaction sender. */
|
||||
from: string;
|
||||
/** Account information of the transaction recipient. */
|
||||
recipient: AccountDetails;
|
||||
/** Account information of the transaction sender. */
|
||||
sender: AccountDetails;
|
||||
/** Address of the transaction recipient. */
|
||||
to: string;
|
||||
/** Account information of the transaction recipient. */
|
||||
recipient: AccountDetails;
|
||||
/** Transaction token information. */
|
||||
token: TxToken;
|
||||
/** Transaction mining information. */
|
||||
tx: Tx;
|
||||
/** Amount of tokens transacted. */
|
||||
value: number;
|
||||
/** Type of transaction. */
|
||||
type?: string;
|
||||
/** Amount of tokens transacted. */
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** Transaction data interface */
|
||||
|
||||
@@ -178,17 +178,17 @@
|
||||
|
||||
<div class="tab-pane fade tab-source-code" id="c-source">
|
||||
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">class Settings {
|
||||
/** CIC Registry instance */
|
||||
registry: any;
|
||||
/** A resource for searching through blocks on the blockchain network. */
|
||||
scanFilter: any;
|
||||
/** Transaction Helper instance */
|
||||
txHelper: any;
|
||||
/** Web3 Object */
|
||||
w3: W3 = {
|
||||
engine: undefined,
|
||||
provider: undefined,
|
||||
};
|
||||
/** A resource for searching through blocks on the blockchain network. */
|
||||
scanFilter: any;
|
||||
/** CIC Registry instance */
|
||||
registry: any;
|
||||
/** Transaction Helper instance */
|
||||
txHelper: any;
|
||||
|
||||
/**
|
||||
* Initialize the settings.
|
||||
|
||||
Reference in New Issue
Block a user