Irakli Gozalishvili
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # User Accounts ![status:wip](https://img.shields.io/badge/status-wip-orange.svg?style=flat-square) [![hackmd-github-sync-badge](https://hackmd.io/8NywALT8Qp-cf0MSugZMDw/badge)](https://hackmd.io/8NywALT8Qp-cf0MSugZMDw) ## Editors - [Irakli Gozalishvili](https://github.com/Gozala), [DAG House](https://dag.house/) ## Authors - [Irakli Gozalishvili](https://github.com/Gozala), [DAG House](https://dag.house/) # Abstract In web3.storage we describe concept of an account as convenience for aggregating and managing capabilities across various user spaces under same identity, simplifying recovery and authorization flows. ## Language The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119](https://datatracker.ietf.org/doc/html/rfc2119). # Introduction ## Motivation In web3.storage users MAY create number of user spaces simply by generating asymmetric key pairs. User MAY also receive capability delegations from other user spaces. Managing these delegations and keypairs across multiple spaces, agents and devices can get complicated. To address this we propose a concept of an account, which is a [principal][] that can be delegated all relevant capabilities across various user spaces. We also propose account authorization flow that would allowing allow authorized agent to act on behalf of the account [principal][]. # Terminology ## Account User account is a [principal][] identified by [`did:mailto`][] identifier. :::info It MUST be a DID identifier as opposed to `mailto:` URI to be a valid prinicipal in the UCAN protocol. ::: ## Authorization User MAY authorize an agent to represent their account by delegating capabilities to it. However since right now we have no way of creating or resolving [`did:mailto`][] documents, there is no supported way to issue such a delegation. :::info In the future we intend to address this by implementing support for [ucan mailto][] specification. ::: To address this limitation service MUST provide `ucan/issue` capability, that user agent MAY invoke to get an authorization to act on behalf of the account. > Exmaple illustrates authorization request to represent `alice@web.mail` with `did:key:zAgent` agent from `web3.storage` ```ts { iss: "did:key:zAgent", aud: "did:dns:web3.storage", att: [{ with: "did:key:zAgent", can: "ucan/issue", nb: { as: "did:mailto:alice@web.mail" } }] } ``` #### issue `with` Resource MUST be a [`did:key`][] URI. It represents a public key that user wishes to use for signing UCANs issued by DID in the [`nb.as`][issue `as`] field. It SHOULD represent user agent DID. #### issue `as` Field MUST be a an account agent wishes to represent via [`did:key`][] in the [`with`][issue `with`] field . It MUST be a valid [`did:mailto`][] identifier ### Email validation Service MUST perform an out of bound email verification to ensure that user requesting authorization has access to the requestd email address. > For example, the service could send an email email with a link asking user to authorize an agent When link is clicked, agent will be delegated UCAN with requested authorization. On succesful verification service MUST delegate `ucan/sign` capability to the [`did:key`][]it was requested [`with`][issue `with`]. Delegation represents authorization to issue [UCAN][]s with [`did:mailto`] account prinicipal, which MAY be signed with [`did:key`] of the agent. ```ts { iss: "did:dns:web3.storage", aud: "did:mailto:alice@web.mail", att: [{ with: "did:dns:web3.storage", can: "ucan/sign", nb: { as: "did:key:zAgent" } }], exp: null sig: "..." } ``` #### sign `with` Authorization context, implying that this authorization MUST be considered valid by this recipient (`aud` matches this `with`). Other recipients MAY also recognize authorizations issued by trusted principals. #### sign `aud` Audience of the [UCAN][] MUST be [`did:mailto`][] identifier of the account principal. This ensures that [principal alignment] requirement can be met when authorization is used as proof by an account. #### sign `as` MUST be a [`did:key`][] of the principal which MAY sign [UCAN][]s issued by an account principal in [`aud`](#sign-aud). ### Authorization flow Below sequence diagram illustrates complete authorization flow as described above. ```sequence "👩‍💻 did:key:zAgent" -> "🌐 did:dns:web3.storage": "\n🎟\n{                              \n with: did:key:zAgent         \n can: ucan/issue              \n as: did:mailto:alice@web.mail\n}                              \n\n\n " "🌐 did:dns:web3.storage" -> "✉️ alice@web.mail": ✉️ Verification email "✉️ alice@web.mail" -> "🌐 did:dns:web3.storage": 🔗 Verify "🌐 did:dns:web3.storage" -> "👩‍💻 did:key:zAgent": "\n🎫\n{                             \n with: did:dns:web3.storage\n can: ucan/sign            \nas: did:key:zAgent       \n}                            \n\n " ``` ## Delegate Access When user agent creates a new space, it MAY delegate full or subset of the capabilities to desired account. This would allow user in different agent to reclaim delegated capabilities there. > Example below illustrates delegation of capabilities to `did:key:zAliceSpace` space to the user account `alice@web.mail` ```ts! { iss: "did:key:zAliceSpace", aud: "did:mailto:alice@web.mail", att: [{ with: "did:key:zAliceSpace", can: "*" }], exp: null, sig: "..." } ``` Agent MAY account delegation to a serivce so that it is persisted and can be retrieved later with a different agent. > Invokes `access/delegate` asking web3.storage to record delegation from `did:key:zAlice` space to the `alice@web.mail` account. ```ts { iss: "did:mailto:alice@web.mail", aud: "did:dns:web3.storage", att: [{ with: "did:mailto:web.mail", can: "access/delegate", nb: { ["bafy...prf1"]: {"/": "bafy...prf1"} } }], prf: [ // proof that did:key:zAgent may represent // did:mailto:alice@web.mail { iss: "did:dns:web3.storage", aud: "did:mailto:alice@web.mail", att: [{ with: "did:dns:web3.storage", can: "ucan/sign", nb: { as: "did:key:zAgent" } }], exp: null sig: "..." }, // bafy...prf1 referenced in the delegation allowing // account to access space { iss: "did:key:zAliceSpace", aud: "did:mailto:alice@web.mail", att: [{ with: "did:key:zAliceSpace", can: "*" }], exp: null, sig: "..." } ], sig: "..." } ``` :::warning [Recipient validation][] requires wrapping actual delegation(s) in a `access/delegate` invocation. In the future we may hope to remove wrapping requirement. ::: #### delegate `with` Field MUST be [`did:mailto`][] identifier of the account to which capabilities are been delegated. #### delegate `nb` Field is a set of delegation links encoded as JSON where keys are CID strings of the values. ## Claim Access When user is [authorizing][authorization] new agent, service MAY include all the valid _(not yet expired or revoked)_ delegations with an authorization proof, which will give agent access to all of the capabilities across all the spaces. However user may also add new delegations on one device and expect to have access to them on another device without having having to go through another email [authorization][] flow. To address this service MUST provide `access/claim` capability, which agent MAY invoke to collect (new) delegations for the account ```ts! { iss: "did:mailto:alice@web.mail", aud: "did:dns:web3.storage", att: [{ with: "did:mailto:alice@web.mail", can: "access/claim" }], prf: [ // proof that did:key:zAgent may represent // did:mailto:alice@web.mail { iss: "did:dns:web3.storage", aud: "did:mailto:alice@web.mail", att: [{ with: "did:dns:web3.storage", can: "ucan/sign", nb: { as: "did:key:zAgent" } }], exp: null sig: "..." } ], sig: "..." } ``` # Limitations Using delegation from specific authority as an authorization proof limits it to the contexts in which signing authority is trusted. It is reasonable compromise when receiver of the proof and issuer is the same authority (as is the case for web3.storage). However we wish above described account system to be useable in global context, whech we plan to accomplish by upgrading [authorization][] to use [UCAN mailto][] specification, so that email ownership could be verifiable without [email verification][] step. # Related Notes ## Free provider web3.storage offers one "free provider" per account. It will be denied if `consumer` space is not specified or is the one that already has it. Note that adding "free provider" to the space is more than once has no effect _(even when obtained through different accounts)_, because space has set of providers, and "free provider" is either in that set or it is not. [UCAN mailto]:https://github.com/ucan-wg/ucan-mailto/ [`did:mailto`]:https://github.com/ucan-wg/did-mailto/ [principal]:https://github.com/ucan-wg/spec/blob/main/README.md#321-principals [recipient validation]:https://github.com/ucan-wg/spec/blob/main/README.md#621-recipient-validation [`did:key`]:https://w3c-ccg.github.io/did-method-key/ [issue `as`]:#issue-as [issue `with`]:#issue-with [UCAN]:https://github.com/ucan-wg/spec/ [principal alignment]:https://github.com/ucan-wg/spec/blob/main/README.md#62-principal-alignment [email verification]:#Email-Verification [authorization]:#Authorization [access delegation]:#Delegate-Access

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully