npm package diff
Package: @forge/cli-shared
Versions: 8.3.1-next.3 - 8.3.1-next.1-experimental-b4d61da
File: package/out/auth/personal/credential-store.js
Index: package/out/auth/personal/credential-store.js
===================================================================
--- package/out/auth/personal/credential-store.js
+++ package/out/auth/personal/credential-store.js
@@ -60,9 +60,8 @@
keytar;
cachedConfig;
userRepository;
keytarAccount;
- cached = null;
constructor(logger, instructionsURL, keytar, cachedConfig, userRepository) {
this.logger = logger;
this.instructionsURL = instructionsURL;
this.keytar = keytar;
@@ -130,12 +129,8 @@
deleteInsecurePlaintextCredentials() {
this.cachedConfig.delete(CACHE_CREDENTIALS_KEY);
}
async getCredentials() {
- if (this.cached) {
- return this.cached;
- }
- let result;
const plaintextCredentials = this.popInsecurePlaintextCredentials();
if (plaintextCredentials) {
if (this.keytar) {
await this.setCredentials(plaintextCredentials);
@@ -150,21 +145,19 @@
email: process.env[exports.EMAIL_KEY],
token: process.env[exports.API_TOKEN_KEY]
};
const { accountId } = await this.userRepository.getUser(credentials);
- result = { ...credentials, accountId };
+ return { ...credentials, accountId };
}
- else if (this.keytar) {
- result = await this.getCredentialsKeytar(this.keytar);
+ if (this.keytar) {
+ const result = await this.getCredentialsKeytar(this.keytar);
+ if (result) {
+ return result;
+ }
}
- if (result) {
- this.cached = result;
- return result;
- }
throw new NoTokenInStoreError();
}
async setCredentials(credentials) {
- this.cached = null;
if (this.keytar) {
try {
await this.keytar.setPassword(KEYTAR_SERVICE, this.keytarAccount, JSON.stringify(credentials));
}
@@ -176,9 +169,8 @@
throw new NoKeytarError();
}
}
async deleteCredentials() {
- this.cached = null;
if (this.keytar) {
try {
await this.keytar.deletePassword(KEYTAR_SERVICE, this.keytarAccount);
}