Skip to main content
Authentication uses ES256 or RS256 JWT tokens signed with your private key.

Create an API key

Create an API key from the API Keys page in your organization dashboard. Your browser creates an ECDSA P-256 key pair and registers the public key with Code Storage. Copy the private key and your organization identifier.
Copy the private key now. Code Storage cannot show it again. The key grants access to your Code Storage organization. Do not commit it.
Code Storage stores only the public key. It uses the iss claim to select that key when it checks a JWT. Delete an API key from the same page to revoke it. Code Storage then rejects every JWT that the key signed.
API Keys sign JWTs for API and Git requests. Code Storage uses Signing Keys to check commit signatures.

Store the private key

Store the private key in PKCS8 PEM format on your server or in a secret manager. The SDK clients and the examples on this page accept this format. The SDK examples read the key from a PIERRE_PRIVATE_KEY environment variable.

JWTs

The SDK creates JWTs with your private API key and includes the JWT in each Git remote URL. Each JWT uses these claims to set its identity, access, and lifetime:
Set this JWT header:
Use the shortest practical lifetime for each JWT. Give each JWT only the scopes that its client needs. Use a unique sub value for each client or task. Add a ref policy when a JWT must write only selected refs. Keep the private API key on a server or in a secret manager.

Permission scopes

Code Storage matches each scope exactly. One scope does not include another scope. git:write does not grant read access. Add git:read when a client must clone or fetch before it pushes.

Limit ref writes

The git:write scope permits updates to all refs by default. Add a ref policy when a JWT needs narrower write access. A ref policy can limit branches, tags, notes, and refs in a namespace. It can also reject force pushes or require commit signatures. See Ref Policies for the JWT claim and SDK options. See Commit Signing for key setup and signature checks.

Create a JWT without an SDK client

Create a JWT directly when a custom Git tool or service cannot use an SDK client. The examples accept a PKCS8 PEM private key. The TypeScript and Go examples use ES256. The Python helper selects ES256 or RS256 from the key type.