Skip to content

Commit

Permalink
Finalized v0.1 (#8)
Browse files Browse the repository at this point in the history
* Removed encrypted keyring

* Finalised v0.1
  • Loading branch information
vishalkrishnads authored Jul 31, 2023
1 parent a83a47c commit 889a733
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,13 @@ The first thing that you have to do is to set up and test run the software to se
3. Install all the required modules

```bash
$ pip install -r requirements.txt
$ sudo pip3 install -r requirements.txt # make sure to run it as root
```

Now, test whether all the imports are working fine.

```bash
$ sudo __tests__/check.py # again run as root
```

4. Run the script as root from the command line itself after connecting the OBD adapter to a car.
Expand Down
7 changes: 7 additions & 0 deletions __tests__/check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
try:
import obd, pynmea2, qrcode, pyserial, requests, websockets, qrcode
print("You're good to go! All modules have been installed and appear to be working fine...")
except Exception as e:
print("Some modules couldn't be imported. This is what the Python interpreter has to say...\n")
print(e)
print("\nYou have to fix this error before continuing...\nTry running sudo pip install -r requirements.txt instead of pip3.\nIf it persists, please open a detailed issue at https://github.com/alpaDrive/vehicle/issues.")
9 changes: 1 addition & 8 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@ def power_check():
def register():
company = input("Enter the brand/make of this car >> ")
model = input("Enter the model/name of this car >> ")
encrypt = False
should_encrypt = input("Do you want to have encrypted credentials in this device? (y/Y) >> ")
if should_encrypt.lower() == 'y':
print("Encryption will be enabled. You will be prompted to enter a keyring password later on.")
encrypt = True
else:
print("Encryption will stay disabled.")
payload = {
"company": company,
"model": model
Expand All @@ -38,7 +31,7 @@ def register():
initial: True
}))
print("\nOpen the mobile app & scan this QR code to pair. This is a one time use code. If you want to share this vehicle, use the share option in the app instead.")
auth.set_creds(creds, encrypt)
auth.set_creds(creds)

def get_message(message, vid, mode='broadcast', conn_id="", status="success", attachments=[]):
# Create message in standard format
Expand Down
9 changes: 4 additions & 5 deletions utils/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
import keyring.backend
from keyrings.alt.file import PlaintextKeyring

# We can't use the default encrypted backend as that keeps asking for an encryption password in the console
# which is not viable for simplicity to the end user. ofc this is the same as using a text file but :(
keyring.set_keyring(PlaintextKeyring())

def is_authenticated():
return keyring.get_password("alpaDrive", "vehicle") is not None

Expand All @@ -15,9 +19,4 @@ def get_creds():
return creds if creds is not None else ""

def set_creds(value, encrypt=False):
if encrypt:
# We can't use the default encrypted backend as that keeps asking for an encryption password in the console
# which is not viable for simplicity to the end user. ofc this is the same as using a text file but :(
keyring.set_keyring(PlaintextKeyring())

keyring.set_password("alpaDrive", "vehicle", value)

0 comments on commit 889a733

Please sign in to comment.