HCGateway icon indicating copy to clipboard operation
HCGateway copied to clipboard

Would love to help you

Open KShivendu opened this issue 2 years ago • 3 comments

Hi Shuchir, I was looking for something like this and found that you're working on this. I'd love to help you out in any way possible. I have limited experience with android/mobile dev but have good experience with the backend.

Let me know if we can collaborate in any way :)

KShivendu avatar Aug 25 '23 17:08 KShivendu

Hi Kumar!

Right now I'm working on adding two-way support- being able to add records alongside being able to read them. Feel free to make a PR with any updates to this! The database schema is in the readme, and the library that is being used for health-connect on the companion app is react-native-health-connect

CoolCoderSJ avatar Aug 25 '23 20:08 CoolCoderSJ

I self hosted the server with my own appwrite project. But looks like the data is encrypted:

Example:

gAAAAABk6PtUYX3kQy37vlgcU7zaWSBvWPALTNt9QK2DPodsZWNrPqA5I4_T_QPt1zW1_7xg8TvQsdDTgast91yw-NTXisV8vWkwSwf3TBcnu0-0RvroNZZg2jhMkbpmd7ODmelUV2qRjsSGiQ1n0Vz7a-d5yromd-Ke7QEuzb4moQ71qKZ6b9qTgn3J8dOlQCeLhyxdJdYgNQ235cpDEE-V1psfb43Vlg==

Any idea how to decrypt/decode this? It's not b64 (judging base on https://www.base64decode.org/)

KShivendu avatar Aug 26 '23 09:08 KShivendu

sorry for the late reply but this should work-

from appwrite.client import Client
from appwrite.query import Query
from appwrite.services.users import Users

from cryptography.fernet import Fernet
import base64

client = (Client()
    .set_endpoint(f'{os.environ["APPWRITE_HOST"]}/v1') 
    .set_project(os.environ['APPWRITE_ID'])               
    .set_key(os.environ['APPWRITE_KEY']))   
users = Users(client)

username = "ENTER_HERE"
allusers = users.list(queries=[Query.equal('name', username)])['users']
user = allusers[0]

hashed_password = user['password']
key = base64.urlsafe_b64encode(hashed_password.encode("utf-8").ljust(32)[:32])
fernet = Fernet(key)

decrypted_data = fernet.decrypt(data.encode()).decode()

where data is that string and decrypted_data is the result

CoolCoderSJ avatar Aug 30 '23 09:08 CoolCoderSJ