Make LoginMethod an interface

This commit is contained in:
RMidhunSuresh 2021-11-24 13:40:04 +05:30
parent 93abbe83e8
commit 91f2a96403
3 changed files with 7 additions and 14 deletions

View file

@ -14,17 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
export class LoginMethod {
constructor({homeserver}) {
this.homeserver = homeserver;
}
import type {ILogItem} from "../../logging/types";
import type {HomeServerApi} from "../net/HomeServerApi.js";
// eslint-disable-next-line no-unused-vars
async login(hsApi, deviceName, log) {
/*
Regardless of the login method, SessionContainer.startWithLogin()
can do SomeLoginMethod.login()
*/
throw("Not Implemented");
}
export interface ILoginMethod {
homeserver: string;
login(hsApi: HomeServerApi, deviceName: string, log: ILogItem): Response["body"];
}

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import {LoginMethod} from "./LoginMethod.js";
import {LoginMethod} from "./LoginMethod";
export class PasswordLoginMethod extends LoginMethod {
constructor(options) {

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import {LoginMethod} from "./LoginMethod.js";
import {LoginMethod} from "./LoginMethod";
import {makeTxnId} from "../common.js";
export class TokenLoginMethod extends LoginMethod {