connectbase-client 0.6.16 → 0.6.17
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.
- package/README.md +27 -2
- package/dist/cli.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,14 +12,39 @@ pnpm add connectbase-client
|
|
|
12
12
|
yarn add connectbase-client
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## API Key Types
|
|
16
|
+
|
|
17
|
+
Connect Base provides **two types** of API Keys. Use the right key for your use case:
|
|
18
|
+
|
|
19
|
+
| Type | Prefix | Use For | Permissions | Safe to Expose? |
|
|
20
|
+
|------|--------|---------|-------------|-----------------|
|
|
21
|
+
| **Public Key** | `cb_pk_` | SDK / Web apps | Limited (RLS enforced) | ✅ Yes — safe in frontend code |
|
|
22
|
+
| **Secret Key** | `cb_sk_` | MCP / Admin tools | Full access (bypasses RLS) | ❌ **Never expose in frontend or public repos** |
|
|
23
|
+
|
|
24
|
+
**Which key should I use?**
|
|
25
|
+
|
|
26
|
+
| Context | Key Type | Example |
|
|
27
|
+
|---------|----------|---------|
|
|
28
|
+
| Frontend SDK (`new ConnectBase()`) | **Public Key** (`cb_pk_`) | Web/app: DB queries, auth, file uploads |
|
|
29
|
+
| `.env` file (`VITE_CONNECTBASE_API_KEY`) | **Public Key** (`cb_pk_`) | React, Vue, etc. |
|
|
30
|
+
| CLI deploy (`.connectbaserc`) | **Public Key** (`cb_pk_`) | `npx connectbase deploy` |
|
|
31
|
+
| MCP server (AI tools) | **Secret Key** (`cb_sk_`) | Claude, Cursor, Windsurf |
|
|
32
|
+
| Server-side admin tasks | **Secret Key** (`cb_sk_`) | Backend full data access |
|
|
33
|
+
|
|
34
|
+
> ⚠️ **MCP server rejects Public Keys** — you must use a Secret Key (`cb_sk_`).
|
|
35
|
+
>
|
|
36
|
+
> ⚠️ **Never use Secret Keys in frontend code** — RLS is bypassed, exposing all data.
|
|
37
|
+
|
|
38
|
+
Create API Keys in the Console under **Settings > API tab**. Choose Public or Secret type when creating. The full key is shown **only once** at creation time.
|
|
39
|
+
|
|
15
40
|
## Quick Start
|
|
16
41
|
|
|
17
42
|
```typescript
|
|
18
43
|
import ConnectBase from 'connectbase-client'
|
|
19
44
|
|
|
20
|
-
// Initialize the SDK
|
|
45
|
+
// Initialize the SDK — use a Public Key (cb_pk_)
|
|
21
46
|
const cb = new ConnectBase({
|
|
22
|
-
apiKey: '
|
|
47
|
+
apiKey: 'cb_pk_your-public-key'
|
|
23
48
|
})
|
|
24
49
|
|
|
25
50
|
// Create a game room client
|
package/dist/cli.js
CHANGED
|
@@ -30,7 +30,7 @@ var crypto = __toESM(require("crypto"));
|
|
|
30
30
|
var https = __toESM(require("https"));
|
|
31
31
|
var http = __toESM(require("http"));
|
|
32
32
|
var readline = __toESM(require("readline"));
|
|
33
|
-
var VERSION = "0.6.
|
|
33
|
+
var VERSION = "0.6.17";
|
|
34
34
|
var DEFAULT_BASE_URL = "https://api.connectbase.world";
|
|
35
35
|
var colors = {
|
|
36
36
|
reset: "\x1B[0m",
|