@clivly/auth-clerk 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +61 -16
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,36 +1,81 @@
1
1
  # @clivly/auth-clerk
2
2
 
3
- Clerk implementation of Clivly's `ClivlyAuthAdapter`. It resolves the current
4
- end-user from the host app's Clerk session and returns a Clivly-compatible user
5
- shape.
3
+ [Clerk](https://clerk.com) implementation of Clivly's `ClivlyAuthAdapter`.
4
+ Resolves a CRM end-user's identity from the host app's Clerk session on each
5
+ request.
6
6
 
7
- ## Install
7
+ It answers **"who is this person?"** only. CRM authorization lives separately in
8
+ Clivly's `crm_members` layer.
9
+
10
+ > **Preview-quality surface.** The email mapper and session resolution are
11
+ > unit-tested; broader host-app compatibility coverage is still growing.
12
+
13
+ > **Optional.** You do not need an auth adapter to sync data into Clivly. Only
14
+ > reach for one when a Clivly surface must resolve which of *your* users is
15
+ > making a request.
16
+
17
+ ## Prerequisites
18
+
19
+ | Requirement | Version / note |
20
+ | --- | --- |
21
+ | Node.js | **≥ 22** |
22
+ | `@clerk/backend` | **≥ 1** — a peer dependency you install yourself |
23
+ | Clerk secret key | `sk_…` from your Clerk dashboard |
24
+
25
+ ## Installation
26
+
27
+ Two equivalent import paths — pick whichever matches how you installed Clivly:
8
28
 
9
29
  ```bash
30
+ # If you already installed `clivly` (recommended — this is what `clivly init` does)
31
+ npm install @clerk/backend
32
+ # → import from "clivly/auth/clerk"
33
+
34
+ # Or standalone
10
35
  npm install @clivly/auth-clerk @clerk/backend
36
+ # → import from "@clivly/auth-clerk"
11
37
  ```
12
38
 
13
- This adapter is a Tier 2 surface in
14
- [STABILITY.md](https://github.com/amani-joseph/clivly.com/blob/master/STABILITY.md).
15
-
16
- ## Usage
39
+ ## Quick start
17
40
 
18
41
  ```ts
19
- import { createClerkAuthAdapter } from "@clivly/auth-clerk";
42
+ import { createClerkAuthAdapter } from "clivly/auth/clerk";
20
43
 
21
44
  const authAdapter = createClerkAuthAdapter({
22
45
  secretKey: process.env.CLERK_SECRET_KEY!,
23
- publishableKey: process.env.CLERK_PUBLISHABLE_KEY,
24
- // optional:
25
- // authorizedParties: ["https://app.example.com"],
26
46
  });
27
47
 
28
- const user = await authAdapter.getUser(request);
29
- // { id, email, name } | null
48
+ const user = await authAdapter.getUser(request); // { id, email, name } | null
30
49
  ```
31
50
 
32
- Returns `null` when no Clerk session resolves, or when the resolved Clerk user
33
- does not map to a Clivly user.
51
+ ## Options
52
+
53
+ | Option | Type | Required | Notes |
54
+ | --- | --- | --- | --- |
55
+ | `secretKey` | `string` | Yes | Clerk secret key (`sk_…`) |
56
+ | `publishableKey` | `string` | No | Clerk publishable key (`pk_…`). Improves handshake reliability |
57
+ | `authorizedParties` | `string[]` | No | Origins allowed to make authenticated requests (CSRF protection) |
58
+
59
+ ```ts
60
+ const authAdapter = createClerkAuthAdapter({
61
+ secretKey: process.env.CLERK_SECRET_KEY!,
62
+ publishableKey: process.env.CLERK_PUBLISHABLE_KEY,
63
+ authorizedParties: ["https://app.example.com"],
64
+ });
65
+ ```
66
+
67
+ ## Behaviour
68
+
69
+ - Returns `null` when there is no authenticated session, or when the session
70
+ user has no email address (Clivly requires one).
71
+ - `clerkUserToClivlyUser` is exported separately if you already hold a Clerk
72
+ user object and only need the mapping.
73
+
74
+ ## Related documentation
75
+
76
+ - **[Connecting to Clivly Cloud](https://github.com/amani-joseph/clivly.com/blob/master/docs/guides/connecting-to-clivly-cloud.md#auth-adapters-optional)** — where auth adapters fit in the setup
77
+ - [`@clivly/core` README](https://github.com/amani-joseph/clivly.com/blob/master/packages/core/README.md) — the `ClivlyAuthAdapter` contract
78
+ - [`clivly` CLI README](https://github.com/amani-joseph/clivly.com/blob/master/packages/cli/README.md)
34
79
 
35
80
  ## License
36
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clivly/auth-clerk",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Clerk implementation of Clivly's ClivlyAuthAdapter.",
@@ -25,7 +25,7 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@clivly/core": "0.7.2"
28
+ "@clivly/core": "0.7.4"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@clerk/backend": ">=1"