npm package diff
Package: @forge/cli-shared
Versions: 8.3.0-next.1 - 8.3.0-next.0-experimental-8a53773
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,8 +60,9 @@
keytar;
cachedConfig;
userRepository;
keytarAccount;
+ cached = null;
constructor(logger, instructionsURL, keytar, cachedConfig, userRepository) {
this.logger = logger;
this.instructionsURL = instructionsURL;
this.keytar = keytar;
@@ -129,8 +130,11 @@
deleteInsecurePlaintextCredentials() {
this.cachedConfig.delete(CACHE_CREDENTIALS_KEY);
}
async getCredentials() {
+ if (this.cached) {
+ return this.cached;
+ }
const plaintextCredentials = this.popInsecurePlaintextCredentials();
if (plaintextCredentials) {
if (this.keytar) {
await this.setCredentials(plaintextCredentials);
@@ -150,14 +154,16 @@
}
if (this.keytar) {
const result = await this.getCredentialsKeytar(this.keytar);
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));
}
@@ -169,8 +175,9 @@
throw new NoKeytarError();
}
}
async deleteCredentials() {
+ this.cached = null;
if (this.keytar) {
try {
await this.keytar.deletePassword(KEYTAR_SERVICE, this.keytarAccount);
}