claude-ide-bridge 2.4.1 → 2.4.3
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 +8 -6
- package/dist/bridge.d.ts +2 -0
- package/dist/bridge.js +26 -0
- package/dist/bridge.js.map +1 -1
- package/dist/config.d.ts +8 -0
- package/dist/config.js +33 -1
- package/dist/config.js.map +1 -1
- package/dist/extensionClient.js +8 -0
- package/dist/extensionClient.js.map +1 -1
- package/dist/oauth.d.ts +47 -32
- package/dist/oauth.js +320 -275
- package/dist/oauth.js.map +1 -1
- package/dist/server.d.ts +13 -0
- package/dist/server.js +93 -54
- package/dist/server.js.map +1 -1
- package/dist/streamableHttp.d.ts +7 -0
- package/dist/streamableHttp.js +40 -11
- package/dist/streamableHttp.js.map +1 -1
- package/dist/tools/getBufferContent.js +2 -1
- package/dist/tools/getBufferContent.js.map +1 -1
- package/dist/tools/getDiagnostics.js +2 -1
- package/dist/tools/getDiagnostics.js.map +1 -1
- package/dist/tools/git-utils.js.map +1 -1
- package/dist/tools/handoffNote.d.ts +1 -0
- package/dist/tools/handoffNote.js +1 -1
- package/dist/tools/handoffNote.js.map +1 -1
- package/dist/tools/lsp.js +7 -2
- package/dist/tools/lsp.js.map +1 -1
- package/dist/tools/openFile.js +3 -1
- package/dist/tools/openFile.js.map +1 -1
- package/dist/tools/openInBrowser.js +49 -0
- package/dist/tools/openInBrowser.js.map +1 -1
- package/dist/tools/searchAndReplace.js.map +1 -1
- package/dist/tools/searchWorkspace.js.map +1 -1
- package/dist/tools/terminal.js +8 -7
- package/dist/tools/terminal.js.map +1 -1
- package/package.json +1 -1
package/dist/oauth.d.ts
CHANGED
|
@@ -1,37 +1,52 @@
|
|
|
1
|
-
import http from "node:http";
|
|
2
1
|
/**
|
|
3
|
-
* OAuth 2.
|
|
2
|
+
* OAuth 2.0 Authorization Server for claude-ide-bridge.
|
|
4
3
|
*
|
|
5
|
-
* Implements the MCP
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - POST /authorize — form submit (issues auth code)
|
|
10
|
-
* - POST /token — code + PKCE verifier → access token
|
|
4
|
+
* Implements the MCP OAuth 2.0 profile required for authenticated remote servers:
|
|
5
|
+
* - RFC 8414 Authorization Server Metadata (/.well-known/oauth-authorization-server)
|
|
6
|
+
* - RFC 6749 Authorization Code Grant with PKCE (S256, RFC 7636)
|
|
7
|
+
* - RFC 7009 Token Revocation (/oauth/revoke)
|
|
11
8
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* Design
|
|
10
|
+
* All state is in-memory. The bridge's static bearer token is the resource owner
|
|
11
|
+
* credential: only someone who knows it can open an OAuth flow via the approval page.
|
|
12
|
+
* Issued access tokens are opaque base64url strings stored in a TTL map.
|
|
13
|
+
* resolveBearerToken() is called by server.ts to admit OAuth-issued tokens alongside
|
|
14
|
+
* the static bridge token (backward compat).
|
|
15
|
+
* Refresh tokens are not issued.
|
|
16
|
+
*
|
|
17
|
+
* Security
|
|
18
|
+
* PKCE S256 mandatory. Auth codes single-use, 5 min TTL. Access tokens 1 h TTL.
|
|
19
|
+
* All string comparisons via crypto.timingSafeEqual. HTML output attribute-escaped.
|
|
14
20
|
*/
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
private
|
|
26
|
-
private
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
private
|
|
34
|
-
private
|
|
35
|
-
handleToken(req:
|
|
21
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
22
|
+
export interface OAuthServer {
|
|
23
|
+
handleDiscovery(res: ServerResponse): void;
|
|
24
|
+
handleAuthorize(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
25
|
+
handleToken(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
26
|
+
handleRevoke(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
27
|
+
resolveBearerToken(token: string): string | null;
|
|
28
|
+
}
|
|
29
|
+
export declare class OAuthServerImpl implements OAuthServer {
|
|
30
|
+
private readonly bridgeToken;
|
|
31
|
+
private readonly issuerUrl;
|
|
32
|
+
private readonly authCodes;
|
|
33
|
+
private readonly accessTokens;
|
|
34
|
+
private readonly gcTimer;
|
|
35
|
+
constructor(bridgeToken: string, issuerUrl: string);
|
|
36
|
+
destroy(): void;
|
|
37
|
+
handleDiscovery(res: ServerResponse): void;
|
|
38
|
+
handleAuthorize(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
39
|
+
private authorizeGet;
|
|
40
|
+
private authorizePost;
|
|
41
|
+
handleToken(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
42
|
+
handleRevoke(req: IncomingMessage, res: ServerResponse): Promise<void>;
|
|
43
|
+
resolveBearerToken(token: string): string | null;
|
|
44
|
+
private randomToken;
|
|
45
|
+
private safeEqual;
|
|
46
|
+
private pkceVerify;
|
|
47
|
+
private readBody;
|
|
48
|
+
private sendJson;
|
|
49
|
+
private sendError;
|
|
50
|
+
private parseAuthorizeParams;
|
|
51
|
+
private approvalPage;
|
|
36
52
|
}
|
|
37
|
-
export declare function createOAuthServer(authToken: string): OAuthServer;
|