attempt to reduce size and use native crypto

This commit is contained in:
fyears
2021-12-04 00:55:31 +08:00
parent 789d07261e
commit 62936c4473
5 changed files with 28 additions and 38 deletions
+5 -8
View File
@@ -32,8 +32,7 @@ import { WebdavConfig, DEFAULT_WEBDAV_CONFIG, WebdavAuthType } from "./webdav";
import {
DropboxConfig,
DEFAULT_DROPBOX_CONFIG,
getCodeVerifierAndChallenge,
getAuthUrl,
getAuthUrlAndVerifier,
sendAuthReq,
setConfigBySuccessfullAuthInplace,
} from "./remoteForDropbox";
@@ -296,13 +295,11 @@ export class DropboxAuthModal extends Modal {
this.revokeAuthSetting = revokeAuthSetting;
}
onOpen() {
async onOpen() {
let { contentEl } = this;
const k = getCodeVerifierAndChallenge();
const authUrl = getAuthUrl(
this.plugin.settings.dropbox.clientID,
k.challenge
const { authUrl, verifier } = await getAuthUrlAndVerifier(
this.plugin.settings.dropbox.clientID
);
contentEl.createEl("p", {
@@ -336,7 +333,7 @@ export class DropboxAuthModal extends Modal {
try {
const authRes = await sendAuthReq(
this.plugin.settings.dropbox.clientID,
k.verifier,
verifier,
authCode
);
const self = this;