Skip to content

Future API Sketch #1156

Description

@Gozala

Me @alanshaw, @vasco-santos and @travis had been talking about revisiting API for the client at the labweek and have got some feedback from the workshop which was validating of the one we were entertaining, I thought I'd sketch it here so we can discuss it further. Before I proceed let me call out some high level goals I have in my mind.

  1. Client state should be fully exposed and really minimal. I think it should just be a "delegation store" + "connection config".
  2. Client itself should be just a "view" class over the state "model" that simply exposes static functions operating on the "model" as methods as a convenience DSL.
    • E.g. queries over proofs should not be a clients methods (especially private) they should be just static functions over proof store and we could choose to expose or conceal them.
    • I should be able to create various "view" classes simply by wrapping over "model" and not worry that there is some state that may be out of sync.
  3. We should have views for relevant entities in the system e.g.
    • AgentView - Convenience wrapper of what I have access to on this agent.
    • AccountView - Agent may have access to arbitrary number of accounts represented via AccountView which should simply be another view over the "proofs store". When you login you get a new AccountView (holding account to agent delegation) if you do want to persist reference to the account across the agent sessions you do agent.add(account).
      • SpaceView - Agent may have access to arbitrary number of spaces represented via SpaceView which should also be views over "proofs store". When you create a space you get a new OwnedSpaceView. If you want to retain access to space across devices and sessions you'd call account.add(space). If you do not want to add space to the account you can add it it e.g. agent.local.add(space) or something like that so we emphasize the fact that space is detached from any account.
        • You could also have account.remove(space) which simply revokes delegation from space to account.
    • UploadView and StoreView will be just be views that expose corresponding upload/* and store/* capabilities of the space. I don't mean subclasses here, simply views over the same model. And space could probably have .upload and and .store fields with the corresponding views.
  4. View methods should simply query proofs in the model to find relevant delegations and invoke them if they have or fail right away if they don't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions