secureworker
Advanced tools
@@ -92,3 +92,3 @@ (function () { | ||
monotonicCounters: { | ||
// Returns an object {uuid:arraybuffer, value:number}. | ||
// Returns an object {uuid:ArrayBuffer, value:Number}. | ||
create: function create() { | ||
@@ -113,3 +113,3 @@ return _dukEnclaveNative.createMonotonicCounter(); | ||
// Returns an object {currentTime:arraybuffer, timeSourceNonce:arraybuffer}. | ||
// Returns an object {currentTime:ArrayBuffer, timeSourceNonce:ArrayBuffer}. | ||
getTrustedTime: function getTrustedTime() { | ||
@@ -119,3 +119,3 @@ return _dukEnclaveNative.getTime(); | ||
// Returns the report as arraybuffer. reportData is 64 bytes of extra information, targetInfo is 512 bytes, arraybuffers. Both optional. | ||
// Returns the report as ArrayBuffer. reportData is 64 bytes of extra information, targetInfo is 512 bytes, ArrayBuffers. Both optional. | ||
getReport: function getReport(reportData, targetInfo) { | ||
@@ -127,3 +127,16 @@ // Only if it is undefined, we fetch target info ourselves. If it is null, we leave it null. | ||
} | ||
return _dukEnclaveNative.getReport(reportData, targetInfo); | ||
}, | ||
// Seals an ArrayBuffer along with an additional buffer of *unencrypted* text | ||
sealData: function sealData(additionalData, data) { | ||
if (!additionalData || additionalData.length === 0) additionalData = null; | ||
return _dukEnclaveNative.sealData(additionalData, data); | ||
}, | ||
// Returns an object from a sealed ArrayBuffer {data: ArrayBuffer, additionalData: ArrayBuffer} | ||
unsealData: function unsealData(data) { | ||
return _dukEnclaveNative.unsealData(data); | ||
} | ||
@@ -130,0 +143,0 @@ }; |
{ | ||
"name": "secureworker", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Run JavaScript inside an Intel SGX enclave", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
# SecureWorker | ||
 | ||
 | ||
 | ||
 | ||
This NPM package allows you to run JavaScript inside a secure (trusted) environment (enclave) provided by | ||
@@ -252,2 +257,14 @@ [Intel SGX](https://software.intel.com/en-us/sgx) technology on modern CPUs. When used properly, | ||
### `SecureWorker.sealData([additionalData:ArrayBuffer], [data:ArrayBuffer]) : ArrayBuffer` | ||
Seals an ArrayBuffer using a key derived from the enclave EGETKEY instruction. | ||
Can optionally include an `additionalData` ArrayBuffer which _will not be encrypted_ but will be part of the GCM MAC calculation, which also covers the data to be encrypted. | ||
This function can be used to encrypt and persistently store data outside of the enclave and is bound to the particular enclave running on the same platform. | ||
### `SecureWorker.unsealData([data:ArrayBuffer]) : ArrayBuffer` | ||
Decrypts a sealed/encrypted ArrayBuffer and returns the original decrypted information as an ArrayBuffer. | ||
### `crypto.subtle.*` | ||
@@ -293,4 +310,5 @@ | ||
## Credits | ||
node-secureworker was originally developed as part of the Luckychain project by Mitar Milutinovic and Warren He. You can find their original paper _"Proof of Luck: an Efficient Blockchain Consensus Protocol"_ on [arXiv](https://arxiv.org/abs/1703.05435). | ||
SecureWorker was originally developed as part of the [Luckychain project](https://github.com/luckychain/lucky) by Mitar Milutinovic and Warren He. See their whitepaper [Proof of Luck: an Efficient Blockchain Consensus Protocol](https://github.com/luckychain/lucky#whitepaper). | ||
## Examples | ||
@@ -297,0 +315,0 @@ |
@@ -112,1 +112,3 @@ var report = function (name) { | ||
}).then(passed("import scripts")).catch(report("import scripts")); | ||
// TODO: write tests for sealData and unsealData |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
12302089
0.01%8834
0.11%320
5.96%4
-20%