diff --git a/src/api/remote-signer.ts b/src/api/remote-signer.ts index cba0eb23..32b899d3 100644 --- a/src/api/remote-signer.ts +++ b/src/api/remote-signer.ts @@ -2,7 +2,6 @@ import axios from 'axios'; import { API } from './api'; enum RemoteSignerAPIMethods { - REGISTER = '/users', LOGIN = '/auth/login', REFRESH = '/auth/refresh', ADDRESSES = '/auth/addresses', @@ -10,13 +9,6 @@ enum RemoteSignerAPIMethods { SIGN = '/transactions/message', } -export interface IRemoteSignerRegisterResponse { - /** - * The JWT token - */ - token: string; -} - export interface IRemoteSignerLoginResponse { /** * The JWT token @@ -70,33 +62,6 @@ export abstract class RemoteSignerAPI extends API { super(); } - /** - * Registers a new user using email and password. - * - * @param url - API endpoint URL - * @param email - The email address - * @param firstName - The first name - * @param lastName - The last name - * @param password - The password - */ - public static register( - url: string, - email: string, - firstName: string, - lastName: string, - password: string - ): Promise { - return axios - .post(url + RemoteSignerAPIMethods.REGISTER, { - email, - firstName, - lastName, - password, - }) - .then((response) => response.data) - .catch(this.isApiError); - } - /** * Logs in a user using email and password. * diff --git a/src/services/remote-signer.ts b/src/services/remote-signer.ts index b4e00532..8af9224c 100644 --- a/src/services/remote-signer.ts +++ b/src/services/remote-signer.ts @@ -24,23 +24,6 @@ export class RemoteSignerService extends Service implements RemoteSignerServiceP this.remoteSigner = params.remoteSigner; } - /** - * Registers a new user using email and password. - * - * @param email - The email address - * @param firstName - The first name - * @param lastName - The last name - * @param password - The password - * @returns The JWT token - */ - register(email: string, firstName: string, lastName: string, password: string): Promise { - invariant(this.remoteSigner.url, 'No URL set'); - invariant(this.remoteSigner.credentials, 'No authentication data set'); - return RemoteSignerAPI.register(this.remoteSigner.url, email, firstName, lastName, password).then( - (response) => response.token - ); - } - /** * Logs in to the remote signer. * @@ -49,8 +32,8 @@ export class RemoteSignerService extends Service implements RemoteSignerServiceP login(credentials?: RemoteSignerCredentials): Promise { invariant(this.remoteSigner.url, 'No URL set'); const login = { - email: credentials.email ?? this.remoteSigner.credentials.email, - password: credentials.password ?? this.remoteSigner.credentials.password, + email: credentials.email ?? this.remoteSigner.credentials?.email, + password: credentials.password ?? this.remoteSigner.credentials?.password, }; return RemoteSignerAPI.login(this.remoteSigner.url, login.email, login.password).then((response) => response.token); } diff --git a/src/types/remote-signer.ts b/src/types/remote-signer.ts index bc53d02e..5105a0ff 100644 --- a/src/types/remote-signer.ts +++ b/src/types/remote-signer.ts @@ -29,17 +29,10 @@ export class RemoteSigner extends Signer { this.remoteSignerService = new RemoteSignerService({ remoteSigner: this }); } - async register(email: string, firstName: string, lastName: string, password: string): Promise { - return this.remoteSignerService.register(email, firstName, lastName, password).then((token) => { - this.token = token; - return token; - }); - } - async login(credentials?: RemoteSignerCredentials): Promise { const login = { - email: credentials?.email ?? this.credentials.email, - password: credentials?.password ?? this.credentials.password, + email: credentials?.email ?? this.credentials?.email, + password: credentials?.password ?? this.credentials?.password, }; return this.remoteSignerService.login(login).then((token) => { this.token = token;