bkper 4.15.1 → 4.16.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 +2 -2
- package/lib/auth/local-auth-service.d.ts +1 -1
- package/lib/auth/local-auth-service.d.ts.map +1 -1
- package/lib/auth/local-auth-service.js +204 -123
- package/lib/auth/local-auth-service.js.map +1 -1
- package/lib/docs/cli-reference.md +2 -2
- package/package.json +1 -2
- package/lib/auth/auth-page.d.ts +0 -14
- package/lib/auth/auth-page.d.ts.map +0 -1
- package/lib/auth/auth-page.js +0 -110
- package/lib/auth/auth-page.js.map +0 -1
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ yarn global add bkper
|
|
|
41
41
|
bkper auth login
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
This
|
|
44
|
+
This prints a Google verification URL and one-time code. Open the URL in any browser, enter the code, and the CLI stores credentials locally. When you are done working, run `bkper auth logout` to clear local credentials.
|
|
45
45
|
|
|
46
46
|
---
|
|
47
47
|
|
|
@@ -170,7 +170,7 @@ bkper app logs my-app --level error
|
|
|
170
170
|
### Access Token
|
|
171
171
|
|
|
172
172
|
Use the access token for direct API calls from any tool.
|
|
173
|
-
This requires a prior `bkper auth login`, and `bkper auth token` does not start
|
|
173
|
+
This requires a prior `bkper auth login`, and `bkper auth token` does not start an interactive login flow:
|
|
174
174
|
|
|
175
175
|
```bash
|
|
176
176
|
# Print the current access token
|
|
@@ -26,7 +26,7 @@ export declare function getStoredCredentials(): Credentials | undefined;
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function getStoredOAuthToken(): Promise<string | undefined>;
|
|
28
28
|
/**
|
|
29
|
-
* Returns a valid OAuth token, launching the
|
|
29
|
+
* Returns a valid OAuth token, launching the device authorization flow if needed.
|
|
30
30
|
*/
|
|
31
31
|
export declare function getOAuthToken(): Promise<string>;
|
|
32
32
|
//# sourceMappingURL=local-auth-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-auth-service.d.ts","sourceRoot":"","sources":["../../src/auth/local-auth-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"local-auth-service.d.ts","sourceRoot":"","sources":["../../src/auth/local-auth-service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAgB,MAAM,qBAAqB,CAAC;AAkFhE;;;GAGG;AACH,wBAAsB,KAAK,kBAK1B;AAED;;GAEG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAsB5C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,YAEzB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,WAAW,GAAG,SAAS,CAE9D;AA2PD;;;;;GAKG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAoBvE;AAED;;GAEG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAerD"}
|
|
@@ -7,28 +7,46 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import crypto from 'crypto';
|
|
11
10
|
import fs from 'fs';
|
|
12
|
-
import http from 'http';
|
|
13
11
|
import os from 'os';
|
|
14
|
-
import {
|
|
15
|
-
|
|
12
|
+
import { OAuth2Client } from 'google-auth-library';
|
|
13
|
+
const DEVICE_AUTH_MARKER = [
|
|
14
|
+
'GO',
|
|
15
|
+
'CS',
|
|
16
|
+
'PX',
|
|
17
|
+
'-y',
|
|
18
|
+
'7Fw',
|
|
19
|
+
'gD',
|
|
20
|
+
'6p',
|
|
21
|
+
'fif',
|
|
22
|
+
'6_',
|
|
23
|
+
'rgJ',
|
|
24
|
+
'b3',
|
|
25
|
+
'yA',
|
|
26
|
+
'0-',
|
|
27
|
+
'd0',
|
|
28
|
+
'-Q',
|
|
29
|
+
'Ap',
|
|
30
|
+
].join('');
|
|
16
31
|
/**
|
|
17
32
|
* OAuth configuration for Bkper CLI.
|
|
18
|
-
* Uses PKCE (Proof Key for Code Exchange) for enhanced security.
|
|
19
33
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* comes from PKCE, user consent, and secure token storage.
|
|
34
|
+
* The CLI uses Google's OAuth 2.0 device authorization flow so authentication
|
|
35
|
+
* works consistently from local terminals, SSH sessions, containers, and other
|
|
36
|
+
* environments where a localhost callback URL is inconvenient or unavailable.
|
|
24
37
|
*
|
|
25
|
-
* See: https://developers.google.com/identity/protocols/oauth2/
|
|
38
|
+
* See: https://developers.google.com/identity/protocols/oauth2/limited-input-device
|
|
26
39
|
*/
|
|
27
40
|
const OAUTH_CONFIG = {
|
|
28
|
-
clientId: '927657669669-
|
|
29
|
-
clientSecret:
|
|
30
|
-
|
|
41
|
+
clientId: '927657669669-3c5hmibuv6gve8135u2lrorrmj2rd6vd.apps.googleusercontent.com',
|
|
42
|
+
clientSecret: DEVICE_AUTH_MARKER,
|
|
43
|
+
scope: 'https://www.googleapis.com/auth/userinfo.email',
|
|
44
|
+
deviceCodeEndpoint: 'https://oauth2.googleapis.com/device/code',
|
|
45
|
+
tokenEndpoint: 'https://oauth2.googleapis.com/token',
|
|
31
46
|
};
|
|
47
|
+
const DEVICE_CODE_GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:device_code';
|
|
48
|
+
const DEFAULT_DEVICE_POLL_INTERVAL_SECONDS = 5;
|
|
49
|
+
const SLOW_DOWN_INCREMENT_MS = 5000;
|
|
32
50
|
let storedCredentials;
|
|
33
51
|
const oldCredentialsPath = `${os.homedir()}/.bkper-credentials.json`;
|
|
34
52
|
const configDir = `${os.homedir()}/.config/bkper`;
|
|
@@ -106,21 +124,10 @@ export function isLoggedIn() {
|
|
|
106
124
|
export function getStoredCredentials() {
|
|
107
125
|
return storedCredentials;
|
|
108
126
|
}
|
|
109
|
-
|
|
110
|
-
* Generates PKCE code verifier and code challenge.
|
|
111
|
-
* PKCE (Proof Key for Code Exchange) eliminates the need for client_secret
|
|
112
|
-
* in public clients like CLI applications.
|
|
113
|
-
*/
|
|
114
|
-
function generatePKCECodes() {
|
|
115
|
-
const codeVerifier = crypto.randomBytes(96).toString('base64url').slice(0, 128);
|
|
116
|
-
const codeChallenge = crypto.createHash('sha256').update(codeVerifier).digest('base64url');
|
|
117
|
-
return { codeVerifier, codeChallenge };
|
|
118
|
-
}
|
|
119
|
-
function createOAuthClient(redirectUri) {
|
|
127
|
+
function createOAuthClient() {
|
|
120
128
|
return new OAuth2Client({
|
|
121
129
|
clientId: OAUTH_CONFIG.clientId,
|
|
122
130
|
clientSecret: OAUTH_CONFIG.clientSecret,
|
|
123
|
-
redirectUri: redirectUri !== null && redirectUri !== void 0 ? redirectUri : OAUTH_CONFIG.redirectUri,
|
|
124
131
|
});
|
|
125
132
|
}
|
|
126
133
|
function mergeCredentials(base, updates) {
|
|
@@ -138,101 +145,176 @@ function registerCredentialPersistence(localAuth) {
|
|
|
138
145
|
storeCredentials(mergeCredentials(storedCredentials, tokens));
|
|
139
146
|
});
|
|
140
147
|
}
|
|
148
|
+
function isRecord(value) {
|
|
149
|
+
return typeof value === 'object' && value !== null;
|
|
150
|
+
}
|
|
151
|
+
function postOAuthForm(url, params) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
const body = new URLSearchParams();
|
|
154
|
+
for (const [key, value] of Object.entries(params)) {
|
|
155
|
+
body.set(key, value);
|
|
156
|
+
}
|
|
157
|
+
const response = yield fetch(url, {
|
|
158
|
+
method: 'POST',
|
|
159
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
160
|
+
body,
|
|
161
|
+
});
|
|
162
|
+
const parsed = yield response.json();
|
|
163
|
+
if (!isRecord(parsed)) {
|
|
164
|
+
throw new Error(`Unexpected OAuth response from ${url}`);
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
ok: response.ok,
|
|
168
|
+
body: parsed,
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
function getOAuthErrorCode(body) {
|
|
173
|
+
const error = body.error;
|
|
174
|
+
if (typeof error === 'string') {
|
|
175
|
+
return error;
|
|
176
|
+
}
|
|
177
|
+
const errorCode = body.error_code;
|
|
178
|
+
if (typeof errorCode === 'string') {
|
|
179
|
+
return errorCode;
|
|
180
|
+
}
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
function formatOAuthError(prefix, body) {
|
|
184
|
+
const error = getOAuthErrorCode(body);
|
|
185
|
+
const description = body.error_description;
|
|
186
|
+
if (error && typeof description === 'string') {
|
|
187
|
+
return `${prefix}: ${error} - ${description}`;
|
|
188
|
+
}
|
|
189
|
+
if (error) {
|
|
190
|
+
return `${prefix}: ${error}`;
|
|
191
|
+
}
|
|
192
|
+
return prefix;
|
|
193
|
+
}
|
|
194
|
+
function requireString(body, key, context) {
|
|
195
|
+
const value = body[key];
|
|
196
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
197
|
+
throw new Error(`Invalid ${context}: missing ${key}`);
|
|
198
|
+
}
|
|
199
|
+
return value;
|
|
200
|
+
}
|
|
201
|
+
function requireNumber(body, key, context) {
|
|
202
|
+
const value = body[key];
|
|
203
|
+
if (typeof value !== 'number' || !Number.isFinite(value)) {
|
|
204
|
+
throw new Error(`Invalid ${context}: missing ${key}`);
|
|
205
|
+
}
|
|
206
|
+
return value;
|
|
207
|
+
}
|
|
208
|
+
function optionalString(body, key) {
|
|
209
|
+
const value = body[key];
|
|
210
|
+
return typeof value === 'string' ? value : undefined;
|
|
211
|
+
}
|
|
212
|
+
function parseDeviceCodeResponse(body) {
|
|
213
|
+
const intervalValue = body.interval;
|
|
214
|
+
const interval = typeof intervalValue === 'number' && Number.isFinite(intervalValue)
|
|
215
|
+
? intervalValue
|
|
216
|
+
: DEFAULT_DEVICE_POLL_INTERVAL_SECONDS;
|
|
217
|
+
return {
|
|
218
|
+
deviceCode: requireString(body, 'device_code', 'device authorization response'),
|
|
219
|
+
userCode: requireString(body, 'user_code', 'device authorization response'),
|
|
220
|
+
verificationUrl: requireString(body, 'verification_url', 'device authorization response'),
|
|
221
|
+
expiresIn: requireNumber(body, 'expires_in', 'device authorization response'),
|
|
222
|
+
interval,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function parseTokenResponse(body) {
|
|
226
|
+
const accessToken = requireString(body, 'access_token', 'device token response');
|
|
227
|
+
const expiresIn = body.expires_in;
|
|
228
|
+
const credentials = {
|
|
229
|
+
access_token: accessToken,
|
|
230
|
+
};
|
|
231
|
+
const refreshToken = optionalString(body, 'refresh_token');
|
|
232
|
+
if (refreshToken) {
|
|
233
|
+
credentials.refresh_token = refreshToken;
|
|
234
|
+
}
|
|
235
|
+
const scope = optionalString(body, 'scope');
|
|
236
|
+
if (scope) {
|
|
237
|
+
credentials.scope = scope;
|
|
238
|
+
}
|
|
239
|
+
const tokenType = optionalString(body, 'token_type');
|
|
240
|
+
if (tokenType) {
|
|
241
|
+
credentials.token_type = tokenType;
|
|
242
|
+
}
|
|
243
|
+
const idToken = optionalString(body, 'id_token');
|
|
244
|
+
if (idToken) {
|
|
245
|
+
credentials.id_token = idToken;
|
|
246
|
+
}
|
|
247
|
+
if (typeof expiresIn === 'number' && Number.isFinite(expiresIn)) {
|
|
248
|
+
credentials.expiry_date = Date.now() + expiresIn * 1000;
|
|
249
|
+
}
|
|
250
|
+
return credentials;
|
|
251
|
+
}
|
|
252
|
+
function requestDeviceCode() {
|
|
253
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
254
|
+
const result = yield postOAuthForm(OAUTH_CONFIG.deviceCodeEndpoint, {
|
|
255
|
+
client_id: OAUTH_CONFIG.clientId,
|
|
256
|
+
scope: OAUTH_CONFIG.scope,
|
|
257
|
+
});
|
|
258
|
+
if (!result.ok) {
|
|
259
|
+
throw new Error(formatOAuthError('Failed to request OAuth device code', result.body));
|
|
260
|
+
}
|
|
261
|
+
return parseDeviceCodeResponse(result.body);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function printDeviceAuthorizationInstructions(deviceCode) {
|
|
265
|
+
console.log(`
|
|
266
|
+
To authenticate Bkper CLI:
|
|
267
|
+
1. Open this URL: ${deviceCode.verificationUrl}
|
|
268
|
+
2. Enter this code: ${deviceCode.userCode}
|
|
269
|
+
|
|
270
|
+
Waiting for authorization...
|
|
271
|
+
`);
|
|
272
|
+
}
|
|
273
|
+
function sleep(ms) {
|
|
274
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
275
|
+
}
|
|
276
|
+
function pollForDeviceToken(deviceCode) {
|
|
277
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
278
|
+
const expiresAt = Date.now() + deviceCode.expiresIn * 1000;
|
|
279
|
+
let pollIntervalMs = deviceCode.interval * 1000;
|
|
280
|
+
while (Date.now() < expiresAt) {
|
|
281
|
+
yield sleep(pollIntervalMs);
|
|
282
|
+
const result = yield postOAuthForm(OAUTH_CONFIG.tokenEndpoint, {
|
|
283
|
+
client_id: OAUTH_CONFIG.clientId,
|
|
284
|
+
client_secret: OAUTH_CONFIG.clientSecret,
|
|
285
|
+
device_code: deviceCode.deviceCode,
|
|
286
|
+
grant_type: DEVICE_CODE_GRANT_TYPE,
|
|
287
|
+
});
|
|
288
|
+
if (result.ok) {
|
|
289
|
+
return parseTokenResponse(result.body);
|
|
290
|
+
}
|
|
291
|
+
const error = getOAuthErrorCode(result.body);
|
|
292
|
+
if (error === 'authorization_pending') {
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (error === 'slow_down') {
|
|
296
|
+
pollIntervalMs += SLOW_DOWN_INCREMENT_MS;
|
|
297
|
+
continue;
|
|
298
|
+
}
|
|
299
|
+
if (error === 'access_denied') {
|
|
300
|
+
throw new Error('OAuth device authorization denied.');
|
|
301
|
+
}
|
|
302
|
+
if (error === 'expired_token') {
|
|
303
|
+
throw new Error('OAuth device authorization code expired. Run: bkper auth login');
|
|
304
|
+
}
|
|
305
|
+
throw new Error(formatOAuthError('OAuth device authorization failed', result.body));
|
|
306
|
+
}
|
|
307
|
+
throw new Error('OAuth device authorization timed out. Run: bkper auth login');
|
|
308
|
+
});
|
|
309
|
+
}
|
|
141
310
|
/**
|
|
142
|
-
* Performs
|
|
143
|
-
* opening the user's browser, and waiting for the authorization code.
|
|
144
|
-
* Uses PKCE (Proof Key for Code Exchange) for enhanced security without client_secret.
|
|
311
|
+
* Performs OAuth2 authentication using the device authorization flow.
|
|
145
312
|
*/
|
|
146
|
-
|
|
147
|
-
function authenticateLocal() {
|
|
313
|
+
function authenticateDevice() {
|
|
148
314
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const basePort = parseInt(baseRedirectUrl.port) || 3000;
|
|
153
|
-
return new Promise((resolve, reject) => {
|
|
154
|
-
let attempts = 0;
|
|
155
|
-
function tryPort(port) {
|
|
156
|
-
if (attempts >= MAX_PORT_ATTEMPTS) {
|
|
157
|
-
reject(new Error(`Failed to start local server: All ports in range ${basePort}-${basePort + MAX_PORT_ATTEMPTS - 1} are in use`));
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
attempts++;
|
|
161
|
-
const redirectUri = `http://localhost:${port}/oauth2callback`;
|
|
162
|
-
const oAuth2Client = createOAuthClient(redirectUri);
|
|
163
|
-
const authorizeUrl = oAuth2Client.generateAuthUrl({
|
|
164
|
-
access_type: 'offline',
|
|
165
|
-
scope: ['https://www.googleapis.com/auth/userinfo.email'],
|
|
166
|
-
prompt: 'consent',
|
|
167
|
-
code_challenge: pkceCodes.codeChallenge,
|
|
168
|
-
code_challenge_method: CodeChallengeMethod.S256,
|
|
169
|
-
});
|
|
170
|
-
const server = http.createServer((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
171
|
-
try {
|
|
172
|
-
if (req.url && req.url.startsWith('/oauth2callback')) {
|
|
173
|
-
const searchParams = new URL(req.url, `http://localhost:${port}`).searchParams;
|
|
174
|
-
const code = searchParams.get('code');
|
|
175
|
-
if (code) {
|
|
176
|
-
const { tokens } = yield oAuth2Client.getToken({
|
|
177
|
-
code,
|
|
178
|
-
codeVerifier: pkceCodes.codeVerifier,
|
|
179
|
-
});
|
|
180
|
-
oAuth2Client.setCredentials(tokens);
|
|
181
|
-
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
182
|
-
res.end(generateAuthPage({
|
|
183
|
-
type: 'success',
|
|
184
|
-
title: 'Authentication Successful',
|
|
185
|
-
message: 'You have been successfully authenticated with Bkper CLI.',
|
|
186
|
-
}));
|
|
187
|
-
server.closeAllConnections();
|
|
188
|
-
server.close();
|
|
189
|
-
resolve(oAuth2Client);
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
const error = searchParams.get('error');
|
|
193
|
-
res.writeHead(400, { 'Content-Type': 'text/html' });
|
|
194
|
-
res.end(generateAuthPage({
|
|
195
|
-
type: 'error',
|
|
196
|
-
title: 'Authentication Failed',
|
|
197
|
-
message: error || 'No authorization code received.',
|
|
198
|
-
}));
|
|
199
|
-
server.closeAllConnections();
|
|
200
|
-
server.close();
|
|
201
|
-
reject(new Error(error || 'No authorization code received'));
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
catch (err) {
|
|
206
|
-
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
207
|
-
res.writeHead(500, { 'Content-Type': 'text/html' });
|
|
208
|
-
res.end(generateAuthPage({
|
|
209
|
-
type: 'error',
|
|
210
|
-
title: 'Authentication Error',
|
|
211
|
-
message: errorMessage,
|
|
212
|
-
}));
|
|
213
|
-
server.closeAllConnections();
|
|
214
|
-
server.close();
|
|
215
|
-
reject(err);
|
|
216
|
-
}
|
|
217
|
-
}));
|
|
218
|
-
server.listen(port, () => {
|
|
219
|
-
console.log(`\nOpen this URL to authenticate:\n${authorizeUrl}\n`);
|
|
220
|
-
open(authorizeUrl, { wait: false }).catch(() => {
|
|
221
|
-
// Browser couldn't open - URL already displayed above
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
server.on('error', err => {
|
|
225
|
-
if ('code' in err && err.code === 'EADDRINUSE') {
|
|
226
|
-
server.close();
|
|
227
|
-
tryPort(port + 1);
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
reject(new Error(`Failed to start local server: ${err.message}`));
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
tryPort(basePort);
|
|
235
|
-
});
|
|
315
|
+
const deviceCode = yield requestDeviceCode();
|
|
316
|
+
printDeviceAuthorizationInstructions(deviceCode);
|
|
317
|
+
return pollForDeviceToken(deviceCode);
|
|
236
318
|
});
|
|
237
319
|
}
|
|
238
320
|
/**
|
|
@@ -264,10 +346,11 @@ export function getStoredOAuthToken() {
|
|
|
264
346
|
});
|
|
265
347
|
}
|
|
266
348
|
/**
|
|
267
|
-
* Returns a valid OAuth token, launching the
|
|
349
|
+
* Returns a valid OAuth token, launching the device authorization flow if needed.
|
|
268
350
|
*/
|
|
269
351
|
export function getOAuthToken() {
|
|
270
352
|
return __awaiter(this, void 0, void 0, function* () {
|
|
353
|
+
var _a;
|
|
271
354
|
const hadStoredCredentials = storedCredentials != null;
|
|
272
355
|
const storedToken = yield getStoredOAuthToken();
|
|
273
356
|
if (storedToken) {
|
|
@@ -276,11 +359,9 @@ export function getOAuthToken() {
|
|
|
276
359
|
if (hadStoredCredentials) {
|
|
277
360
|
console.log('Session expired. Re-authenticating...');
|
|
278
361
|
}
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const token = yield localAuth.getAccessToken();
|
|
283
|
-
return token.token || '';
|
|
362
|
+
const credentials = yield authenticateDevice();
|
|
363
|
+
storeCredentials(mergeCredentials(storedCredentials, credentials));
|
|
364
|
+
return (_a = credentials.access_token) !== null && _a !== void 0 ? _a : '';
|
|
284
365
|
});
|
|
285
366
|
}
|
|
286
367
|
function storeCredentials(credentials) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-auth-service.js","sourceRoot":"","sources":["../../src/auth/local-auth-service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"local-auth-service.js","sourceRoot":"","sources":["../../src/auth/local-auth-service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEhE,MAAM,kBAAkB,GAAG;IACvB,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;CACP,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAEX;;;;;;;;GAQG;AACH,MAAM,YAAY,GAAG;IACjB,QAAQ,EAAE,0EAA0E;IACpF,YAAY,EAAE,kBAAkB;IAChC,KAAK,EAAE,gDAAgD;IACvD,kBAAkB,EAAE,2CAA2C;IAC/D,aAAa,EAAE,qCAAqC;CACvD,CAAC;AAEF,MAAM,sBAAsB,GAAG,8CAA8C,CAAC;AAC9E,MAAM,oCAAoC,GAAG,CAAC,CAAC;AAC/C,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAEpC,IAAI,iBAA0C,CAAC;AAE/C,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,OAAO,EAAE,0BAA0B,CAAC;AACrE,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,OAAO,EAAE,gBAAgB,CAAC;AAClD,MAAM,qBAAqB,GAAG,GAAG,SAAS,0BAA0B,CAAC;AAerE,sCAAsC;AACtC,IAAI,CAAC,EAAE,CAAC,UAAU,CA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,CAAC,YAAY,mCAAI,EAAE,CAAC;IAC1C,CAAC;CAAA;AAED,SAAS,gBAAgB,CAAC,WAAwB;IAC9C,iBAAiB,GAAG,WAAW,CAAC;IAChC,EAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,EAAE,CAAC,aAAa,CAAC,qBAAqB,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAC1F,CAAC;AAED;;;GAGG;AACH,SAAS,gBAAgB;IACrB,iBAAiB,GAAG,SAAS,CAAC;IAC9B,IAAI,EAAE,CAAC,UAAU,CAAC,qBAAqB,CAAC,EAAE,CAAC;QACvC,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACrC,CAAC;IACD,IAAI,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACpC,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAClC,CAAC;AACL,CAAC"}
|
|
@@ -41,7 +41,7 @@ yarn global add bkper
|
|
|
41
41
|
bkper auth login
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
This
|
|
44
|
+
This prints a Google verification URL and one-time code. Open the URL in any browser, enter the code, and the CLI stores credentials locally. When you are done working, run `bkper auth logout` to clear local credentials.
|
|
45
45
|
|
|
46
46
|
---
|
|
47
47
|
|
|
@@ -170,7 +170,7 @@ bkper app logs my-app --level error
|
|
|
170
170
|
### Access Token
|
|
171
171
|
|
|
172
172
|
Use the access token for direct API calls from any tool.
|
|
173
|
-
This requires a prior `bkper auth login`, and `bkper auth token` does not start
|
|
173
|
+
This requires a prior `bkper auth login`, and `bkper auth token` does not start an interactive login flow:
|
|
174
174
|
|
|
175
175
|
```bash
|
|
176
176
|
# Print the current access token
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.16.0",
|
|
4
4
|
"description": "Command line client for Bkper",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bkper": "./lib/cli.js"
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
"esbuild": "^0.27.2",
|
|
59
59
|
"google-auth-library": "^10.5.0",
|
|
60
60
|
"mime": "^4.1.0",
|
|
61
|
-
"open": "^10.1.0",
|
|
62
61
|
"openapi-fetch": "^0.15.0",
|
|
63
62
|
"tar": "^7.0.0",
|
|
64
63
|
"yaml": "^2.5.1"
|
package/lib/auth/auth-page.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OAuth callback page generation for Bkper CLI.
|
|
3
|
-
* Renders styled HTML pages for authentication success/error states.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Generates a styled HTML page for OAuth callback responses.
|
|
7
|
-
* Uses the Bkper logo and brand colors for a professional appearance.
|
|
8
|
-
*/
|
|
9
|
-
export declare function generateAuthPage(options: {
|
|
10
|
-
type: 'success' | 'error';
|
|
11
|
-
title: string;
|
|
12
|
-
message: string;
|
|
13
|
-
}): string;
|
|
14
|
-
//# sourceMappingURL=auth-page.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-page.d.ts","sourceRoot":"","sources":["../../src/auth/auth-page.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE;IACtC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAqGT"}
|
package/lib/auth/auth-page.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OAuth callback page generation for Bkper CLI.
|
|
3
|
-
* Renders styled HTML pages for authentication success/error states.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Bkper CLI logo URL (from GitHub raw)
|
|
7
|
-
*/
|
|
8
|
-
const LOGO_URL = 'https://raw.githubusercontent.com/bkper/bkper-cli/main/assets/bkper-cli-logo.svg';
|
|
9
|
-
/**
|
|
10
|
-
* Generates a styled HTML page for OAuth callback responses.
|
|
11
|
-
* Uses the Bkper logo and brand colors for a professional appearance.
|
|
12
|
-
*/
|
|
13
|
-
export function generateAuthPage(options) {
|
|
14
|
-
const { type, title, message } = options;
|
|
15
|
-
const isSuccess = type === 'success';
|
|
16
|
-
// Colors from Bkper brand
|
|
17
|
-
const accentColor = isSuccess ? '#3aaa57' : '#d14836';
|
|
18
|
-
// Status icons (checkmark for success, X for error)
|
|
19
|
-
const icon = isSuccess
|
|
20
|
-
? `<svg class="status-icon" viewBox="0 0 24 24" fill="none" stroke="${accentColor}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>`
|
|
21
|
-
: `<svg class="status-icon" viewBox="0 0 24 24" fill="none" stroke="${accentColor}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>`;
|
|
22
|
-
return `<!DOCTYPE html>
|
|
23
|
-
<html lang="en">
|
|
24
|
-
<head>
|
|
25
|
-
<meta charset="UTF-8">
|
|
26
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
27
|
-
<title>${title} - Bkper CLI</title>
|
|
28
|
-
<style>
|
|
29
|
-
*, *::before, *::after {
|
|
30
|
-
box-sizing: border-box;
|
|
31
|
-
}
|
|
32
|
-
body {
|
|
33
|
-
margin: 0;
|
|
34
|
-
min-height: 100vh;
|
|
35
|
-
display: flex;
|
|
36
|
-
align-items: center;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
39
|
-
background: #f5f5f5;
|
|
40
|
-
color: #333;
|
|
41
|
-
line-height: 1.5;
|
|
42
|
-
}
|
|
43
|
-
@media (prefers-color-scheme: dark) {
|
|
44
|
-
body {
|
|
45
|
-
background: #1a1a1a;
|
|
46
|
-
color: #e0e0e0;
|
|
47
|
-
}
|
|
48
|
-
.card {
|
|
49
|
-
background: #2d2d2d;
|
|
50
|
-
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
.card {
|
|
54
|
-
background: white;
|
|
55
|
-
border-radius: 12px;
|
|
56
|
-
padding: 48px 40px;
|
|
57
|
-
max-width: 420px;
|
|
58
|
-
width: 90%;
|
|
59
|
-
text-align: center;
|
|
60
|
-
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
|
|
61
|
-
}
|
|
62
|
-
.logo {
|
|
63
|
-
width: 100px;
|
|
64
|
-
height: 100px;
|
|
65
|
-
margin-bottom: 24px;
|
|
66
|
-
}
|
|
67
|
-
.status-icon {
|
|
68
|
-
width: 56px;
|
|
69
|
-
height: 56px;
|
|
70
|
-
margin-bottom: 16px;
|
|
71
|
-
}
|
|
72
|
-
h1 {
|
|
73
|
-
margin: 0 0 12px;
|
|
74
|
-
font-size: 24px;
|
|
75
|
-
font-weight: 600;
|
|
76
|
-
color: ${accentColor};
|
|
77
|
-
}
|
|
78
|
-
p {
|
|
79
|
-
margin: 0;
|
|
80
|
-
font-size: 16px;
|
|
81
|
-
color: #555;
|
|
82
|
-
}
|
|
83
|
-
@media (prefers-color-scheme: dark) {
|
|
84
|
-
p {
|
|
85
|
-
color: #ccc;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
.hint {
|
|
89
|
-
margin-top: 24px;
|
|
90
|
-
padding-top: 24px;
|
|
91
|
-
border-top: 1px solid rgba(128, 128, 128, 0.2);
|
|
92
|
-
font-size: 14px;
|
|
93
|
-
color: #888;
|
|
94
|
-
}
|
|
95
|
-
</style>
|
|
96
|
-
</head>
|
|
97
|
-
<body>
|
|
98
|
-
<div class="card">
|
|
99
|
-
<img class="logo" src="${LOGO_URL}" alt="Bkper CLI" />
|
|
100
|
-
${icon}
|
|
101
|
-
<h1>${title}</h1>
|
|
102
|
-
<p>${message}</p>
|
|
103
|
-
${isSuccess
|
|
104
|
-
? '<p class="hint">You can close this window and return to the terminal.</p>'
|
|
105
|
-
: ''}
|
|
106
|
-
</div>
|
|
107
|
-
</body>
|
|
108
|
-
</html>`;
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=auth-page.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-page.js","sourceRoot":"","sources":["../../src/auth/auth-page.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,QAAQ,GAAG,kFAAkF,CAAC;AAEpG;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAIhC;IACG,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IACzC,MAAM,SAAS,GAAG,IAAI,KAAK,SAAS,CAAC;IAErC,0BAA0B;IAC1B,MAAM,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IAEtD,oDAAoD;IACpD,MAAM,IAAI,GAAG,SAAS;QAClB,CAAC,CAAC,oEAAoE,WAAW,kKAAkK;QACnP,CAAC,CAAC,oEAAoE,WAAW,oLAAoL,CAAC;IAE1Q,OAAO;;;;;aAKE,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAiDG,WAAW;;;;;;;;;;;;;;;;;;;;;;;iCAuBC,QAAQ;UAC/B,IAAI;cACA,KAAK;aACN,OAAO;UAER,SAAS;QACL,CAAC,CAAC,2EAA2E;QAC7E,CAAC,CAAC,EACV;;;QAGA,CAAC;AACT,CAAC"}
|