@dupecom/botcha 0.18.0 โ 0.19.0
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 +35 -14
- package/dist/lib/client/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
๐ **Whitepaper:** [botcha.ai/whitepaper](https://botcha.ai/whitepaper)
|
|
22
22
|
๐ฆ **npm:** [@dupecom/botcha](https://www.npmjs.com/package/@dupecom/botcha)
|
|
23
23
|
๐ **PyPI:** [botcha](https://pypi.org/project/botcha/)
|
|
24
|
-
๐ **Verify:** [@botcha
|
|
24
|
+
๐ **Verify:** [@dupecom/botcha-verify](./packages/verify/) (TS) ยท [botcha-verify](./packages/python-verify/) (Python)
|
|
25
25
|
๐ **OpenAPI:** [botcha.ai/openapi.json](https://botcha.ai/openapi.json)
|
|
26
26
|
|
|
27
27
|
## Why?
|
|
@@ -925,19 +925,20 @@ You can use the library freely, report issues, and discuss features. To contribu
|
|
|
925
925
|
|
|
926
926
|
## Server-Side Verification (for API Providers)
|
|
927
927
|
|
|
928
|
-
If you're building an API that accepts BOTCHA tokens from agents, use the verification SDKs
|
|
928
|
+
If you're building an API that accepts BOTCHA tokens from agents, use the verification SDKs. **BOTCHA v0.19.0+ signs tokens with ES256 (asymmetric)** โ no shared secret needed.
|
|
929
929
|
|
|
930
|
-
###
|
|
930
|
+
### JWKS Verification (Recommended)
|
|
931
931
|
|
|
932
932
|
```bash
|
|
933
|
-
npm install @botcha
|
|
933
|
+
npm install @dupecom/botcha-verify
|
|
934
934
|
```
|
|
935
935
|
|
|
936
936
|
```typescript
|
|
937
|
-
import { botchaVerify } from '@botcha
|
|
937
|
+
import { botchaVerify } from '@dupecom/botcha-verify/express';
|
|
938
938
|
|
|
939
|
+
// ES256 verification via JWKS โ no shared secret needed!
|
|
939
940
|
app.use('/api', botchaVerify({
|
|
940
|
-
|
|
941
|
+
jwksUrl: 'https://botcha.ai/.well-known/jwks',
|
|
941
942
|
audience: 'https://api.example.com',
|
|
942
943
|
}));
|
|
943
944
|
|
|
@@ -947,25 +948,45 @@ app.get('/api/protected', (req, res) => {
|
|
|
947
948
|
});
|
|
948
949
|
```
|
|
949
950
|
|
|
950
|
-
### Python (FastAPI / Django)
|
|
951
|
-
|
|
952
|
-
```bash
|
|
953
|
-
pip install botcha-verify
|
|
954
|
-
```
|
|
955
|
-
|
|
956
951
|
```python
|
|
957
952
|
from fastapi import FastAPI, Depends
|
|
958
953
|
from botcha_verify.fastapi import BotchaVerify
|
|
959
954
|
|
|
960
955
|
app = FastAPI()
|
|
961
|
-
botcha = BotchaVerify(
|
|
956
|
+
botcha = BotchaVerify(
|
|
957
|
+
jwks_url='https://botcha.ai/.well-known/jwks',
|
|
958
|
+
audience='https://api.example.com',
|
|
959
|
+
)
|
|
962
960
|
|
|
963
961
|
@app.get('/api/data')
|
|
964
962
|
async def get_data(token = Depends(botcha)):
|
|
965
963
|
return {"solve_time": token.solve_time}
|
|
966
964
|
```
|
|
967
965
|
|
|
968
|
-
|
|
966
|
+
### Remote Validation (No SDK Needed)
|
|
967
|
+
|
|
968
|
+
For simple integrations, validate tokens with a single HTTP call:
|
|
969
|
+
|
|
970
|
+
```bash
|
|
971
|
+
curl -X POST https://botcha.ai/v1/token/validate \
|
|
972
|
+
-H "Content-Type: application/json" \
|
|
973
|
+
-d '{"token": "eyJ..."}'
|
|
974
|
+
|
|
975
|
+
# {"valid": true, "payload": {"sub": "...", "type": "botcha-verified", ...}}
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
### Shared Secret (Legacy HS256)
|
|
979
|
+
|
|
980
|
+
HS256 is still supported for backward compatibility:
|
|
981
|
+
|
|
982
|
+
```typescript
|
|
983
|
+
app.use('/api', botchaVerify({
|
|
984
|
+
secret: process.env.BOTCHA_SECRET!,
|
|
985
|
+
audience: 'https://api.example.com',
|
|
986
|
+
}));
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
> **Docs:** See [`@dupecom/botcha-verify` README](./packages/verify/README.md) and [`botcha-verify` README](./packages/python-verify/README.md) for full API reference, Hono middleware, Django middleware, revocation checking, and custom error handlers.
|
|
969
990
|
|
|
970
991
|
## Client SDK (for AI Agents)
|
|
971
992
|
|
package/dist/lib/client/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
2
|
// SDK version - hardcoded since npm_package_version is unreliable when used as a library
|
|
3
|
-
const SDK_VERSION = '0.
|
|
3
|
+
const SDK_VERSION = '0.19.0';
|
|
4
4
|
// Export stream client
|
|
5
5
|
export { BotchaStreamClient } from './stream.js';
|
|
6
6
|
/**
|