import {PeerId} from "./@types/libp2p"; import {bytes, bytes32} from "./@types/basic"; /** * Storage for static keys of previously connected peers. */ class Keycache { private storage = new Map(); public async store(peerId: PeerId, key: bytes32): Promise { this.storage.set(peerId.id, key); } public async load(peerId: PeerId): Promise { return this.storage.get(peerId.id); } public resetStorage(): void { this.storage.clear(); } } const KeyCache = new Keycache(); export { KeyCache, }