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

w3-accounts #12

Merged
merged 8 commits into from
Nov 30, 2022
Merged

w3-accounts #12

merged 8 commits into from
Nov 30, 2022

Conversation

Gozala
Copy link
Collaborator

@Gozala Gozala commented Nov 25, 2022

Wrote a specification for explaining accounts and how they correlate with spaces

Copy link
Contributor

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Good writing @Gozala ❤️

w3-account.md Outdated Show resolved Hide resolved
w3-account.md Outdated Show resolved Hide resolved
Co-authored-by: Vasco Santos <santos.vasco10@gmail.com>
w3-account.md Outdated

## Account

User account is a [principal][] identified by [`did:mailto`][] (listed in a UCAN's `iss` or `aud` field).
Copy link
Contributor

@gobengo gobengo Nov 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have this be did:mailto: and not mailto: ?

The former begs the question of how that did method works, i.e. how to create, read (resolve to did doc), update, and delete dids using that method. The spec for that seems to be a placeholder atm. Understandable, but still I'm struggling to imagine how exactly the read/resolve would work for a did:mailto.

Using just mailto: URIs would sidestep needing to define the did method, and in this spec or ucans, we could define processing rules however we want, all without needing to shoehorn in did semantics.

If we do really want to define/use a did:mailto, how would did resolution work (e.g. here is how did:dns resolution works)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have this be did:mailto: and not mailto: ?

Because principals in UCAN spec are DIDs, if they were arbitrary URIs than using just mailto: URI would have made a lot more sense. Perhaps we can work towards allowing UCANs to use arbitrary URIs in principals, but I would pursue that separately and then update to just mailto: as opposed to getting blocked on that.

If we do really want to define/use a did:mailto, how would did resolution work (e.g. here is how did:dns resolution works)

My plan had been do spec that out here https://github.com/ucan-wg/did-mailto, but I don't have bandwidth for that right now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to create, read (resolve to did doc), update, and delete dids using that method.

In nutshell, resolution schema is you send them an email asking what's their DID document and they respond you back with did:key corresponding to their document

}],
exp: null
sig: "..."
}
Copy link
Collaborator Author

@Gozala Gozala Nov 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example below illustrates did:dns:web3.storage = did:key:root allowing did:key:zJune to identify as did:dns:web3.storage as long as delegation is valid. This allows did:key:zJune to issue an outer UCAN and sign it with did:key:zJune, however it needs to provide proof of delegation from did:key:root authorizing it do it.

{
  iss: "did:dns:web3.storage",
  aud: "did:key:someone",
  // Delegates some capability to the did:dns:web3.storage resource.
  // Capability is not really important, it's just that it CAN delegate capability for `did:dns:web3.storage`
  att: [{ can: "inbox/add", with: "did:dns:web3.storage" }],

  sig: "..." // <- signed with did:key:zJune because proof above
  // 👇 proof that did:key:zJune could issue ucan on behalf of did:dns:web3.storage
  prf: [{
    iss: "did:dns:web3.storage", // <- Maybe this should be did:key:root here
    aud: "did:dns:web3.storage", // <- delegating to did:dns:web3.storage to align principals
    // Says that UCAN's issued by `did:dns:web3.storage` may be signed by
    // did:key:zJune.
    // This basically says that did:key:zJune is a session key which expires in july
    att: [{
      with: "did:dns:web3.storage",
      can: "ucan/sign",
      nb: { as: "did:key:zJune" }
    }],
    exp: july,
    sig: "..." // <- Must be signed by the key did:dns:web3.storage resolves to
  }],
  exp: hour
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@expede can you please provide feedback on this

Copy link
Contributor

@gobengo gobengo Nov 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Gozala wrt send/message, that's new right? I notice that it is of the form verb/noun whereas most of the time our caps name convention is more like noun/verb

Copy link
Collaborator Author

@Gozala Gozala Nov 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah just ignore this, I was sketching this while speaking to @expede over the call so it's pretty sloppy and out of the context here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @expede have you had a chance to consider this ? In our call, I believe you said you were ok with general idea, yet wanted to ponder more about actual representation

Copy link

@expede expede Nov 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the post-merge feedback @Gozala !

wrt send/message, that's new right? I notice that it is of the form verb/noun whereas most of the time our caps name convention is more like noun/verb

@gobengo I've been thinking about this in a UCAN "standard library" as msg/send, which cuts across email, text messaging, message passing, etc etc.

iss: "did:dns:web3.storage", // <- Maybe this should be did:key:root here
aud: "did:dns:web3.storage",

I continue to find iss == aud deeply strange. I agree with your comment "Maybe this should be did:key:root here".

Rather than granting the ability to sign "as" another DID, I think it's cleaner to make this a "forwarding edge", which follows much more the capabilities worldview. I think that the end result is the same, so it's just naming.

Time 1: carol --[fwd_all]--> dan
Time 2: alice --[can: foo]--> bob --[can: foo]--> carol
Time 3: dan --[can: foo]--> frank

BECAUSE we can substitute a link:

alice --[can: foo]--> bob --[can: foo]--> carol
                                            |
                                        [fwd_all]
                                            |
                                            V
                                           dan --[can: foo]--> frank

End result: Frank can use Alice's foo

This is kind of like "signing as" Carol, but it's only at the level of authority, not identity. Alice saying "you can sign as Bob" is going to get really confusing unless you want to do DID management, which IMO should be at a DID layer. I think you can manage all of this cleanly at the layer of capabilities.

This is a powerful enough feature that has enough uses that I propose that we add this as a first-class feature to UCAN at some stage. In the meantime, I propose that we call this something other than "signing as".

Here's some delegations in this model:

w3s --[fwd_all]--> didJune
w3s --[fwd_all]--> didJuly
w3s --[fwd_all]--> didAug



## Super simple case, nothing unusual ##

w3s --[fwd_all]--> didJune --[w3s's foo]--> alice



## More complex case with new forwarding concept ##

bob --[bob's bar]--> w3s
                      |
                   [fwd_all]
                      |
                      V
                   didJune --[bob's bar]--> carol

Here's that last one concretely:

{
  iss: "did:key:june",
  aud: "did:key:carol",
  att: [{ can: "thing/doSomthing", with: "resource://example.com" }],
  sig: "...",
  prf: [
    {
      iss: "did:key:zBob",
      aud: "did:dns:web3.storage",
      att: [{
        with: "resource://exmaple.com",
        can: "thing/doSomething"
      }],
      exp: august2022,
      sig: "..."
    },
    {
      iss: "did:dns:web3.storage",
      aud: "did:key:june",
      att: [{
        with: "did:dns:web3.storage",
        can: "ucan/forward_all" // we can come up with a better label
      }],
      exp: november2022,
      sig: "..."
    }
  ]
}

w3-account.md Outdated Show resolved Hide resolved
w3-account.md Outdated Show resolved Hide resolved
w3-account.md Outdated
```ts
{
iss: "did:key:zAgent",
aud: "did:dns:web3.storage",
Copy link
Contributor

@gobengo gobengo Nov 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seem to recall somewhere you were deciding between whether to use did:dns or did:web. Where did that land?

One tradeoff that comes to mind is that updates to did:dns may be more eventually consistent (because ttls), whereas did:web might give us more predictability about how fast we can expect updates to propagate.

Another tradeoff though is did:web requires an ssl cert and tcp socket. So that may be more overhead than we want.

So for my edification: Why did you choose did:dns and not did:web?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General idea is agnostic of choice between did:dns and did:web we could choose one that makes most sense or both. That said I think did:web is probably a going to be a better choice however

@gobengo
Copy link
Contributor

gobengo commented Nov 28, 2022

I think it would be helpful to have something like a sequence diagram explaining how the capabilities specified here would be used together to accomplish a use case.

@Gozala
Copy link
Collaborator Author

Gozala commented Nov 29, 2022

Refactored document a bit to align spec with user flow. Added a sequence diagram to illustrate the user flow

@gobengo
Copy link
Contributor

gobengo commented Nov 29, 2022

Refactored document a bit to align spec with user flow. Added a sequence diagram to illustrate the user flow

@Gozala nice ty. any objection if at some point later I try to rewrite it as a mermaidjs sequence diagram so it's prettier? https://mermaid-js.github.io/mermaid/#/sequenceDiagram

  • will be post-merge as its a stylistic improvement only

@Gozala
Copy link
Collaborator Author

Gozala commented Nov 30, 2022

@Gozala nice ty. any objection if at some point later I try to rewrite it as a mermaidjs sequence diagram so it's prettier? https://mermaid-js.github.io/mermaid/#/sequenceDiagram

I'd be delighted if you do

aud: "did:dns:web3.storage",
att: [{
with: "did:key:zAgent",
can: "ucan/issue",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could it be like recovery/authorize-email-resovery? If not rename, am I at least understanding it right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more like user/login

@Gozala Gozala merged commit 83916d1 into main Nov 30, 2022
@Gozala Gozala mentioned this pull request Nov 30, 2022
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

Successfully merging this pull request may close these issues.

4 participants