Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/nuke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ on:
description: "Eas"
type: boolean
default: false
unkey:
description: "Unkey"
type: boolean
default: false

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
typesense: ${{ steps.force.outputs.all || steps.changes.outputs.typesense }}
workos: ${{ steps.force.outputs.all || steps.changes.outputs.workos }}
expo-eas: ${{ steps.force.outputs.all || steps.changes.outputs.expo-eas }}
unkey: ${{ steps.force.outputs.all || steps.changes.outputs.unkey }}
steps:
- id: force
if: contains(github.event.pull_request.labels.*.name, 'force-ci')
Expand Down Expand Up @@ -110,6 +111,9 @@ jobs:
expo-eas:
- 'packages/expo-eas/**'
- 'packages/core/**'
unkey:
- 'packages/unkey/**'
- 'packages/core/**'

ci-core:
needs: detect-changes
Expand Down Expand Up @@ -494,3 +498,22 @@ jobs:
working-directory: packages/expo-eas
env:
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}

ci-unkey:
needs: detect-changes
if: needs.detect-changes.outputs.unkey == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- run: bun install
- run: bun run build
working-directory: packages/core
- run: bun run check
working-directory: packages/unkey
- run: bun run test
working-directory: packages/unkey
env:
UNKEY_API_KEY: ${{ secrets.UNKEY_API_KEY }}
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,9 @@
shallow = true
ignore = dirty
fetchRecurseSubmodules = false
[submodule "packages/unkey/specs/unkey"]
path = packages/unkey/specs/unkey
url = https://github.com/unkeyed/unkey.git
[submodule "packages/unkey/specs/distilled-spec-unkey"]
path = packages/unkey/specs/distilled-spec-unkey
url = https://github.com/alchemy-run/distilled-spec-unkey.git
76 changes: 56 additions & 20 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
},
"devDependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.2.81",
"@openai/codex-sdk": "^0.137.0",
"@types/bun": "catalog:",
"@types/node": "catalog:",
"@typescript/native-preview": "catalog:",
Expand Down
68 changes: 68 additions & 0 deletions packages/unkey/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# @distilled.cloud/unkey

Effect-native Unkey SDK generated from Unkey's OpenAPI 3.1 specification mirrored in `specs/distilled-spec-unkey`.

## Installation

```bash
npm install @distilled.cloud/unkey effect
```

## Quick Start

```typescript
import { Effect, Layer } from "effect";
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
import { CredentialsFromEnv } from "@distilled.cloud/unkey";
import { permissionsListRoles } from "@distilled.cloud/unkey/operations";

const program = Effect.gen(function* () {
const response = yield* permissionsListRoles({ limit: 10 });
return response.data;
});

const UnkeyLive = Layer.mergeAll(FetchHttpClient.layer, CredentialsFromEnv);

program.pipe(Effect.provide(UnkeyLive), Effect.runPromise);
```

## Configuration

Set the following environment variable:

```bash
UNKEY_API_KEY=your-root-key
```

The SDK sends this root key as `Authorization: Bearer <root-key>` to `https://api.unkey.com`.

## Error Handling

```typescript
import { Effect } from "effect";
import { apisGetApi } from "@distilled.cloud/unkey/operations";

apisGetApi({ apiId: "api_missing" }).pipe(
Effect.catchTags({
NotFound: () => Effect.succeed(null),
UnknownUnkeyError: (error) =>
Effect.fail(new Error(`Unknown Unkey error: ${error.message}`)),
}),
);
```

## Services

- Analytics - query key verification analytics
- APIs - create, get, delete, and list keys for API namespaces
- Deployments - create and inspect deployments
- Identities - create, list, get, update, and delete identities
- Keys - create, verify, reroll, update, delete, and manage key roles and permissions
- Permissions - manage RBAC permissions and roles
- Portal - create and exchange portal sessions
- Rate limiting - check limits and manage namespace overrides
- Liveness - check API health

## License

MIT
Loading