Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to extend AccountInfo ContractState #77

Open
cmaliwal opened this issue Nov 14, 2019 · 7 comments
Open

How to extend AccountInfo ContractState #77

cmaliwal opened this issue Nov 14, 2019 · 7 comments

Comments

@cmaliwal
Copy link

I have a use case where each account would have some extra details like First Name, Last Name, Email etc.
I noticed that your library creates AccountInfo State which is accessible by all accounts on the same node. So, can we extend AccountInfo such it can store custom fields along with name, host and identifier?
Also, is it wise to create another State to store user information and share it with all the other accounts on the same node?

@roger-that-dev
Copy link

AccountInfo is not currently extendable but perhaps it could be in the future. Reason being is that it's usually not a good idea to put personal information about account holders on the ledger. There are a number of options you have:

  1. Store the user information off-ledger in a series of Hibernate entities. You can join this data to the associated account using the account ID (externalId)
  2. Create a series of state objects for holding this data (name, email, etc.) and link them to the account info by including the AccountInfo as a reference state in the transactions which create the data states.

@manjeet-thadani
Copy link

How Accounts authenticate a request i.e. how to ensure that the user that is invoking the Flow is a correct person?
In the current implementation, this library just requires UUID of account to perform the transaction. So, if any other account has my accountId then he can perform operations on my behalf?. Also, I noticed that AccountInfo (name, host, accountId) is/should be public at the network level (to know all available accounts across nodes).

So, How this implementation ensures that the invoker of the Flow is an authenticated account?

@manosbatsis
Copy link

manosbatsis commented Dec 21, 2020

@roger3cev this is what we're after as well in a project currently, but the CreateAccount flow doesn't allow setting an (optional) externalId. Also the field is not available for queries in PersistentAccountInfo. Does it make sense for me to make a (backwards compatible) PR for this?

@mevir
Copy link

mevir commented Dec 21, 2020

@manosbatsis I use the name property of the AccountInfo state each time I need an external identifier for the account (actually I couldn't find any other utility for this property :D ) - maybe it fits your use case also ...

@manosbatsis
Copy link

@mevir that won't work for me - need the name for a human-readable handle, which is why i'm after a more accessible externalId as a business key.

@mevir
Copy link

mevir commented Dec 21, 2020

@manosbatsis well, the name must be unique at the node level. If you want to use something like firstName lastName as a human-readable handle the probability of collisions is high.
Also take care of personal data - if the owner of the account is a EU citizen he has the right to be forgotten under GDPR - I don't know how this can be handled as long as the AccountInfo state can be shared freely with other nodes - is there is a tracking for this?

@manosbatsis
Copy link

@mevir our use-cases are more about agents like services or legal entities VS persons, where having both an external business key as externalId along with a (unique) human readable name is very convenient. PR #105 allows the typical LinearState.linearId.externalId approach with AccountInfo.

Indeed user accounts need more careful consideration; i believe even usernames are borderline GDPR-wise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants