View as Markdown

Require two people#

Two people of a group approve the same action, each with their own passkey.

Python only today.

Level 2: A person whose identity is verified approves with a passkey.
Class write-hard: Hard to undo. The app creates the approval for that exact request, and it works once.
routes.append(route("POST", "/wires", "wires:send", cls="write-hard", level=2, authority=True, resource="wire:new",
                    amount_field="/amount", summary="Wire money",
                    body={"amount": "a decimal string, e.g. 9000.00", "currency": "e.g. EUR"}))
templates["wires:send"] = "Wire {amount.max} {amount.currency}"
settings["authority_policy"] = {
    "groups": {"finance": os.environ["FINANCE"].split(",")},  # the human_id of each member
    "rules": [{"cap": "wires:send", "group": "finance", "quorum": 2}],
}


@app.post("/wires")
def wire():
    # Two people of the group approved this same wire, each with their own passkey.
    return {"wired": request.json["amount"], "currency": request.json["currency"]}, 201

Run in 1 languages on this version. See the results

What the test proves#

  • the first approval is not enough: it waits for a second person of the group
  • someone outside the group, or the first person again, cannot be the second: 403
  • the second person approves the same wire with their passkey: 201
  • both approvals are for that one wire