Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/agent/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -667,13 +667,13 @@ export function createRouter(ctx: RouterContext) {
const token = config.auth?.token;
return {
hasToken: !!token,
tokenPreview: token ? `${token.slice(0, 10)}...${token.slice(-4)}` : undefined,
tokenPreview: token ? `${token.slice(0, 4)}...${token.slice(-4)}` : undefined,
};
});

const generateAuthToken = os.output(z.object({ token: z.string() })).handler(async () => {
const currentConfig = ctx.config.get();
const token = `perry-${crypto.randomBytes(16).toString('hex')}`;
const token = crypto.randomBytes(12).toString('hex');
const newConfig = { ...currentConfig, auth: { ...currentConfig.auth, token } };
ctx.config.set(newConfig);
await saveAgentConfig(newConfig, ctx.configDir);
Expand Down
2 changes: 1 addition & 1 deletion src/agent/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ async function ensureAuthForNewInstalls(configDir: string): Promise<AgentConfig>
const config = await loadAgentConfig(configDir);

if (!configExists && !config.auth?.token) {
const token = `perry-${crypto.randomBytes(16).toString('hex')}`;
const token = crypto.randomBytes(12).toString('hex');
config.auth = { ...config.auth, token };
await saveAgentConfig(config, configDir);

Expand Down
2 changes: 1 addition & 1 deletion src/cli/setup-wizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ function SetupWizard() {
};

const generateAuthToken = () => {
const token = `perry-${crypto.randomBytes(16).toString('hex')}`;
const token = crypto.randomBytes(12).toString('hex');
setState((s) => ({
...s,
authToken: token,
Expand Down
2 changes: 1 addition & 1 deletion src/commands/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function authInit(): Promise<void> {
return;
}

const token = `perry-${crypto.randomBytes(16).toString('hex')}`;
const token = crypto.randomBytes(12).toString('hex');
config.auth = { ...config.auth, token };
await saveAgentConfig(config, configDir);

Expand Down