fix npm run build
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RedisPkceStore = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
let RedisPkceStore = class RedisPkceStore {
|
||||
// In-memory PKCE store replacing Redis-backed implementation
|
||||
map = new Map();
|
||||
cleanupInterval;
|
||||
constructor() {
|
||||
// periodic cleanup
|
||||
this.cleanupInterval = setInterval(() => {
|
||||
const now = Date.now();
|
||||
for (const [k, v] of this.map.entries()) {
|
||||
if (v.expiresAt <= now)
|
||||
this.map.delete(k);
|
||||
}
|
||||
}, 60 * 1000);
|
||||
}
|
||||
key(state) { return state; }
|
||||
async save(state, data, ttlSeconds = 300) {
|
||||
const expiresAt = Date.now() + ttlSeconds * 1000;
|
||||
this.map.set(this.key(state), { ...data, expiresAt });
|
||||
}
|
||||
async get(state) {
|
||||
const v = this.map.get(this.key(state));
|
||||
if (!v)
|
||||
return null;
|
||||
if (v.expiresAt <= Date.now()) {
|
||||
this.map.delete(this.key(state));
|
||||
return null;
|
||||
}
|
||||
return { code_verifier: v.code_verifier, nonce: v.nonce, returnTo: v.returnTo };
|
||||
}
|
||||
async remove(state) {
|
||||
this.map.delete(this.key(state));
|
||||
}
|
||||
onModuleDestroy() {
|
||||
if (this.cleanupInterval)
|
||||
clearInterval(this.cleanupInterval);
|
||||
}
|
||||
};
|
||||
exports.RedisPkceStore = RedisPkceStore;
|
||||
exports.RedisPkceStore = RedisPkceStore = __decorate([
|
||||
(0, common_1.Injectable)(),
|
||||
__metadata("design:paramtypes", [])
|
||||
], RedisPkceStore);
|
||||
//# sourceMappingURL=redis-pkce.store.js.map
|
||||
Reference in New Issue
Block a user