From 1390496c5862cfa3ffc21a04038ad768901b0ee1 Mon Sep 17 00:00:00 2001 From: Toni Corvera Date: Fri, 3 May 2024 15:30:02 +0200 Subject: [PATCH 1/3] Expand API token documentation. Takes queues from #104. --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 38c0a05..cffae93 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ There are different options for using this script. - Click on [![Deploy](https://www.herokucdn.com/deploy/button.svg)][heroku] - Login to Heroku if not already happened - Provide proper values for the `environment variables` -- **Important: make sure that yor Nightscout API token is hashed with SHA1** +- **Important: make sure that yor Nightscout API token is [hashed with SHA1](#hashing-api-token)** - Click `Deploy` to deploy the app ### Variant 2: Local @@ -95,6 +95,22 @@ services: LOG_LEVEL: "info" ``` +### Hashing API token + +`NIGHTSCOUT_API_TOKEN` must be a SHA1 hash of an Access Token from Nightscout (_Add new subject_ first in Nightscout's _Admin Tools_ if required), e.g. your Access Token for a subject named _LibreLinkUp_ might be `librelinku-123456789abcde`. + +Obtain your hash with + +```shell +echo -n "librelinku-123456789abcde" | sha1sum | cut -d ' ' -f 1 +``` +(use `shasum` instead of `sha1sum` on Mac) + +which will print the hash (40 characters in length): +``` +14c779d01a34ad1337ab59c2168e31b141eb2de6 +``` + ## ToDo - **Integration into Nightscout**: I have not yet looked into the plugin architecture of Nightscout. Maybe this should From b720957e09a5a359afba931c96de706b377d1c86 Mon Sep 17 00:00:00 2001 From: Toni Corvera Date: Fri, 3 May 2024 15:21:43 +0200 Subject: [PATCH 2/3] Improve coherence of examples. Completes #104. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cffae93..58ec429 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ docker run -e LINK_UP_USERNAME="mail@example.com" \ -e LINK_UP_TIME_INTERVAL="5" \ -e LINK_UP_REGION="EU" \ -e NIGHTSCOUT_URL="nightscout.yourdomain.com" \ - -e NIGHTSCOUT_API_TOKEN="librelinku-123456789abcde" \ + -e NIGHTSCOUT_API_TOKEN=$(echo -n "foo-bar-baz" | sha1sum | cut -d ' ' -f 1) \ -e LOG_LEVEL="info" \ timoschlueter/nightscout-librelink-up ``` @@ -91,7 +91,7 @@ services: LINK_UP_TIME_INTERVAL: "5" LINK_UP_REGION: "DE" NIGHTSCOUT_URL: "nightscout.yourdomain.com" - NIGHTSCOUT_API_TOKEN: "librelinku-123456789abcde" + NIGHTSCOUT_API_TOKEN: "14c779d01a34ad1337ab59c2168e31b141eb2de6" LOG_LEVEL: "info" ``` From 94b2585304d4855a1fda264dccef06f526ced5ab Mon Sep 17 00:00:00 2001 From: Toni Corvera Date: Fri, 3 May 2024 15:21:19 +0200 Subject: [PATCH 3/3] Add link to online SHA1 generator. URL taken from #113. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 58ec429..adbeb6b 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,8 @@ which will print the hash (40 characters in length): 14c779d01a34ad1337ab59c2168e31b141eb2de6 ``` +You might also use an online tool to generate your hash, e.g. https://codebeautify.org/sha1-hash-generator + ## ToDo - **Integration into Nightscout**: I have not yet looked into the plugin architecture of Nightscout. Maybe this should