#[CLOSED] How to save important data in a user database

65 messages · Page 1 of 1 (latest)

sharp zenith
#

How to have important data encrypted and only that user can use it so when a database leaks the cannot access it through appwrite

wheat sphinx
#

Good question.

You can have a custom appwrite function run whenever a document is created in the user collection, which uses some sort of hashing algorithm to mask the data.

#

How you would store the hash and salt is a different story, because if the database get's leaked, then it's likely that the hash and salt stored in a db will also be exposed.

#

That being said, it's not impossible, just requires a lot of thought.

sharp zenith
sharp zenith
#

And then I can use some kind of appwrite function right?

stuck radish
#

You could create some kind of symmetrical encryption using some password, however that should be done client-sided

sharp zenith
stuck radish
#

It's not too recommended encrypting and decrypting all data mainly server-side because:

  1. Making that server-sided will probably not solve anything, data could be leaked anyways
  2. Everything will get slower
stuck radish
#

However such password could be leaked if any other app in the phone has access, like tokens

sharp zenith
#

hmm, yeah well then the will need to have the leaked database for example and get everyone's their password

#

so thats pretty hard ig

#

But how would I save those hash keys because I would need to save them in a new collection. But is it possible to have it when you create or delete a account it will create a new user in that database so have it linked?

#

Because I havent figured out how that works I saw something about functions but I am totally new to that

stuck radish
#

You don't need to save anything in appwrite, as said before, everything is done client-sided

#

Or at least if you don't want really high costs

sharp zenith
#

Its self hosted happi (VPS)

#

But if I want that for instance how would I do that?

#

So I can save some things aswell for that specific user that arent as important

wheat sphinx
#

Mind if I ask what your use case is @sharp zenith?

#

Not saying encryption is bad, but too much encryption can lead to slower speeds.

sharp zenith
wheat sphinx
#

Okay

sharp zenith
#

So when the refresh the still have

wheat sphinx
#

In that case, mind if I ask why you want to encrypt such data?

sharp zenith
wheat sphinx
#

Cuz it seems a little too overkill 😅

wheat sphinx
#

look encryption in general needs to be handled with care. As @stuck radish said, client-side encryption is a good idea, but it might slow things down in terms of UX.

#

encrypting and decrypting takes time, and sometimes a lot of resources.

sharp zenith
#

Yeah

stuck radish
#

More compute = more costs

#

Note that for Hackathon you need to use cloud (just in case you're participating)

#

WhatsApp for example handles most things related to encryption client sided. Telegram uses another asymmetric encryption system that needs more computational effort server-sided

sharp zenith
#

And this can be done through a appwrite function?

stuck radish
#

Maybe, but as said, not recommended

#

For not saying it's not recommended encrypting the database itself

sharp zenith
#

for functions

stuck radish
#

I think there's not any bug, It seems to be correct

sharp zenith
#

Only deletion is triggered but when I register it doesnt start the function

#

so a create user event

stuck radish
#

Note that things like functions variable are encrypted

#

Because that's the only thing needed to be encrypted most cases

stuck radish
#

You didn't have selected it

sharp zenith
#

it says user.*.create

stuck radish
#

The screenshot doesn't seems to show create

sharp zenith
#

Its not triggered

stuck radish
#

This should trigger 🤔

#

Unless OAuth, I think

#

(Login with third party)

sharp zenith
#

I used email

#

or does it be like this

#

let me try this

#

nope

sharp zenith
stuck radish
#

Not sure about that, if possible, please, create another post for this issue, in order to separate different topics 😅