Documentation · Usage · Reading credentials

Reading credentials

Applications, pipelines and agents read the current value of a spec from one address. They authenticate with an exchange token, or with the identity token their platform already gives them.

For people and scripts, the credvane command line does all of this for you: credvane run github-packages -- ./deploy.sh. Pipelines have CI integrations. This page is for applications that call the API directly.

The request

curl -H "Authorization: Bearer $TOKEN" \
  https://credvane.example.com/api/v1/credentials/github-packages
{
  "specKey": "github-packages",
  "specName": "GitHub packages (read)",
  "value": "…",
  "verification": "VERIFIED",
  "expiry": "2027-02-27T00:00:00Z"
}

The value is always the current one, so rotating a credential needs no redeploy. verification is VERIFIED or ATTESTED. GET /api/v1/credentials lists what the caller may read.

AnswerMeaning
401The token is missing, unknown, expired or untrusted, or its trust policy is off
403The token may not read this spec
404There is no active credential for the spec
409Several trust policies match; add ?policy=<name>

With an exchange token

For applications without a platform identity. On Exchange tokens, a person creates one for an application (an admin can for an identity), lists the specs it may read and sets an expiry. The token (cst_...) is shown once; store it with the application and send it as the bearer.

Keyless, with a trust policy

For CI jobs, pods and agents. Create a trust policy on an identity (in the web app or with Terraform), then send the job's own token. Nothing is stored in the pipeline. The token's audience must be the policy's audience; a new identity's is <Credvane's address>/w/<identity id>.

GitHub Actions

Policy: issuer GitHub Actions, claims repository=example-org/api and ref=refs/heads/main.

permissions:
  id-token: write   # lets the job ask GitHub for an OIDC token
  contents: read

steps:
  - name: Read the packages token from Credvane
    env:
      CREDVANE: https://credvane.example.com
      AUDIENCE: https://credvane.example.com/w/0f3b6c1e-...
    run: |
      oidc=$(curl -sf -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
        "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=$AUDIENCE" | jq -r .value)
      token=$(curl -sf -H "Authorization: Bearer $oidc" \
        "$CREDVANE/api/v1/credentials/github-packages" | jq -r .value)
      echo "::add-mask::$token"
      echo "PACKAGES_TOKEN=$token" >> "$GITHUB_ENV"

GitLab CI

Policy: issuer GitLab CI (or your instance), claims project_path=example-org/api and ref=main.

deploy:
  id_tokens:
    CREDVANE_ID_TOKEN:
      aud: https://credvane.example.com/w/0f3b6c1e-...
  script:
    - export PACKAGES_TOKEN=$(curl -sf -H "Authorization: Bearer $CREDVANE_ID_TOKEN"
        https://credvane.example.com/api/v1/credentials/github-packages | jq -r .value)

Kubernetes and other issuers

Add the cluster or any OpenID Connect issuer on Identities → Issuers, then send a projected service account token with Credvane's address as its audience. Credvane must be able to reach the issuer's discovery document and keys.