Refactor order of item to follow alphabetical order.

This commit is contained in:
Spencer Ofwiti
2021-05-13 10:13:51 +03:00
parent 948554563d
commit b68404eade
51 changed files with 1718 additions and 1718 deletions

View File

@@ -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&#x27;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: [

View File

@@ -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&#x27;s role in the system */
role: string;
/** Action performed */
action: string;
/** Action approval status. */
approval: boolean;
/** Action ID */
id: number;
/** Admin&#x27;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&lt;string&gt;;
/** 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&lt;string&gt;;
/** Type of area */
name: string;
}
/** Category object interface */

View File

@@ -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&#x27;s role in the system */
role: string;
/** Action performed */
action: string;
/** Action approval status. */
approval: boolean;
/** Action ID */
id: number;
/** Admin&#x27;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&lt;string&gt;;
/** 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&lt;string&gt;;
/** Type of area */
name: string;
}
/** Category object interface */

View File

@@ -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&#x27;s role in the system */
role: string;
/** Action performed */
action: string;
/** Action approval status. */
approval: boolean;
/** Action ID */
id: number;
/** Admin&#x27;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&lt;string&gt;;
/** 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&lt;string&gt;;
/** Type of area */
name: string;
}
/** Category object interface */

View File

@@ -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&#x27;s role in the system */
role: string;
/** Action performed */
action: string;
/** Action approval status. */
approval: boolean;
/** Action ID */
id: number;
/** Admin&#x27;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&lt;string&gt;;
/** 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&lt;string&gt;;
/** Type of area */
name: string;
}
/** Category object interface */

View File

@@ -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 */

View File

@@ -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&#x27;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: [

View File

@@ -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&#x27;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: [

View File

@@ -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 &#x3D; 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&lt;void&gt;;
/**
* Add public key to keyring.
* @async
* @param publicKey - The public key to be added to the keyring.
* @throws Error
*/
importPublicKey(publicKey: any): Promise&lt;void&gt;;
/**
* Add private key to keyring.
* @async
* @param privateKey - The private key to be added to the keyring.
* @throws Error
*/
importPrivateKey(privateKey: any): Promise&lt;void&gt;;
/**
* Get all the public keys.
* @returns An array of public keys.
*/
getPublicKeys(): Array&lt;any&gt;;
/**
* Get all the trusted keys.
* @returns An array of trusted keys.
*/
getTrustedKeys(): Array&lt;any&gt;;
/**
* Get all the trusted active keys.
* @returns An array of trusted active keys.
*/
getTrustedActiveKeys(): Array&lt;any&gt;;
/** 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&lt;any&gt;;
/**
* Get all private keys.
* @returns An array of all private keys.
*/
getPrivateKeys(): Array&lt;any&gt;;
/**
* 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&lt;boolean&gt;;
/**
* 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&lt;boolean&gt;;
/**
* Get the first private key&#x27;s fingerprint.
* @returns The first private key&#x27;s fingerprint.
@@ -1955,11 +1891,6 @@ interface MutableKeyStore extends KeyStore {
* @returns The key&#x27;s keyId.
*/
getKeyId(key: any): string;
/**
* Get the first private key&#x27;s keyID.
* @returns The first private key&#x27;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&lt;any&gt;;
/**
* Get a public key from the keyring using it&#x27;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&#x27;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&#x27;s keyID.
* @returns The first private key&#x27;s keyId.
*/
getPrivateKeyId(): string;
/**
* Get all private keys.
* @returns An array of all private keys.
*/
getPrivateKeys(): Array&lt;any&gt;;
/**
* Get a public key from the keyring using it&#x27;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&#x27;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&lt;any&gt;;
/**
* 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&lt;any&gt;;
/**
* Get all the trusted active keys.
* @returns An array of trusted active keys.
*/
getTrustedActiveKeys(): Array&lt;any&gt;;
/**
* Get all the trusted keys.
* @returns An array of trusted keys.
*/
getTrustedKeys(): Array&lt;any&gt;;
/**
* 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&lt;void&gt;;
/**
* Add private key to keyring.
* @async
* @param privateKey - The private key to be added to the keyring.
* @throws Error
*/
importPrivateKey(privateKey: any): Promise&lt;void&gt;;
/**
* Add public key to keyring.
* @async
* @param publicKey - The public key to be added to the keyring.
* @throws Error
*/
importPublicKey(publicKey: any): Promise&lt;void&gt;;
/**
* 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&lt;boolean&gt;;
/**
* 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&lt;boolean&gt;;
/**
* Instantiate the keyring in the keystore.
* @async
*/
loadKeyring(): void;
/**
* Remove a public key from the keyring using it&#x27;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&lt;any&gt;;
/**
* Remove a public key from the keyring using it&#x27;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&#x27;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&lt;void&gt; {
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&lt;void&gt; {
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&lt;void&gt; {
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&lt;void&gt; {
try {
await keyring.privateKeys.importKey(privateKey);
} catch (error) {
throw error;
}
}
/**
* Get all the public keys.
* @returns An array of public keys.
*/
getPublicKeys(): Array&lt;any&gt; {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.keys;
}
/**
* Get all the trusted keys.
* @returns An array of trusted keys.
*/
getTrustedKeys(): Array&lt;any&gt; {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.keys;
}
/**
* Get all the trusted active keys.
* @returns An array of trusted active keys.
*/
getTrustedActiveKeys(): Array&lt;any&gt; {
return keyring.publicKeys &amp;&amp; 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&lt;any&gt; {
return keyring.privateKeys &amp;&amp; keyring.privateKeys.keys;
}
/**
* Get the first private key.
* @returns The first private key.
*/
getPrivateKey(): any {
return keyring.privateKeys &amp;&amp; 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&lt;boolean&gt; {
// There is supposed to be an openpgp.readKey() method but I can&#x27;t find it?
const testKey &#x3D; 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&lt;boolean&gt; {
const imported &#x3D; await openpgp.key.readArmored(privateKey);
for (const key of imported.keys) {
if (key.isDecrypted()) {
return false;
}
}
return true;
}
/**
* Get the first private key&#x27;s fingerprint.
* @returns The first private key&#x27;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&lt;any&gt; {
return keyring.getKeysForId(keyId);
}
/**
* Get the first private key.
* @returns The first private key.
*/
getPrivateKey(): any {
return keyring.privateKeys &amp;&amp; keyring.privateKeys.keys[0];
}
/**
* Get a private key from the keyring using it&#x27;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 &amp;&amp; keyring.privateKeys.getForId(keyId);
}
/**
* Get the first private key&#x27;s keyID.
* @returns The first private key&#x27;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&lt;any&gt; {
return keyring.getKeysForId(keyId);
getPrivateKeys(): Array&lt;any&gt; {
return keyring.privateKeys &amp;&amp; keyring.privateKeys.keys;
}
/**
@@ -2207,15 +2116,6 @@ class MutablePgpKeyStore implements MutableKeyStore {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.getForId(keyId);
}
/**
* Get a private key from the keyring using it&#x27;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 &amp;&amp; keyring.privateKeys.getForId(keyId);
}
/**
* Get a public key from the keyring using it&#x27;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 &amp;&amp; keyring.publicKeys.getForId(subkeyId, true);
}
/**
* Get all the public keys.
* @returns An array of public keys.
*/
getPublicKeys(): Array&lt;any&gt; {
return keyring.publicKeys &amp;&amp; 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 &amp;&amp; keyring.publicKeys.getForAddress(address);
}
/**
* Get all the trusted active keys.
* @returns An array of trusted active keys.
*/
getTrustedActiveKeys(): Array&lt;any&gt; {
return keyring.publicKeys &amp;&amp; keyring.publicKeys.keys;
}
/**
* Get all the trusted keys.
* @returns An array of trusted keys.
*/
getTrustedKeys(): Array&lt;any&gt; {
return keyring.publicKeys &amp;&amp; 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&lt;void&gt; {
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&lt;void&gt; {
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&lt;void&gt; {
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&lt;boolean&gt; {
const imported &#x3D; 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&lt;boolean&gt; {
// There is supposed to be an openpgp.readKey() method but I can&#x27;t find it?
const testKey &#x3D; await openpgp.key.readArmored(key);
return !testKey.err;
}
/**
* Instantiate the keyring in the keystore.
* @async
*/
async loadKeyring(): Promise&lt;void&gt; {
await keyring.load();
await keyring.store();
}
/**
* Remove a public key from the keyring using it&#x27;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&#x27;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 &amp;&amp; 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 &amp;&amp; keyring.publicKeys.removeForId(keyId);
}
/** Remove all keys from the keyring. */
clearKeysInKeyring(): void {
keyring.clear();
/**
* Remove a public key from the keyring using it&#x27;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 &amp;&amp; keyring.publicKeys.removeForId(keyId);
}
/**
@@ -2290,7 +2290,7 @@ class MutablePgpKeyStore implements MutableKeyStore {
}
/** @exports */
export { MutablePgpKeyStore, MutableKeyStore };
export { MutableKeyStore, MutablePgpKeyStore };
</code></pre>
</div>
</div>

View File

@@ -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&lt;void&gt;;
/**
* 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 &#x3D; &#x27;pgp&#x27;;
/** Encryption algorithm used */
algo &#x3D; &#x27;sha256&#x27;;
/** Message digest */
dgst: string;
/** Generated signature */
signature: Signature;
/** Encryption engine used. */
engine &#x3D; &#x27;pgp&#x27;;
/** 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) &#x3D;&gt; void;
/** Event triggered on successful verification of a signature. */
onverify: (flag: boolean) &#x3D;&gt; 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&lt;void&gt; {
const m &#x3D; openpgp.cleartext.fromText(digest);
const pk &#x3D; this.keyStore.getPrivateKey();
if (!pk.isDecrypted()) {
const password &#x3D; window.prompt(&#x27;password&#x27;);
await pk.decrypt(password);
}
const opts &#x3D; {
message: m,
privateKeys: [pk],
detached: true,
};
openpgp
.sign(opts)
.then((s) &#x3D;&gt; {
this.signature &#x3D; {
engine: this.engine,
algo: this.algo,
data: s.signature,
// TODO: fix for browser later
digest,
};
this.onsign(this.signature);
})
.catch((e) &#x3D;&gt; {
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&lt;void&gt; {
const m &#x3D; openpgp.cleartext.fromText(digest);
const pk &#x3D; this.keyStore.getPrivateKey();
if (!pk.isDecrypted()) {
const password &#x3D; window.prompt(&#x27;password&#x27;);
await pk.decrypt(password);
}
const opts &#x3D; {
message: m,
privateKeys: [pk],
detached: true,
};
openpgp
.sign(opts)
.then((s) &#x3D;&gt; {
this.signature &#x3D; {
engine: this.engine,
algo: this.algo,
data: s.signature,
// TODO: fix for browser later
digest,
};
this.onsign(this.signature);
})
.catch((e) &#x3D;&gt; {
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>

View File

@@ -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&#x27;s gender */
gender: string;
/** Age of user */
age?: string;
/** Type of account */
type?: string;
/** Token balance on account */
balance?: number;
/** Account identifiers */
identities: {
evm: {
&#x27;bloxberg:8996&#x27;: string[];
&#x27;oldchain:1&#x27;: string[];
};
latitude: number;
longitude: number;
};
/** User&#x27;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 &#x27;openpgp&#x27;;
// Application imports
import { MutableKeyStore } from &#x27;@app/_pgp/pgp-key-store&#x27;;
import { LoggingService } from &#x27;@app/_services/logging.service&#x27;;
/** 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&lt;void&gt;;
/**
* 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 &#x3D; &#x27;sha256&#x27;;
/** Message digest */
dgst: string;
/** Encryption engine used. */
engine &#x3D; &#x27;pgp&#x27;;
/** 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) &#x3D;&gt; void;
/** Event triggered on successful verification of a signature. */
onverify: (flag: boolean) &#x3D;&gt; 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 &#x3D; keyStore;
this.onsign &#x3D; (signature: Signature) &#x3D;&gt; {};
this.onverify &#x3D; (flag: boolean) &#x3D;&gt; {};
}
/** Default account data object */
const defaultAccount: AccountDetails &#x3D; {
date_registered: Date.now(),
gender: &#x27;other&#x27;,
identities: {
evm: {
&#x27;bloxberg:8996&#x27;: [&#x27;&#x27;],
&#x27;oldchain:1&#x27;: [&#x27;&#x27;],
},
latitude: 0,
longitude: 0,
},
location: {
area_name: &#x27;Kilifi&#x27;,
},
products: [],
vcard: {
email: [
{
value: &#x27;&#x27;,
},
],
fn: [
{
value: &#x27;Sarafu Contract&#x27;,
},
],
n: [
{
value: [&#x27;Sarafu&#x27;, &#x27;Contract&#x27;],
},
],
tel: [
{
meta: {
TYP: [],
},
value: &#x27;&#x27;,
},
],
version: [
{
value: &#x27;3.0&#x27;,
},
],
},
};
/**
* 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 &#x3D; 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&lt;void&gt; {
const m &#x3D; openpgp.cleartext.fromText(digest);
const pk &#x3D; this.keyStore.getPrivateKey();
if (!pk.isDecrypted()) {
const password &#x3D; window.prompt(&#x27;password&#x27;);
await pk.decrypt(password);
}
const opts &#x3D; {
message: m,
privateKeys: [pk],
detached: true,
};
openpgp
.sign(opts)
.then((s) &#x3D;&gt; {
this.signature &#x3D; {
engine: this.engine,
algo: this.algo,
data: s.signature,
// TODO: fix for browser later
digest,
};
this.onsign(this.signature);
})
.catch((e) &#x3D;&gt; {
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) &#x3D;&gt; {
const opts &#x3D; {
message: openpgp.cleartext.fromText(digest),
publicKeys: this.keyStore.getTrustedKeys(),
signature: sig,
};
openpgp.verify(opts).then((v) &#x3D;&gt; {
let i &#x3D; 0;
for (i &#x3D; 0; i &lt; v.signatures.length; i++) {
const s &#x3D; v.signatures[i];
if (s.valid) {
this.onverify(s);
return;
}
}
this.loggingService.sendErrorLevelMessage(
&#x60;Checked ${i} signature(s) but none valid&#x60;,
this,
{ error: &#x27;404 Not found!&#x27; }
);
this.onverify(false);
});
})
.catch((e) &#x3D;&gt; {
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>

View File

@@ -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 &#x27;openpgp&#x27;;
// Application imports
import { MutableKeyStore } from &#x27;@app/_pgp/pgp-key-store&#x27;;
import { LoggingService } from &#x27;@app/_services/logging.service&#x27;;
/** 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&#x27;s gender */
gender: string;
/** Account identifiers */
identities: {
evm: {
&#x27;bloxberg:8996&#x27;: string[];
&#x27;oldchain:1&#x27;: string[];
};
latitude: number;
longitude: number;
};
/** User&#x27;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&lt;void&gt;;
}
/** Provides functionality for signing and verifying signed messages. */
class PGPSigner implements Signer {
/** Encryption engine used. */
engine &#x3D; &#x27;pgp&#x27;;
/** Encryption algorithm used */
algo &#x3D; &#x27;sha256&#x27;;
/** 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) &#x3D;&gt; void;
/** Event triggered on successful verification of a signature. */
onverify: (flag: boolean) &#x3D;&gt; void;
/** A service that provides logging capabilities. */
loggingService: LoggingService;
/**
* Initializing the Signer.
* @param keyStore - A keystore holding pgp keys.
*/
constructor(keyStore: MutableKeyStore) {
this.keyStore &#x3D; keyStore;
this.onsign &#x3D; (signature: Signature) &#x3D;&gt; {};
this.onverify &#x3D; (flag: boolean) &#x3D;&gt; {};
}
/**
* 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 &#x3D; 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) &#x3D;&gt; {
const opts &#x3D; {
message: openpgp.cleartext.fromText(digest),
publicKeys: this.keyStore.getTrustedKeys(),
signature: sig,
};
openpgp.verify(opts).then((v) &#x3D;&gt; {
let i &#x3D; 0;
for (i &#x3D; 0; i &lt; v.signatures.length; i++) {
const s &#x3D; v.signatures[i];
if (s.valid) {
this.onverify(s);
return;
}
}
this.loggingService.sendErrorLevelMessage(
&#x60;Checked ${i} signature(s) but none valid&#x60;,
this,
{ error: &#x27;404 Not found!&#x27; }
);
this.onverify(false);
});
})
.catch((e) &#x3D;&gt; {
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&lt;void&gt; {
const m &#x3D; openpgp.cleartext.fromText(digest);
const pk &#x3D; this.keyStore.getPrivateKey();
if (!pk.isDecrypted()) {
const password &#x3D; window.prompt(&#x27;password&#x27;);
await pk.decrypt(password);
}
const opts &#x3D; {
message: m,
privateKeys: [pk],
detached: true,
};
openpgp
.sign(opts)
.then((s) &#x3D;&gt; {
this.signature &#x3D; {
engine: this.engine,
algo: this.algo,
data: s.signature,
// TODO: fix for browser later
digest,
};
this.onsign(this.signature);
})
.catch((e) &#x3D;&gt; {
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 &#x3D; {
date_registered: Date.now(),
gender: &#x27;other&#x27;,
identities: {
evm: {
&#x27;bloxberg:8996&#x27;: [&#x27;&#x27;],
&#x27;oldchain:1&#x27;: [&#x27;&#x27;],
},
latitude: 0,
longitude: 0,
},
location: {
area_name: &#x27;Kilifi&#x27;,
},
products: [],
vcard: {
email: [
{
value: &#x27;&#x27;,
},
],
fn: [
{
value: &#x27;Sarafu Contract&#x27;,
},
],
n: [
{
value: [&#x27;Sarafu&#x27;, &#x27;Contract&#x27;],
},
],
tel: [
{
meta: {
TYP: [],
},
value: &#x27;&#x27;,
},
],
version: [
{
value: &#x27;3.0&#x27;,
},
],
},
};
/** @exports */
export { Signable, Signature, Signer, PGPSigner };
export { AccountDetails, Meta, MetaResponse, Signature, defaultAccount };
</code></pre>
</div>
</div>

View File

@@ -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&lt;void&gt;;
/**
* 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 &#x3D; &#x27;pgp&#x27;;
/** Encryption algorithm used */
algo &#x3D; &#x27;sha256&#x27;;
/** Message digest */
dgst: string;
/** Generated signature */
signature: Signature;
/** Encryption engine used. */
engine &#x3D; &#x27;pgp&#x27;;
/** 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) &#x3D;&gt; void;
/** Event triggered on successful verification of a signature. */
onverify: (flag: boolean) &#x3D;&gt; 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&lt;void&gt; {
const m &#x3D; openpgp.cleartext.fromText(digest);
const pk &#x3D; this.keyStore.getPrivateKey();
if (!pk.isDecrypted()) {
const password &#x3D; window.prompt(&#x27;password&#x27;);
await pk.decrypt(password);
}
const opts &#x3D; {
message: m,
privateKeys: [pk],
detached: true,
};
openpgp
.sign(opts)
.then((s) &#x3D;&gt; {
this.signature &#x3D; {
engine: this.engine,
algo: this.algo,
data: s.signature,
// TODO: fix for browser later
digest,
};
this.onsign(this.signature);
})
.catch((e) &#x3D;&gt; {
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&lt;void&gt; {
const m &#x3D; openpgp.cleartext.fromText(digest);
const pk &#x3D; this.keyStore.getPrivateKey();
if (!pk.isDecrypted()) {
const password &#x3D; window.prompt(&#x27;password&#x27;);
await pk.decrypt(password);
}
const opts &#x3D; {
message: m,
privateKeys: [pk],
detached: true,
};
openpgp
.sign(opts)
.then((s) &#x3D;&gt; {
this.signature &#x3D; {
engine: this.engine,
algo: this.algo,
data: s.signature,
// TODO: fix for browser later
digest,
};
this.onsign(this.signature);
})
.catch((e) &#x3D;&gt; {
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>

View File

@@ -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: {
&#x27;0xa686005CE37Dce7738436256982C3903f2E4ea8E&#x27;?: {
@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 */

View File

@@ -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 &#x3D; {
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.