1BLANKSPACE JAVASCRIPT NAMESPACE UTIL.PROTECT
Namespace (services) for managing the protection of data via cryptography.
This namespace depends on crypto-js.
To use this namespace you will need to include references to the following three (3) files:
/jscripts/cryptojs-3.1.2/pbkdf2.js
/jscripts/cryptojs-3.1.2/aes.js
/jscripts/1blankspace.util.protect-2.0.0.js (if using 1blankspace-2.0.1 or later, this is file is automatically included)
ns1blankspace.util.protect
.exists |
|
|
< true / false |
|
|
|
|
|
ns1blankspace.util.protect.exists() |
|
|
.key |
.create |
.single |
> persist: true/false |
|
|
|
|
|
< key |
|
|
|
|
|
Creates a key using PBKDF2 - it uses the last logonKey from mydigitalstructure as the salt for generating the cryptography key. |
|
|
|
|
|
ns1blankspace.util.protect.key.create.single({cryptoKeyReference: 'myKey1'}) |
|
|
|
.search |
|
> local: true/false, it true then requires the util.local namespace. |
|
|
|
|
|
> crytoKeyReference: |
|
|
|
|
|
> onComplete: |
|
|
|
|
|
< cryptoKey |
|
|
|
|
|
ns1blankspace.util.protect.search({cryptoKeyReference: 'local-cache-key'}) |
|
|
.encrypt |
|
|
> data: |
|
|
|
|
|
> crytoKeyReference: or cryptoKey: |
|
|
|
|
|
> type: defaults to AES |
|
|
|
|
|
< protectedData |
|
|
|
|
|
ns1blankspace.util.protect.encrypt({data: 'Encrypt this!', cryptoKeyReference: 'local-cache-key'}}) |
|
|
.decrypt |
|
|
> protectedData: (to be decrypted) |
|
|
|
|
|
> crytoKeyReference: or cryptoKey: |
|
|
|
|
|
> type: defaults to AES |
|
|
|
|
|
< data (decrypted) |
|
|
|
|
|
ns1blankspace.util.protect.decrypt({protectedData: 'dfrt56fgXX232...', cryptoKeyReference: 'local-cache-key'}}) |
|
|
|