GoogleSheet-password-manager

GoogleSheet-password-manager

Password manager on Google Sheets that can save passwords encrypted with a shared secret key. Encryption is done on the client side.

Let’s get started Step 1 - Create a Google Sheet This could be the simplest of them all. Simply start a new Google Sheet. Start a fresh blank spreadsheet at Google Sheet

Step 2 - Add header row

Create the header row for the columns. The headings should be:

Name
URL
Username
Password

These columns in each row will be managed by our script. You can also make the header row bold and freeze it.

You can name the sheet as you wish.

image.png

Step 3 - Open the script editor

Next step is to open the script editor where we will write the code required for our tool.

Click on Tools -> Script Editor on the menu bar. This will open up the script editor in a new tab.

image.png

Give the script an appropriate name. This script is linked to the sheet now. All changes saved here will be available later also.

Step 4 - Create files

I have open sourced the code required for the tool at My GitHub page . You can copy the script files one by one to the script editor window.

Code.gs is the main Apps script file. All functions that interact with the Google Sheets are written here. You can remove the function that is already present in the editor. Once pasted, press Ctrl+S to save.

image.png

Next, create a new file called newEntry.html by going to the File -> New -> HTML File menu. Remove the existing HTML and add code from newEntry.html. Press Ctrl+S to save.

image.png

Similarly, create new files and copy contents from decryptPassword.html and styles.html. styles.html.

We have the following files in our script editor now:

Code.gs
newEntry.html
decryptPassword.html
styles.html

Step 5 - Run the script

Open Code.gs and use the Select function drop down on the toolbar to select the onOpen function. This function is executed every time the the Google Sheet is opened. Click on the Run button (play icon) next to the drop down to run the function. image.png

You will now be prompted to grant permissions for the script to access the sheet. If you get a “This app isn’t verified” screen, you can safely over-ride by clicking the “Advanced” link at the bottom as you’re the developer for the app (since you just copy pasted the code).

I’m not saying copy pasting the code is safe, I am assuming you can go through couple of lines of code and figure out if it’s doing something fishy.

Once you allow the permission request and the function is ran (you might need to click the Run button agian), a new menu item will appear on the Sheet.

image.png

Step 6 - Add a password

Let’s save a password now. Click on Password Manager -> Add new password. This will open a new dialog box with several input fields.

Name: Name of the website that you’re adding.
URL: Login URL for the website.
Username
Password
Shared secret: This is the key used to encrypt the password, you’ll need this key to decrypt it later.
Re-type shared secret: This is to avoid any typing errors as the input is a password field.

image.png

Once all entries are added, click on the Save button.

If there are no errors, the password is encrypted with the secret key (shared secret) and is saved into the sheet.

Encryption happens on the browser. Raw password is not sent to the Sheet.

The password is encrypted using SJCL and upon encrypting a string with a key, it outputs a JSON object:

{

"iv": "YfYlmYRzJBfo0xFGUNQ8Fg==",
"v": 1,
"iter": 10000,
"ks": 128,
"ts": 64,
"mode": "ccm",
"adata": "",
"cipher": "aes",
"salt": "s0McGyx/dmQ=",
"ct": "Xit1P9/DeedTmGf3WZBT4V+HNHIM3jtV0K8="
}

This object is base64 encoded and saved into the password column.

image.png

Each entry can have a different shared secret.

Because each entry can have a different shared secret, you can safely share this across your team and only those who you communicate the shared secret will be able to decrypt the corresponding password. You can also choose to have a common shared secret for team-wide sharing.

Step 7 - Decrypt a password

To decrypt a password, bring the focus to any column in the target row and then click on Password Manager -> Decrypt password menu. This will open up the decrypt password dialog box. Enter the shared secret and click the Decrypt button.

This will reveal the decrypted password in the textbox. You can click the Copy to Clipboard button if you need to copy the password.

image.png

Feedback

The project is open source at github.com/okramjimmysingh . Looking forward for your suggestions and contributions.

Buy me a coffee here Buy Me A Coffee