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
2 changes: 1 addition & 1 deletion src/api/actor.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const actorParameters = async (): Promise<
const token = getProcessToken() ?? (await getToken());

if (isNullish(token)) {
console.log(`${red('No controller found.')} Are you logged in?`);
console.log(`${red('No access key found.')} Are you logged in?`);
process.exit(1);
}

Expand Down
2 changes: 1 addition & 1 deletion src/api/agent.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const initAgent = async (params?: Omit<ActorParameters, 'agent'>): Promis
const {identity, ...rest} = params ?? (await actorParameters());

if (REVOKED_CONTROLLERS.includes(identity.getPrincipal().toText())) {
throw new Error('The controller has been revoked for security reason!');
throw new Error('The access key has been revoked for security reason!');
}

return await agent.getAgent({identity, ...rest});
Expand Down
8 changes: 3 additions & 5 deletions src/commands/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ export const login = async (args?: string[]) => {
}

const identity = Ed25519KeyIdentity.fromParsedJson(token);
console.log(
`🔐 Your terminal is already a controller: ${green(identity.getPrincipal().toText())}\n`
);
console.log(`🔐 Your terminal already has access: ${green(identity.getPrincipal().toText())}\n`);

const {action}: {action: string} = await prompts({
type: 'select',
name: 'action',
message: 'What would you like to do?',
choices: [
{title: `Create a new controller via a login with your browser`, value: `login`},
{title: `Reuse the existing controller`, value: `reuse`}
{title: `Create a new access key by logging in with your browser`, value: `login`},
{title: `Reuse the access key used by your CLI`, value: `reuse`}
]
});

Expand Down
2 changes: 1 addition & 1 deletion src/commands/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const missionControlVersion = async () => {
console.log(
`${yellow(
'No mission control found.'
)} Ignore this error if your controller does not control your mission control.`
)} This is expected if your access key doesn't manage it.`
);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/whoami.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ const info = async (): Promise<{success: boolean}> => {
const token = await getToken();

if (isNullish(token)) {
console.log(`No controller found.`);
console.log(`No access key found.`);
return {success: false};
}

const identity = Ed25519KeyIdentity.fromParsedJson(token);
console.log(`🔐 Controller: ${green(identity.getPrincipal().toText())}`);
console.log(`🔐 Access key: ${green(identity.getPrincipal().toText())}`);

return {success: true};
};
4 changes: 2 additions & 2 deletions src/constants/help.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const INIT_DESCRIPTION = 'Set up your project.';
export const LOGIN_DESCRIPTION =
'Generate an authentication for use in non-interactive environments.';
export const LOGOUT_DESCRIPTION =
'Log out of the current device. ⚠️ This action does not remove controllers from the module.';
'Log out of the current device. ⚠️ This action does not remove the access keys from the module.';
export const OPEN_DESCRIPTION = 'Open your satellite in your browser.';
export const SNAPSHOT_DESCRIPTION = 'Handle snapshot-related tasks.';
export const START_DESCRIPTION = 'Start a module.';
Expand All @@ -21,7 +21,7 @@ export const UPGRADE_DESCRIPTION = 'Upgrade a module to a new version.';
export const USE_DESCRIPTION = 'Switch between multiple profiles.';
export const VERSION_DESCRIPTION = 'Check the version of the modules and CLI.';
export const WHOAMI_DESCRIPTION =
'Display your current profile, controller, and links to your satellite.';
'Display your current profile, access key, and links to your satellite.';

export const DEV_START_DESCRIPTION = 'Start a local Internet Computer network in a container.';

Expand Down
18 changes: 9 additions & 9 deletions src/services/controllers.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const reuseController = async (controller: Principal) => {
const segment = await selectSegment();

console.log(
`Before you finish setting things up, you'll need to add the controller to ${displaySegment(segment)} in Juno's console.\n\nFollow these steps:`
`Before you finish setting things up, you'll need to add the access key to ${displaySegment(segment)} in Juno's console.\n\nFollow these steps:`
);

await setControllerManually({controller, segment});
Expand All @@ -23,7 +23,7 @@ export const reuseController = async (controller: Principal) => {
name: 'segmentId',
message: `Good. So, what's the ${green(
`${displaySegment(segment)} ID`
)} to which you just added the controller?`
)} to which you just added the access key?`
});

if (segmentId === undefined) {
Expand Down Expand Up @@ -105,10 +105,10 @@ const selectSegment = async (): Promise<AssetKey> => {
const {segment}: {segment: AssetKey} = await prompts({
type: 'select',
name: 'segment',
message: 'Which new segment would you like to authorize with your controller?',
message: 'Which module would you like to authorize with your access key?',
choices: [
{title: 'A satellite', value: 'satellite'},
{title: 'The orbiter for the analytics', value: 'orbiter'},
{title: 'The orbiter (analytics)', value: 'orbiter'},
{title: 'Your mission control', value: 'mission_control'}
],
initial: 0
Expand Down Expand Up @@ -144,13 +144,13 @@ const setControllerManually = async ({
);
}

console.log('2. Find the "Controllers" section and click "Add a controller"');
console.log('3. Choose "Manually enter a controller"');
console.log(`4. Enter your terminal controller ${green(controller.toText())} in the input field`);
console.log(`5. Select the ${bold('ADMIN')} scope`);
console.log('2. Find the "Access Keys" section and click "Add an access key"');
console.log('3. Choose "Enter one manually"');
console.log(`4. Paste the access key ID from your terminal: ${green(controller.toText())}`);
console.log(`5. Select the ${bold('Admin')} permission`);
console.log(`6. Click ${bold('Submit')}`);
console.log(
`7. Once it’s successful, copy the ${green(`${displaySegment(segment)} ID`)} where the controller was added\n`
`7. After the key is added, copy the ${green(`${displaySegment(segment)} ID`)} displayed\n`
);

await confirmAndExit('Have you completed this step?');
Expand Down
2 changes: 1 addition & 1 deletion src/services/login.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const login = async (args?: string[]) => {
const principal = key.getPrincipal().toText();
const token = key.toJSON();

console.log(`\n🔓 Your terminal will take control as: ${green(principal)}`);
console.log(`\n🔓 Your terminal will assume admin control as: ${green(principal)}`);

const browser = nextArg({args, option: '-b'}) ?? nextArg({args, option: '--browser'});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ const executeSnapshotFn = async ({
// TODO: this can be a common assertion
if (isNullish(missionControl)) {
console.log(
`${red(
'No mission control found.'
)} Ignore this error if your controller does not control your mission control.`
`${red('No mission control found.')} This is expected if your access key doesn't manage it.`
);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ export const upgradeMissionControl = async (args?: string[]) => {

if (isNullish(missionControl)) {
console.log(
`${red(
'No mission control found.'
)} Ignore this error if your controller does not control your mission control.`
`${red('No mission control found.')} This is expected if your access key doesn't manage it.`
);
return;
}
Expand Down