Skip to content

Updates and public links

Both are generated methods of client.apps and client.orgs (see using the client). The ones marked with a step-up answer 412 CONFIRM_REQUIRED with a passkey: the one given as confirm=, else the one set with client.use_passkey(passkey).

apps.update says whether a newer release is available and what it changes, judged over the app and every app its release created with it (Where an update may send data):

u = client.apps.update(app=app)
if u.available:
u.available.class_ # "green" or "red"
u.available.reasons # why it is red, each with a .code ("egressAdded", ...)
u.available.egress # where data can go after it; None when unknown
u.available.signer_changed # None when unknown
u.available.summary # the update in one line, for a banner
u.may_approve # whether this caller may approve it

An update the node cannot classify (a release the app runs is no longer installed) is red with an unclassified reason, and what it would compare (egress, state_version_changed, new_methods, removed_methods, signer_changed) is None: show it as unknown, never as unchanged.

The organization’s owner and admins decide how updates apply (Update policies), may ask for a second approver of a red update, and may undo one for a week (Restore points and undo):

policy = {"autoApply": "never", "holdHours": 24, "secondApprover": True}
client.orgs.policy_set(org=org, policy=policy, confirm=passkey)
client.apps.policy_set(app=app, policy=policy, confirm=passkey) # one app; policy=None drops it
client.apps.approve_upgrade(app=app, version="1.1.0", confirm=passkey) # the first of two
other.apps.upgrade(app=app, version="1.1.0", confirm=other_passkey) # another owner or admin
client.apps.undo_view(app=app).apps[0].lost_writes # what an undo would lose
client.apps.undo(app=app, confirm=passkey)
client.orgs.updates(org=org) # every app with an update or an approval waiting
  • The policy is a dict with the JSON field names: autoApply ("never" or "noDestinations"), holdHours (24 to 168) and secondApprover. client.orgs.policy(org=org) and client.apps.policy(app=app) read it.
  • A unit. An app created with apps of its own (u.unit) moves with them: approve_upgrade takes unit=True for the unit’s approval, and client.apps.upgrade_unit(app=app, version=...) applies it.

A public link lets anyone with its token call the app’s #[app::public] methods without an account (Public links). Whoever may change the app’s access makes one; the visitor’s client signs each request with its own key:

made = client.apps.public_link_create(app=app, label="Feedback", rate_per_minute=60,
confirm=passkey)
made.link, made.token # the token is shown once
client.apps.public_link_list(app=app)
client.apps.public_link_revoke(app=app, link=made.link, confirm=passkey)
# The visitor: no sign-in. Keep the seed (new_visitor_seed()) to stay the same visitor.
from calimero_client_py import Client, new_visitor_seed
visitor_client = Client(base_url)
visitor = visitor_client.use_visitor(link=made.token, seed=new_visitor_seed())
visitor.public_key # how the app names the visitor; visitor.link names the link
visitor_client.apps.call(app=app, method="submit", args={"text": "Hi"})

expires_at (Unix seconds) is optional. use_visitor signs every request afresh (Bearer vis1.…, valid within 5 minutes of the node’s clock), and only the app’s #[app::public] methods answer it; use_api_key or use_session replaces it. sign_out() drops it: a visitor has no session to end, so the node refuses the revoke with 403 VISITOR_ONLY, which sign_out() raises after the credential is gone, and no request after it carries one.