Skip to content

Commit 69ad53b

Browse files
author
Daniel Borkan
committed
Cleanup
1 parent 9c55766 commit 69ad53b

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

src/cloud/social/provider.ts

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ const ZORK_PORT = 9000;
2222
// Key under which our contacts are saved in storage.
2323
const STORAGE_KEY = 'cloud-social-contacts';
2424

25-
// Admin users can issue invites.
26-
const ADMIN_USERNAME = 'giver';
27-
const REGULAR_USERNAME = 'getter';
28-
2925
// Timeout for establishing an SSH connection.
3026
const CONNECT_TIMEOUT_MS = 10000;
3127

@@ -36,13 +32,11 @@ interface Invite {
3632
// Hostname or IP of the cloud instance.
3733
// This is the host on which sshd is running, so it should
3834
// be directly accessible from the client.
39-
host?: string;
35+
host: string;
4036
// Username.
41-
user?: string;
42-
// Password.
43-
pass?: string;
37+
user: string;
4438
// Private key, base64-encoded.
45-
key?: string;
39+
key: string;
4640
// Is Admin.
4741
isAdmin?: boolean;
4842
}
@@ -132,7 +126,7 @@ function makeClientState(address: string): freedom.Social.ClientState {
132126
// the status field since remote-user.ts#update will use FRIEND as a default.
133127
function makeUserProfile(
134128
address: string,
135-
isAdmin :boolean): freedom.Social.UserProfile {
129+
isAdmin ?:boolean): freedom.Social.UserProfile {
136130
var status = isAdmin ? UserStatus.CLOUD_INSTANCE_CREATED_BY_LOCAL :
137131
UserStatus.CLOUD_INSTANCE_SHARED_WITH_LOCAL;
138132
return {
@@ -146,8 +140,7 @@ function makeUserProfile(
146140
//
147141
// Intended for use with the run_cloud.sh script in the uproxy-docker
148142
// repo, which will spin up the expected configuration:
149-
// - an SSH server running on port 5000, with an account named
150-
// "giver" having the password "giver"
143+
// - an SSH server running on port 5000, with an account named "giver"
151144
// - a Zork instance, accessible from the SSH server at the
152145
// hostname "zork"
153146
//
@@ -373,8 +366,7 @@ export class CloudSocialProvider {
373366
return Promise.resolve({
374367
host: invite.host,
375368
user: invite.user,
376-
key: invite.key,
377-
isAdmin: false
369+
key: invite.key
378370
});
379371
}
380372

@@ -453,9 +445,6 @@ class Connection {
453445

454446
if (this.invite_.key) {
455447
connectConfig['privateKey'] = new Buffer(this.invite_.key, 'base64');
456-
} else {
457-
log.warn('using password-based auth, support will be removed soon!');
458-
connectConfig['password'] = this.invite_.pass;
459448
}
460449

461450
return new Promise<void>((F, R) => {
@@ -519,7 +508,7 @@ class Connection {
519508
});
520509
}).on('error', (e: Error) => {
521510
// This occurs when:
522-
// - user supplies the wrong username or password
511+
// - user supplies the wrong credentials
523512
// - host cannot be reached, e.g. non-existant hostname
524513
log.warn('%1: connection error: %2', this.name_, e);
525514
this.setState_(ConnectionState.TERMINATED);

0 commit comments

Comments
 (0)