admob-ssv
Version:
Tool for validate AdMob rewarded ads signatures SSV
18 lines • 584 B
JavaScript
import MemoryCache from './cache/memory';
import Fetcher from './fetcher';
export default class KeyProvider {
constructor(options = {}) {
this.cache = options.cache || new MemoryCache();
this.fetcher = options.fetcher || new Fetcher();
}
async get(keyId) {
if (!(await this.cache.has(keyId))) {
const keys = await this.fetcher.fetch();
for (const rawKey of keys) {
await this.cache.save(rawKey);
}
}
return await this.cache.get(keyId);
}
}
//# sourceMappingURL=provider.js.map