/spreadsheets/d/
and /edit
(note: without the '/'s). It will be ~44 characters including numbers, letters and underscores. This is the SPREADSHEET_ID
configuration variable, we'll need it later.SUBMIT_URL
config variable, we'll need it later.openssl genrsa -out rsa_2048_priv.pem 2048
openssl rsa -pubout -in rsa_2048_priv.pem -out rsa_2048_pub.pem
npm install
if you haven't done so to load the node/webpack modules.rsa_2048_pub.pem
. This is PUBLIC_KEY_FILE
in the config. We now have three variables to input to our build command. Run the following command all on one line:
SPREADSHEET_ID=<YOUR SPREADSHEET_ID> SUBMIT_URL=<YOUR SUBMIT_URL> PUBLIC_KEY_FILE=<RELATIVE PATH TO PUBLIC_KEY> ./node_modules/.bin/webpack
ONLY if you are on the laptop with the private key, then you should also include PRIVATE_KEY_FILE=./rsa_2048_priv.pem
just after the public key file variable is set.
Example of what the full command might look like:
SPREADSHEET_ID=20L466aa6uYM_YSbezDI0lkrXduKtB6eaM4YXSGJ7w78 SUBMIT_URL=https://script.google.com/macros/s/AKfycaz7sP8Gkr7xD7AGZSJUnOtrVi2vwxbgUFl05RAX4WqFUhH9dVI/exec PUBLIC_KEY_FILE=./rsa_2048_pub.pem PRIVATE_KEY_FILE=./rsa_2048_priv.pem ./node_modules/.bin/webpack
dist/
./dist/encrypt/Code.gs
to the Google Script Editor (Tools -> ScriptEditor)
./dist/encrypt/index.html
to your user-facing website. If you are using a form generated from a CMS or platform like Squarespace, copy the javascript in ./dist/encrypt/main.js
and paste it inline below the form contentsFor a quick startup,
python -m SimpleHTTPServer
from this directory.
When you have made changes, run webpack
(possibly as ./node_modules/.bin/webpack
)
which deploys changes in ./src to ./dist however the project tracks the ./testdist directory
There are some important environment variables that control webpack's build.
Webpacked config still uses some 'old-modern' javascript browser features. This project targets compatibility with Internet Explorer 10+
Features used for the encrypt part:
Features avoided:
Both the PRIVATE_KEY_FILE and PUBLIC_KEY_FILE can support multiple keys.
For the PRIVATE_KEY_FILE, just append the keys together (leaving the begin/end ------BEGIN RSA.....----
lines in).
For the PUBLIC_KEY_FILE, the first key is the default. After that, subsequent keys should be prefixed with a line like
OPTION=State:CA
Which means if someone fills in field with name="State" and the value is "CA" then we should use this public key.