Revert "Support refresh tokens (#7802)"

This reverts commit 839593412c.
This commit is contained in:
Travis Ralston 2022-02-16 12:32:38 -07:00 committed by GitHub
parent 81f52283cf
commit aba61fa390
9 changed files with 25 additions and 504 deletions

View file

@ -44,8 +44,6 @@ export interface IMatrixClientCreds {
userId: string;
deviceId?: string;
accessToken: string;
accessTokenExpiryTs?: number; // set if access token expires
accessTokenRefreshToken?: string; // set if access token can be renewed
guest?: boolean;
pickleKey?: string;
freshLogin?: boolean;
@ -101,14 +99,6 @@ export interface IMatrixClientPeg {
* @param {IMatrixClientCreds} creds The new credentials to use.
*/
replaceUsingCreds(creds: IMatrixClientCreds): void;
/**
* Similar to replaceUsingCreds(), but without the replacement operation.
* Credentials that can be updated in-place will be updated. All others
* will be ignored.
* @param {IMatrixClientCreds} creds The new credentials to use.
*/
updateUsingCreds(creds: IMatrixClientCreds): void;
}
/**
@ -174,15 +164,6 @@ class MatrixClientPegClass implements IMatrixClientPeg {
this.createClient(creds);
}
public updateUsingCreds(creds: IMatrixClientCreds): void {
if (creds?.accessToken) {
this.currentClientCreds = creds;
this.matrixClient.setAccessToken(creds.accessToken);
} else {
// ignore, per signature
}
}
public async assign(): Promise<any> {
for (const dbType of ['indexeddb', 'memory']) {
try {
@ -252,15 +233,7 @@ class MatrixClientPegClass implements IMatrixClientPeg {
}
public getCredentials(): IMatrixClientCreds {
let copiedCredentials = this.currentClientCreds;
if (this.currentClientCreds?.userId !== this.matrixClient?.credentials?.userId) {
// cached credentials belong to a different user - don't use them
copiedCredentials = null;
}
return {
// Copy the cached credentials before overriding what we can.
...(copiedCredentials ?? {}),
homeserverUrl: this.matrixClient.baseUrl,
identityServerUrl: this.matrixClient.idBaseUrl,
userId: this.matrixClient.credentials.userId,