2 * @file Bootstrapping API
3 * @author Jordan Lavatai and Ken Grimes
9 import fs
from "strappfileManager"
11 /** @func Returns public key for the user
12 * @desc Attempts to find a stored key. If unsucessful, ask user for key. If user
13 * doesn't have a key, generates a key
14 * @dependencies keyManager, fileSystem
16 * @return {Object} cryptoKey object
18 function resolveKey() {
19 return new Promise( (resolve
, reject
) => {
20 /* See if publicKey has been generated before */
21 const publicKey
= fs
.strappID
22 if (publicKey
=== '') {
23 resolve(generateKey())
34 /* Find or generate key */
35 let key
= resolveKey()
38 /* Authorization-header: Strapp pubkey (no answer)*/
39 /* Determine answer, add answer to "." */
42 /* Setup hardcoded files e.g. "..", ".", "accounts", "ice", "sdp", "log", "run" */
43 /* Add the files to the filesystem only if they dont already exist /*