litentry / litentry-parachain

The Litentry parachain
https://docs.litentry.com
GNU General Public License v3.0
61 stars 20 forks source link

Move identity network type to IdentityContext #1841

Closed Kailai-Wang closed 1 year ago

Kailai-Wang commented 1 year ago

Context

Many blockchains "share" the same key pair construction mechanism, which means owning one private key would grant you access to the same public key or address on different networks.

Examples:

We had discussions about whether we should treat the same public key on different networks as distinct identities, the decision was yes at that time. Reasons include:

During the implementation of EVM-signin feature, we realised that we might be able to simplify this process - by moving the network type information away from Identity itself to IdentityContext.

Before:

pub enum Identity {
    Substrate { network: SubstrateNetwork, address: Address32 },
    Evm { network: EvmNetwork, address: Address20 },
    Web2 { network: Web2Network, address: IdentityString },
}

pub struct IdentityContext<T: Config> {
    // the sidechain block number at which the identity is linked
    pub link_block: BlockNumberOf<T>,
    // the identity status
    pub status: IdentityStatus,
}

After:

pub enum Identity {
        // web2
        Twitter(IdentityString),
        Discord(IdentityString),
        Github(IdentityString),
        // web3
    Substrate(Address32),
    Evm(Address20),

}

pub struct IdentityContext<T: Config> {
    // the sidechain block number at which the identity is linked
    pub link_block: BlockNumberOf<T>,
        // a list of networks on which this identity is used
        pub networks: Vec<Network>, 
    // the identity status
    pub status: IdentityStatus,
}

Rationale:

Proposal

Meanwhile, we want to maintain flexibility, and the user should still have complete control over things like identities on which network should take part in the assertion building.

While we don't distinguish network types when adding identities to IDGraph, sometime, somewhere, we need to ask the user: for which networks do you want your identities in IDGraph to be used? It can be 3 such moments:

  1. when the user links an identity
  2. when the user builds a VC
  3. somewhere in between

We propose a hybrid solution of 1 and 3.

Example:


:heavy_check_mark: Please set appropriate labels and assignees if applicable.

Teunhbrkn commented 1 year ago

Sounds good. The only thing that comes to mind is that there probably should be some logic to help a user automatically select the most relevant 'identity networks' when generating specific VC's.

Kailai-Wang commented 1 year ago

Sounds good. The only thing that comes to mind is that there probably should be some logic to help a user automatically select the most relevant 'identity networks' when generating specific VC's.

Thanks! Maybe we can warn the user from UI if the current active set is different from the "recommended" network setting of VC - but we should respect the user's choice if they stick to it

jonalvarezz commented 1 year ago

It sounds good to me overall.

From a user perspective, it will be the same as it currently is: Adding a new network requires signing a new transaction.

Let's just be aware that this involves new UI and UX scenarios we need to consider, thus, it delays delivery further.

Kailai-Wang commented 1 year ago

it will be the same as it currently is: Adding a new network requires signing a new transaction

A bit better :) changing network does require a new tx or DI request, but not a second signature (since we don't have to validate it again).

We also hope in most cases people don't have to change it because we'll going to have network filter on VC level, like "the number of governance activities over the following networks: litentry, phala, bifrost"

jonalvarezz commented 1 year ago

changing network does require a new tx or DI request, but not a second signature

Awesome! out of curiosity: how do you validate the request comes from the owner of the account?

Kailai-Wang commented 1 year ago

how do you validate the request comes from the owner of the account?

I don't quite get the question - it's the same way as before. What I was trying to say is that linking the identity with network information would require an extra signature (for validataion_data) each time

Kailai-Wang commented 1 year ago

I've fixed the Before and After code example a little, as web2 identities inevitably need the network information :)

hanwencheng commented 1 year ago

Looks good to me, thanks for the proposal, have one question,

In After data structure, what will change if a user decide to unlink one identity?

Kailai-Wang commented 1 year ago

Looks good to me, thanks for the proposal, have one question,

In After data structure, what will change if a user decide to unlink one identity?

The user won't be able to unlink the identity according to the previous EVM-signin proposal They can:

hanwencheng commented 1 year ago

OK, so the IdentityStatus record all of the changes

ghost commented 1 year ago

Screenshot 2023-07-06 at 19 01 13 Screenshot 2023-07-06 at 19 01 04 Screenshot 2023-07-06 at 19 00 33 Screenshot 2023-07-06 at 19 00 18 Screenshot 2023-07-06 at 18 59 24

ghost commented 1 year ago

Sorry for the dump. We have taken into consideration few cases and tried to see how it potentially could look like.

As an advocate of UX from a user POV this feature of selecting network should be "advanced" Therefore making it as a default to select main networks and you could "opt out" if you want to.

Also we don't need to support all the variables from a day one. Let's have the ideal user scenario first and then slowly add those extra features.