@ex-machina/opencode-anthropic-auth 1.0.0 → 1.0.1
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/dist/auth.js +1 -1
- package/dist/pkce.d.ts +5 -0
- package/dist/pkce.js +17 -0
- package/package.json +11 -14
package/dist/auth.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { generatePKCE } from '@openauthjs/openauth/pkce';
|
|
2
1
|
import { AUTHORIZE_URLS, CLIENT_ID, CODE_CALLBACK_URL, OAUTH_SCOPES, TOKEN_URL, } from './constants';
|
|
2
|
+
import { generatePKCE } from './pkce';
|
|
3
3
|
function generateState() {
|
|
4
4
|
return crypto.randomUUID().replace(/-/g, '');
|
|
5
5
|
}
|
package/dist/pkce.d.ts
ADDED
package/dist/pkce.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function base64UrlEncode(bytes) {
|
|
2
|
+
let bin = '';
|
|
3
|
+
for (const byte of bytes)
|
|
4
|
+
bin += String.fromCharCode(byte);
|
|
5
|
+
return btoa(bin).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
|
|
6
|
+
}
|
|
7
|
+
export async function generatePKCE() {
|
|
8
|
+
const buf = new Uint8Array(64);
|
|
9
|
+
crypto.getRandomValues(buf);
|
|
10
|
+
const verifier = base64UrlEncode(buf);
|
|
11
|
+
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(verifier));
|
|
12
|
+
return {
|
|
13
|
+
verifier,
|
|
14
|
+
challenge: base64UrlEncode(new Uint8Array(digest)),
|
|
15
|
+
method: 'S256',
|
|
16
|
+
};
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ex-machina/opencode-anthropic-auth",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/ex-machina-co/opencode-anthropic-auth"
|
|
7
|
+
},
|
|
4
8
|
"main": "./dist/index.js",
|
|
5
9
|
"types": "./dist/index.d.ts",
|
|
6
10
|
"files": [
|
|
@@ -15,19 +19,12 @@
|
|
|
15
19
|
"lint": "biome lint .",
|
|
16
20
|
"bump": "bun script/bump.ts"
|
|
17
21
|
},
|
|
18
|
-
"repository": {
|
|
19
|
-
"type": "git",
|
|
20
|
-
"url": "https://github.com/ex-machina-co/opencode-anthropic-auth"
|
|
21
|
-
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@biomejs/biome": "
|
|
24
|
-
"@opencode-ai/plugin": "
|
|
25
|
-
"@tsconfig/bun": "
|
|
26
|
-
"@types/bun": "
|
|
27
|
-
"lefthook": "
|
|
28
|
-
"typescript": "
|
|
29
|
-
},
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@openauthjs/openauth": "^0.4.3"
|
|
23
|
+
"@biomejs/biome": "2.4.7",
|
|
24
|
+
"@opencode-ai/plugin": "0.4.45",
|
|
25
|
+
"@tsconfig/bun": "1.0.10",
|
|
26
|
+
"@types/bun": "1.3.10",
|
|
27
|
+
"lefthook": "2.1.4",
|
|
28
|
+
"typescript": "5.9.3"
|
|
32
29
|
}
|
|
33
30
|
}
|