X-Git-Url: https://git.kengrimes.com/?p=henge%2Fkiak.git;a=blobdiff_plain;f=old%2Fbootstrap.js;fp=old%2Fbootstrap.js;h=07579084f3740ef1dc9d74c752d5af2cfc22f580;hp=0000000000000000000000000000000000000000;hb=552b28b4fc1ed42e3362c1826acf94c349425b1c;hpb=a7e6c36b91dd1a36021f7459200436b3cb31d756 diff --git a/old/bootstrap.js b/old/bootstrap.js new file mode 100644 index 0000000..0757908 --- /dev/null +++ b/old/bootstrap.js @@ -0,0 +1,50 @@ +/** + * @file Bootstrapping API + * @author Jordan Lavatai and Ken Grimes + * @version 0.0.1 + * @license AGPL-3.0 + * @copyright Strapp.io + */ + +import fs from "strappfileManager" + +/** @func Returns public key for the user + * @desc Attempts to find a stored key. If unsucessful, ask user for key. If user + * doesn't have a key, generates a key + * @dependencies keyManager, fileSystem + * @options specif + * @return {Object} cryptoKey object + */ +function resolveKey() { + return new Promise( (resolve, reject) => { + /* See if publicKey has been generated before */ + const publicKey = fs.strappID + if (publicKey === '') { + resolve(generateKey()) + } + else { + resolve(publicKey) + } + }) +} + +/* Init FileSystem */ +fs.initFileSystem() + +/* Find or generate key */ +let key = resolveKey() + +/* Auth */ +/* Authorization-header: Strapp pubkey (no answer)*/ +/* Determine answer, add answer to "." */ + + +/* Setup hardcoded files e.g. "..", ".", "accounts", "ice", "sdp", "log", "run" */ +/* Add the files to the filesystem only if they dont already exist /* + +/* Connect to host */ + + + + +