MCPcopy
hub / github.com/authts/oidc-client-ts / InMemoryWebStorage

Class InMemoryWebStorage

src/InMemoryWebStorage.ts:9–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7 * @public
8 */
9export class InMemoryWebStorage implements Storage {
10 private readonly _logger = new Logger("InMemoryWebStorage");
11 private _data: Record<string, string> = {};
12
13 public clear(): void {
14 this._logger.create("clear");
15 this._data = {};
16 }
17
18 public getItem(key: string): string {
19 this._logger.create(`getItem('${key}')`);
20 return this._data[key];
21 }
22
23 public setItem(key: string, value: string): void {
24 this._logger.create(`setItem('${key}')`);
25 this._data[key] = value;
26 }
27
28 public removeItem(key: string): void {
29 this._logger.create(`removeItem('${key}')`);
30 delete this._data[key];
31 }
32
33 public get length(): number {
34 return Object.getOwnPropertyNames(this._data).length;
35 }
36
37 public key(index: number): string {
38 return Object.getOwnPropertyNames(this._data)[index];
39 }
40}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…