@kervnet/opencode-kiro-auth 1.6.3 → 1.6.5
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/core/auth/auth-handler.d.ts +1 -1
- package/dist/core/auth/auth-handler.js +9 -1
- package/dist/core/auth/kiro-cli-auth-method.d.ts +9 -0
- package/dist/core/auth/kiro-cli-auth-method.js +19 -0
- package/dist/plugin/sync/kiro-cli.js +2 -1
- package/dist/plugin.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IdcAuthMethod } from './idc-auth-method.js';
|
|
2
|
+
import { KiroCliAuthMethod } from './kiro-cli-auth-method.js';
|
|
2
3
|
export class AuthHandler {
|
|
3
4
|
config;
|
|
4
5
|
repository;
|
|
@@ -21,10 +22,17 @@ export class AuthHandler {
|
|
|
21
22
|
return [];
|
|
22
23
|
}
|
|
23
24
|
const idcMethod = new IdcAuthMethod(this.config, this.repository);
|
|
25
|
+
const cliMethod = new KiroCliAuthMethod(this.config, this.repository);
|
|
24
26
|
return [
|
|
27
|
+
{
|
|
28
|
+
id: 'kiro-cli',
|
|
29
|
+
label: 'Use Kiro CLI Session',
|
|
30
|
+
type: 'custom',
|
|
31
|
+
authorize: () => cliMethod.authorize()
|
|
32
|
+
},
|
|
25
33
|
{
|
|
26
34
|
id: 'idc',
|
|
27
|
-
label: 'AWS Builder ID (
|
|
35
|
+
label: 'AWS Builder ID (New Login)',
|
|
28
36
|
type: 'oauth',
|
|
29
37
|
authorize: (inputs) => idcMethod.authorize(inputs)
|
|
30
38
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AccountRepository } from '../../infrastructure/database/account-repository.js';
|
|
2
|
+
export declare class KiroCliAuthMethod {
|
|
3
|
+
private config;
|
|
4
|
+
private repository;
|
|
5
|
+
constructor(config: any, repository: AccountRepository);
|
|
6
|
+
authorize(): Promise<{
|
|
7
|
+
success: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { syncFromKiroCli } from '../../plugin/sync/kiro-cli.js';
|
|
2
|
+
export class KiroCliAuthMethod {
|
|
3
|
+
config;
|
|
4
|
+
repository;
|
|
5
|
+
constructor(config, repository) {
|
|
6
|
+
this.config = config;
|
|
7
|
+
this.repository = repository;
|
|
8
|
+
}
|
|
9
|
+
async authorize() {
|
|
10
|
+
// Sync from kiro-cli
|
|
11
|
+
await syncFromKiroCli();
|
|
12
|
+
// Check if we have accounts
|
|
13
|
+
const accounts = await this.repository.findAll();
|
|
14
|
+
if (accounts.length === 0) {
|
|
15
|
+
throw new Error('No accounts found. Please run: kiro-cli login');
|
|
16
|
+
}
|
|
17
|
+
return { success: true };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -25,7 +25,8 @@ export async function syncFromKiroCli() {
|
|
|
25
25
|
continue;
|
|
26
26
|
const isIdc = row.key.includes('odic');
|
|
27
27
|
const authMethod = isIdc ? 'idc' : 'desktop';
|
|
28
|
-
|
|
28
|
+
// Force us-east-1 for Kiro - ca-central-1 not supported
|
|
29
|
+
const region = 'us-east-1';
|
|
29
30
|
const profileArn = data.profile_arn || data.profileArn;
|
|
30
31
|
const accessToken = data.access_token || data.accessToken || '';
|
|
31
32
|
const refreshToken = data.refresh_token || data.refreshToken;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const createKiroPlugin: (id: string) => ({ client, directory }: a
|
|
|
9
9
|
methods: {
|
|
10
10
|
id: string;
|
|
11
11
|
label: string;
|
|
12
|
-
type: "oauth";
|
|
12
|
+
type: "oauth" | "custom";
|
|
13
13
|
authorize: (inputs?: any) => Promise<any>;
|
|
14
14
|
}[];
|
|
15
15
|
};
|
|
@@ -25,7 +25,7 @@ export declare const KiroOAuthPlugin: ({ client, directory }: any) => Promise<{
|
|
|
25
25
|
methods: {
|
|
26
26
|
id: string;
|
|
27
27
|
label: string;
|
|
28
|
-
type: "oauth";
|
|
28
|
+
type: "oauth" | "custom";
|
|
29
29
|
authorize: (inputs?: any) => Promise<any>;
|
|
30
30
|
}[];
|
|
31
31
|
};
|
package/package.json
CHANGED