Skip to content
PlatformMarkdown

Get started with Platform

See the keys your realm signs and seals with, then give the engineering team a realm of its own beneath yours, with every call.

AvailableAPI

In this walkthrough you look at what your realm foobar stands on, then hand a team a realm of its own. First you list the keys foobar signs its tokens and seals its data with, and see the public half apps verify against. Then you create the sub-realm engineering beneath foobar, with a host name and a first administrator of its own. At the end, the engineering team runs its realm, and you still reach into it from yours.

  • You are a realm administrator of foobar, in a group that holds RealmOwner, with your session in $CVYUH_SESSION: Call the API shows how to get it.
  • Sub-realms are turned on for foobar. If creating one answers 403, “sub-realms are not turned on”, ask Cvyūh.
  • Admin calls go to https://foobar.cvyuh.com/api/v0/am, and calls about realms to https://foobar.cvyuh.com/api/v0/am/global/realms/v1.
  1. List the keys. Every version of every key the realm holds, and never what’s in them:

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/am/keys/v1 \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"
    {
    "data": [
    { "key": "oauth2/signing", "version": 1, "alg": "ES256", "state": "valid", "validFrom": "<RFC 3339 time>" },
    { "key": "oauth2/signing", "version": 2, "alg": "RS256", "state": "valid", "validFrom": "<RFC 3339 time>" },
    { "key": "oauth2/signing", "version": 3, "alg": "PS256", "state": "valid", "validFrom": "<RFC 3339 time>" },
    { "key": "oauth2/signing/cluster-local", "version": 1, "alg": "ES256", "state": "valid", "validFrom": "<RFC 3339 time>" },
    { "key": "store/encryption", "version": 1, "alg": "chacha20poly1305", "state": "valid", "validFrom": "<RFC 3339 time>" }
    ]
    }

    oauth2/signing holds one signing key for each algorithm, store/encryption is the key the realm seals its stored data with, and oauth2/signing/cluster-local is the internal signing key, for tokens that never leave Cvyūh, which you never need to touch. A valid version is in use; a retained one is kept only to verify, or open, what it signed or sealed.

  2. See what apps verify against. The public halves of the signing keys are published, for anyone:

    Terminal window
    curl -i https://foobar.cvyuh.com/oauth2/jwks

    Each key’s kid is its thumbprint. The answer’s Cache-Control: public, max-age=300 is how long apps may keep it, and why a new key is published an hour before it signs anything: see Signing keys.

  1. Find your realm. The realms list shows your realm and every realm beneath it. The answer, in part:

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/am/global/realms/v1 \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"
    {
    "data": [
    { "id": "<realm id>", "name": "foobar", "path": "/foobar", "parentPath": "/", "status": "active",
    "hostnames": ["foobar.cvyuh.com"], "rev": 3, "createTime": "<RFC 3339 time>", "products": ["…"] }
    ]
    }

    A new realm names its parent by the parent’s path: here /foobar.

  2. Create the sub-realm. Name it, place it beneath foobar, give it a host name of its own, and set the password of its first administrator:

    Terminal window
    curl -i https://foobar.cvyuh.com/api/v0/am/global/realms/v1 \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "name": "engineering",
    "parentPath": "/foobar",
    "hostnames": ["foobar-engineering.cvyuh.com"],
    "password": "<a strong first password>",
    "mailId": "maya@example.com" }'

    The realm answers 202 Accepted with the new realm’s id, its status creating, and a Location to poll. Its keys, settings, first administrator and host name are being made, usually within seconds.

  3. Wait until it’s active.

    Terminal window
    curl https://foobar.cvyuh.com/api/v0/am/global/realms/v1/<realm id> \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

    Poll until status is active. If it shows failed, with a code and reason, resume it with curl -X POST https://foobar.cvyuh.com/api/v0/am/global/realms/v1/<realm id>/resume and the same headers, and -d '{}'.

  4. Hand it over. Give the engineering team its address and its first administrator: they sign in at https://foobar-engineering.cvyuh.com as admin@engineering, with the password you set, and should change it at once. That user is in the group engineering_admins, which holds the realm’s RealmOwner: from there, the team adds its own users and administrators, and creates realms of its own beneath.

Your reach runs down into the new realm. With your own session, list who administers it, on its host:

Terminal window
curl https://foobar-engineering.cvyuh.com/api/v0/am/privilege/v1 \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"
{
"privileges": [
{ "name": "RealmOwner", "groups": ["engineering_admins"], "allAuthenticated": false },
{ "name": "RealmViewer", "groups": [], "allAuthenticated": false }
]
}

The team’s reach never climbs: signed in to engineering, admin@engineering is refused every change to foobar.