MCPcopy
hub / github.com/parse-community/parse-server / loadMasterKey

Method loadMasterKey

src/Config.js:979–998  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

977 }
978
979 async loadMasterKey() {
980 if (typeof this.masterKey === 'function') {
981 const ttlIsEmpty = !this.masterKeyTtl;
982 const isExpired = this.masterKeyCache?.expiresAt && this.masterKeyCache.expiresAt < new Date();
983
984 if ((!isExpired || ttlIsEmpty) && this.masterKeyCache?.masterKey) {
985 return this.masterKeyCache.masterKey;
986 }
987
988 const masterKey = await this.masterKey();
989
990 const expiresAt = this.masterKeyTtl ? new Date(Date.now() + 1000 * this.masterKeyTtl) : null
991 this.masterKeyCache = { masterKey, expiresAt };
992 Config.put(this);
993
994 return this.masterKeyCache.masterKey;
995 }
996
997 return this.masterKey;
998 }
999
1000 get pagesEndpoint() {
1001 return this.pages && this.pages.pagesEndpoint

Callers 4

startMethod · 0.80
resolveKeyAuthFunction · 0.80
index.spec.jsFile · 0.80

Calls 1

putMethod · 0.45

Tested by

no test coverage detected