Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8cc1df9
Removed all node_modules from being using in the webpack version. Thi…
oparkins Oct 9, 2019
a984e26
Fixed spelling mistake in Makefile
oparkins Oct 9, 2019
69cc3b7
Updated travis ci to use trusty
oparkins Oct 9, 2019
6d03db7
Working on fixing travis ci
oparkins Oct 9, 2019
1cd3a57
feat: Added initial CRUD interface to the RGPM file. This closes issu…
oparkins Oct 12, 2019
e1cb52e
feat: Added rgpm/storage-integrations as a dependency
oparkins Oct 12, 2019
5f4f251
Bump handlebars from 4.2.0 to 4.5.3
dependabot[bot] Dec 28, 2019
cea031f
Merge remote-tracking branch 'origin/dependabot/npm_and_yarn/handleba…
oparkins Dec 28, 2019
a644381
chore: Updated all dependencies
oparkins Dec 28, 2019
c2efd6c
feat: Implemented null_concat function
oparkins Dec 28, 2019
a7d369e
test: moved null_concat testing to cryptoFactory tests
oparkins Dec 28, 2019
360f6a0
chore: Updated dependencies and configurations for CRUD operation imp…
oparkins Dec 29, 2019
c27f1e3
feat: Added storage decision in RGPM class
oparkins Dec 29, 2019
8b30b36
Added mapHashToPass and start of InitPass to rgpm
oparkins Dec 29, 2019
b99d3d6
Updated createRecord method to start reflecting required data for rec…
oparkins Dec 29, 2019
a93c2e7
Implemented more of initPass method
oparkins Dec 30, 2019
46f4f45
refactor: Moved verify method from crypto to rgpm
oparkins Dec 30, 2019
3456c57
feat: Implemented verify function
oparkins Dec 30, 2019
60e8a46
refactor: Changed for loop to make the body of the loop more readable
oparkins Dec 30, 2019
d771be8
feat: Implemented initPass method
oparkins Dec 30, 2019
a167aa1
refactor: changed the return types of the crytpo functions to better …
oparkins Dec 30, 2019
90be41f
fix: Updated and tested initPass.
oparkins Dec 30, 2019
ddeeb86
refactor: Changed null_concat to use Array.join method
oparkins Dec 30, 2019
e846a66
Added CRUD operations to records.
oparkins Jan 2, 2020
b79c0d4
Updated package name for publishing reasons
oparkins Jan 2, 2020
b98810f
feat: Added ability to list all records that have been created
oparkins Jan 4, 2020
175ee4b
v1.1.0
oparkins Jan 4, 2020
40c350b
refactor: added option to add iter_t value when creating record
oparkins Jan 7, 2020
bf95ba1
v1.2.0
oparkins Jan 7, 2020
1e5c6b3
refactor: fixed spelling mistake with genPass testing method
oparkins Jan 16, 2020
f05dcd5
fix: allowed for the initPass algorithm to not overwrite the revision…
oparkins Jan 16, 2020
f84c789
feat: added function to update record to next revision
oparkins Jan 16, 2020
9e4d966
fix: Fixed the dockerfile build errors due to base image changing inc…
oparkins Jan 17, 2020
009aa03
feat: added functions to deal with previous passwords and changing re…
oparkins Jan 17, 2020
75dab74
v1.3.0
oparkins Jan 17, 2020
9e4e232
feat: added ability to calculate the optimal iter_t value
oparkins Jan 17, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ language: minimal
services:
- docker

install:
- make

before_install:
- docker build . --tag rgpm
- make build

script:
- docker run --rm rgpm
- make test
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
FROM node:12-slim

RUN apt-get update && apt-get install -y wget gnupg2

# Install chrome for puppeteer tests
# From https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
Expand All @@ -24,7 +26,7 @@ RUN yarn install

COPY src /app/src/
COPY test /app/test/

RUN chown -R test:test ./
USER test

ENTRYPOINT ["yarn", "test"]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ clean:
rm -rf .build-tmp

clean-docker:
docker rmim rgpm:core-test
docker rmi rgpm:core-test

clean-all: clean clean-docker

Expand Down
20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"name": "rgpmcore",
"version": "1.0.0",
"name": "@rgpm/core",
"version": "1.3.0",
"main": "index.js",
"repository": "[email protected]:rgpm/core.git",
"author": "Kevin Schmittle <[email protected]>",
"license": "LGPL-3.0-only",
"devDependencies": {
"electron": "^4.1.3",
"electron": "^7.1.7",
"express": "^4.17.1",
"jest": "^24.9.0",
"jest-cli": "^24.9.0",
"jest-puppeteer": "^4.3.0",
"puppeteer": "^1.19.0",
"webpack": "^4.39.3",
"webpack-dev-middleware": "^3.7.1"
"jest-puppeteer": "^4.4.0",
"puppeteer": "^2.0.0",
"webpack": "^4.41.5",
"webpack-dev-middleware": "^3.7.2",
"webpack-node-externals": "^1.7.2"
},
"scripts": {
"serve": "node test/server.js",
"test": "jest"
},
"dependencies": {},
"jest": {
"projects": [
{
Expand All @@ -33,5 +33,9 @@
}
}
]
},
"dependencies": {
"@rgpm/storage-integrations": "^0.1.2",
"uuid": "^3.3.3"
}
}
10 changes: 4 additions & 6 deletions src/browserCrypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ class BrowserCrypto extends Crypto {
* https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest and
* adapted to not require the async keyword
* @param {string} input UTF-8 encoded string
* @returns {Array} The result of the hash
* @returns {ArrayBuffer} The result of the hash
*/
async digest(input) {
const msgUint8 = new TextEncoder().encode(input); // encode as (utf-8) Uint8Array
return await crypto.subtle.digest('sha-512', msgUint8).then(function(hashBuffer) { // hash the message
return Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array
return new Uint8Array(hashBuffer);
});
}

/**
* Generate keyed hash (HMAC-SHA512)
* @param {string} key The key to use
* @param {string} message The message to hash
* @returns {Array} The result of the hash
* @returns {ArrayBuffer} The result of the hash
*/
async hmac(key, message) {
// Create the key (https://github.com/danharper/hmac-examples#javascript-es6)
Expand All @@ -49,9 +49,7 @@ class BrowserCrypto extends Crypto {

// Sign the data with the key
return crypto.subtle.sign({ "name": "HMAC" }, cryptoKey, messageBytes).then(async function(hmac) {

//Return in a format consistent with everything else
return Array.from(new Uint8Array(hmac));
return new Uint8Array(hmac);
});
});
}
Expand Down
19 changes: 11 additions & 8 deletions src/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ class Crypto {
throw new NotImplementedError(`The method 'hmac' has not been implemented. This is more of an error of inproper subclassing.`);
}

null_concat() {
throw new NotImplementedError("null_concat has not been implemented yet");
}

verify() {
throw new NotImplementedError("verify has not been implemented yet");
/**
* The NULL-CONCAT(...) function returns a byte sequence created by
* concatenating its inputs with null bytes between, as done by Yee and
* Sitaker (2006). ~ Schmittle, 2018
* @param {Array} args A list of string arguments to concat together
* @returns {Array} The result of the concat operation as a string
*/
null_concat(... args) {
return args.join('\0');
}

/**
Expand All @@ -42,11 +45,11 @@ class Crypto {
/**
* Converts a buffer to the hex representation
* https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
* @param {Array} buffer
* @param {Uint8Array} buffer
* @returns {String} The hex representation
*/
toHex(buffer) {
return buffer.map(b => b.toString(16).padStart(2, '0')).join(''); // convert bytes to hex string
return Array.from(buffer).map(b => b.toString(16).padStart(2, '0')).join(''); // convert bytes to hex string
}
}

Expand Down
20 changes: 16 additions & 4 deletions src/nodeCrypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,36 @@ class NodeCrypto extends Crypto {
/**
* Generate the cryptographic hash (SHA512) of the input string
* @param {string} input UTF-8 encoded string
* @returns {Array} The result of the hash
* @returns {ArrayBuffer} The result of the hash
*/
async digest(input) {
const hash = this.crypto.createHash("sha512");
hash.update(input);
return Array.from(hash.digest());
return new Uint8Array(hash.digest());
}

/**
* Generate keyed hash (HMAC-SHA512)
* @param {string} key The key to use
* @param {string} message The message to hash
* @returns {Array} The result of the hash
* @returns {ArrayBuffer} The result of the hash
*/
async hmac(key, message) {
const hmac = this.crypto.createHmac('sha512', key)
hmac.update(message);
return Array.from(hmac.digest());
return new Uint8Array(hmac.digest());
}

/**
* Convert a buffer to an arraybuffer
* @param {Buffer} buf
*/
toArrayBuffer(buf) {
let ret = new ArrayBuffer(buf.length);
for(var i = 0; i < buf.length; i++) {
ret[i] = buf[i];
}
return ret;
}

/**
Expand Down
Loading