View as Markdown

Serve only the person's own data#

human_id is the same person every time at your app: look their data up with it.

Level 1: A person approves with a passkey.
Class read: Nothing changes. The approval can be reused until it ends or the person withdraws it.
routes.append(route("GET", "/notes/{id}", "notes:read", level=1, resource="note:{id}", summary="Read one note"))


@app.get("/notes/<note_id>")
def get_note(note_id):
    # human_id is this person's id at your app, always the same. Look up with it, never by note_id alone.
    note = notes.get(g.allowedby.human_id, note_id)
    return note or ({"error": "no such note"}, 404)

Run in 8 languages on this version. See the results

What the test proves#

  • the person's own note is served, under the approval they already gave
  • someone else's agent, approved by its own person, gets 404 for that note and an empty list