Skip to content

Commit

Permalink
Global issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
nbarikipoulos committed Jul 6, 2019
1 parent fa46959 commit 9c637b0
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 100 deletions.
110 changes: 55 additions & 55 deletions doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,34 @@ Internal module objects of interest.


* [cryptObjects](#module_cryptObjects)
* [~CryptData](#module_cryptObjects..CryptData)
* [new CryptData(secret, [options])](#new_module_cryptObjects..CryptData_new)
* [.encryptd(data)](#module_cryptObjects..CryptData+encryptd) : <code>string</code>
* [.decryptd(data)](#module_cryptObjects..CryptData+decryptd) : <code>string</code> \| <code>integer</code> \| <code>boolean</code>
* [~CryptObject](#module_cryptObjects..CryptObject)[<code>CryptData</code>](#module_cryptObjects..CryptData)
* [new CryptObject(secret, [options])](#new_module_cryptObjects..CryptObject_new)
* [.encrypt(object)](#module_cryptObjects..CryptObject+encrypt) : <code>object</code>
* [.decrypt(object)](#module_cryptObjects..CryptObject+decrypt) : <code>object</code>
* [.encryptd(data)](#module_cryptObjects..CryptData+encryptd) : <code>string</code>
* [.decryptd(data)](#module_cryptObjects..CryptData+decryptd) : <code>string</code> \| <code>integer</code> \| <code>boolean</code>
* [~CryptData](#module_cryptObjects..CryptData)
* [new CryptData(secret, [options])](#new_module_cryptObjects..CryptData_new)
* [.encryptd(data)](#module_cryptObjects..CryptData+encryptd) : <code>string</code>
* [.decryptd(data)](#module_cryptObjects..CryptData+decryptd) : <code>string</code> \| <code>integer</code> \| <code>boolean</code>
* _Typedefs_
* [~Options](#module_cryptObjects..Options) : <code>Object</code>

<a name="module_cryptObjects..CryptObject"></a>
<a name="module_cryptObjects..CryptData"></a>

### cryptObjects~CryptObject ⇐ [<code>CryptData</code>](#module_cryptObjects..CryptData)
Object in charge to (un)cipher js object values.
### cryptObjects~CryptData
Intermediate object that handles single data (un)ciphering.

**Kind**: inner class of [<code>cryptObjects</code>](#module_cryptObjects)
**Extends**: [<code>CryptData</code>](#module_cryptObjects..CryptData)

* [~CryptObject](#module_cryptObjects..CryptObject)[<code>CryptData</code>](#module_cryptObjects..CryptData)
* [new CryptObject(secret, [options])](#new_module_cryptObjects..CryptObject_new)
* [.encrypt(object)](#module_cryptObjects..CryptObject+encrypt) : <code>object</code>
* [.decrypt(object)](#module_cryptObjects..CryptObject+decrypt) : <code>object</code>
* [~CryptData](#module_cryptObjects..CryptData)
* [new CryptData(secret, [options])](#new_module_cryptObjects..CryptData_new)
* [.encryptd(data)](#module_cryptObjects..CryptData+encryptd) : <code>string</code>
* [.decryptd(data)](#module_cryptObjects..CryptData+decryptd) : <code>string</code> \| <code>integer</code> \| <code>boolean</code>

<a name="new_module_cryptObjects..CryptObject_new"></a>
<a name="new_module_cryptObjects..CryptData_new"></a>

#### new CryptObject(secret, [options])
#### new CryptData(secret, [options])
Create a new CryptData object using specifed options.


Expand All @@ -84,76 +81,53 @@ Create a new CryptData object using specifed options.
| secret | <code>string</code> | The secret key or password that will be used to create the key for (un)ciphering step. |
| [options] | [<code>Options</code>](#module_cryptObjects..Options) | (Un)Ciphering Settings. Use of default settings performs an aes-256-crt ciphering. |

<a name="module_cryptObjects..CryptObject+encrypt"></a>

#### cryptObject.encrypt(object) : <code>object</code>
Cipher object. It returns a copy of the object containing with its values ciphered.

**Kind**: instance method of [<code>CryptObject</code>](#module_cryptObjects..CryptObject)

| Param | Type | Description |
| --- | --- | --- |
| object | <code>object</code> | Object to cipher. |

<a name="module_cryptObjects..CryptObject+decrypt"></a>

#### cryptObject.decrypt(object) : <code>object</code>
Uncipher object. It returns a copy of the ciphered object with unciphered values.

Note this unciphering step must be done using the same settings as for ciphering.

**Kind**: instance method of [<code>CryptObject</code>](#module_cryptObjects..CryptObject)

| Param | Type | Description |
| --- | --- | --- |
| object | <code>object</code> | Ciphered object to uncipher. |

<a name="module_cryptObjects..CryptData+encryptd"></a>

#### cryptObject.encryptd(data) : <code>string</code>
#### cryptData.encryptd(data) : <code>string</code>
Cipher a given data.

For each call, an iv vector will be randomly generated.

Note retained type are integer, boolean, or string. All other kind of values
will be treated as string.

**Kind**: instance method of [<code>CryptObject</code>](#module_cryptObjects..CryptObject)
**Overrides**: [<code>encryptd</code>](#module_cryptObjects..CryptData+encryptd)
**Kind**: instance method of [<code>CryptData</code>](#module_cryptObjects..CryptData)

| Param | Type | Description |
| --- | --- | --- |
| data | <code>string</code> \| <code>integer</code> \| <code>boolean</code> \| <code>\*</code> | Data to cipher. |

<a name="module_cryptObjects..CryptData+decryptd"></a>

#### cryptObject.decryptd(data) : <code>string</code> \| <code>integer</code> \| <code>boolean</code>
#### cryptData.decryptd(data) : <code>string</code> \| <code>integer</code> \| <code>boolean</code>
Uncipher data.

For this step, note the CryptData object **must be initialized with the same options as for the ciphering** step.

**Kind**: instance method of [<code>CryptObject</code>](#module_cryptObjects..CryptObject)
**Overrides**: [<code>decryptd</code>](#module_cryptObjects..CryptData+decryptd)
**Kind**: instance method of [<code>CryptData</code>](#module_cryptObjects..CryptData)

| Param | Type | Description |
| --- | --- | --- |
| data | <code>string</code> | Data to uncipher. |

<a name="module_cryptObjects..CryptData"></a>
<a name="module_cryptObjects..CryptObject"></a>

### cryptObjects~CryptData
Intermediate object that handles single data (un)ciphering.
### cryptObjects~CryptObject ⇐ [<code>CryptData</code>](#module_cryptObjects..CryptData)
Object in charge to (un)cipher js object values.

**Kind**: inner class of [<code>cryptObjects</code>](#module_cryptObjects)
**Extends**: [<code>CryptData</code>](#module_cryptObjects..CryptData)

* [~CryptData](#module_cryptObjects..CryptData)
* [new CryptData(secret, [options])](#new_module_cryptObjects..CryptData_new)
* [~CryptObject](#module_cryptObjects..CryptObject)[<code>CryptData</code>](#module_cryptObjects..CryptData)
* [new CryptObject(secret, [options])](#new_module_cryptObjects..CryptObject_new)
* [.encrypt(object)](#module_cryptObjects..CryptObject+encrypt) : <code>object</code>
* [.decrypt(object)](#module_cryptObjects..CryptObject+decrypt) : <code>object</code>
* [.encryptd(data)](#module_cryptObjects..CryptData+encryptd) : <code>string</code>
* [.decryptd(data)](#module_cryptObjects..CryptData+decryptd) : <code>string</code> \| <code>integer</code> \| <code>boolean</code>

<a name="new_module_cryptObjects..CryptData_new"></a>
<a name="new_module_cryptObjects..CryptObject_new"></a>

#### new CryptData(secret, [options])
#### new CryptObject(secret, [options])
Create a new CryptData object using specifed options.


Expand All @@ -162,30 +136,56 @@ Create a new CryptData object using specifed options.
| secret | <code>string</code> | The secret key or password that will be used to create the key for (un)ciphering step. |
| [options] | [<code>Options</code>](#module_cryptObjects..Options) | (Un)Ciphering Settings. Use of default settings performs an aes-256-crt ciphering. |

<a name="module_cryptObjects..CryptObject+encrypt"></a>

#### cryptObject.encrypt(object) : <code>object</code>
Cipher object. It returns a copy of the object containing with its values ciphered.

**Kind**: instance method of [<code>CryptObject</code>](#module_cryptObjects..CryptObject)

| Param | Type | Description |
| --- | --- | --- |
| object | <code>object</code> | Object to cipher. |

<a name="module_cryptObjects..CryptObject+decrypt"></a>

#### cryptObject.decrypt(object) : <code>object</code>
Uncipher object. It returns a copy of the ciphered object with unciphered values.

Note this unciphering step must be done using the same settings as for ciphering.

**Kind**: instance method of [<code>CryptObject</code>](#module_cryptObjects..CryptObject)

| Param | Type | Description |
| --- | --- | --- |
| object | <code>object</code> | Ciphered object to uncipher. |

<a name="module_cryptObjects..CryptData+encryptd"></a>

#### cryptData.encryptd(data) : <code>string</code>
#### cryptObject.encryptd(data) : <code>string</code>
Cipher a given data.

For each call, an iv vector will be randomly generated.

Note retained type are integer, boolean, or string. All other kind of values
will be treated as string.

**Kind**: instance method of [<code>CryptData</code>](#module_cryptObjects..CryptData)
**Kind**: instance method of [<code>CryptObject</code>](#module_cryptObjects..CryptObject)
**Overrides**: [<code>encryptd</code>](#module_cryptObjects..CryptData+encryptd)

| Param | Type | Description |
| --- | --- | --- |
| data | <code>string</code> \| <code>integer</code> \| <code>boolean</code> \| <code>\*</code> | Data to cipher. |

<a name="module_cryptObjects..CryptData+decryptd"></a>

#### cryptData.decryptd(data) : <code>string</code> \| <code>integer</code> \| <code>boolean</code>
#### cryptObject.decryptd(data) : <code>string</code> \| <code>integer</code> \| <code>boolean</code>
Uncipher data.

For this step, note the CryptData object **must be initialized with the same options as for the ciphering** step.

**Kind**: instance method of [<code>CryptData</code>](#module_cryptObjects..CryptData)
**Kind**: instance method of [<code>CryptObject</code>](#module_cryptObjects..CryptObject)
**Overrides**: [<code>decryptd</code>](#module_cryptObjects..CryptData+decryptd)

| Param | Type | Description |
| --- | --- | --- |
Expand Down
90 changes: 45 additions & 45 deletions lib/cryptObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,51 +29,6 @@ const crypto = require('crypto');

const tr = require('./tr');

/**
* Object in charge to (un)cipher js object values.
*
* @extends module:cryptObjects~CryptData
* @memberof module:cryptObjects
* @inner
*/
class CryptObject extends CryptData {

/**
* Create a new CryptData object using specifed options.
*
* @param {string} secret - The secret key or password that will be used to create the
* key for (un)ciphering step.
* @param {module:cryptObjects~Options=} options - (Un)Ciphering Settings.
* Use of default settings performs an aes-256-crt ciphering.
*/
constructor(secret, options) {
super(secret, options);
}

/**
* Cipher object. It returns a copy of the object containing with its values ciphered.
*
* @param {object} object - Object to cipher.
* @type {object}
*/
encrypt(object) {
return tr(object, v => this.encryptd(v) );
}

/**
* Uncipher object. It returns a copy of the ciphered object with unciphered values.
*
* Note this unciphering step must be done using the same settings as for ciphering.
*
* @param {object} object - Ciphered object to uncipher.
* @type {object}
*/
decrypt(object) {
return tr(object, v => this.decryptd(v) )
}

}

/**
* Intermediate object that handles single data (un)ciphering.
*
Expand Down Expand Up @@ -193,6 +148,51 @@ class CryptData {
}
}

/**
* Object in charge to (un)cipher js object values.
*
* @extends module:cryptObjects~CryptData
* @memberof module:cryptObjects
* @inner
*/
class CryptObject extends CryptData {

/**
* Create a new CryptData object using specifed options.
*
* @param {string} secret - The secret key or password that will be used to create the
* key for (un)ciphering step.
* @param {module:cryptObjects~Options=} options - (Un)Ciphering Settings.
* Use of default settings performs an aes-256-crt ciphering.
*/
constructor(secret, options) {
super(secret, options);
}

/**
* Cipher object. It returns a copy of the object containing with its values ciphered.
*
* @param {object} object - Object to cipher.
* @type {object}
*/
encrypt(object) {
return tr(object, v => this.encryptd(v) );
}

/**
* Uncipher object. It returns a copy of the ciphered object with unciphered values.
*
* Note this unciphering step must be done using the same settings as for ciphering.
*
* @param {object} object - Ciphered object to uncipher.
* @type {object}
*/
decrypt(object) {
return tr(object, v => this.decryptd(v) )
}

}

//////////////////////////////////
// Utility functions
//////////////////////////////////
Expand Down

0 comments on commit 9c637b0

Please sign in to comment.