Skip to content

Commit

Permalink
feat: uses expirable map for subnet keys
Browse files Browse the repository at this point in the history
  • Loading branch information
krpeacock committed Nov 8, 2023
1 parent 963ef63 commit c9da0f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/generated/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ <h1>Agent-JS Changelog</h1>
<section>
<h2>Version x.x.x</h2>
<ul>
<li>feat: uses expirable map for subnet keys in agent-js, with a timeout of 1 hour</li>
<ul>
<strong>feat!: node signature verification</strong
><br />
Expand Down
5 changes: 4 additions & 1 deletion packages/agent/src/agent/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { AgentHTTPResponseError } from './errors';
import { SubnetStatus, request } from '../../canisterStatus';
import { CertificateVerificationError } from '../../certificate';
import { ed25519 } from '@noble/curves/ed25519';
import { ExpirableMap } from '../../utils/expirableMap';
import { Ed25519PublicKey } from '../../public_key';

export * from './transforms';
Expand Down Expand Up @@ -186,7 +187,9 @@ export class HttpAgent implements Agent {
#queryPipeline: HttpAgentRequestTransformFn[] = [];
#updatePipeline: HttpAgentRequestTransformFn[] = [];

#subnetKeys: Map<string, SubnetStatus> = new Map();
#subnetKeys: ExpirableMap<string, SubnetStatus> = new ExpirableMap({
expirationTime: 60 * 60 * 1000, // 1 hour
});
#verifyQuerySignatures = true;

constructor(options: HttpAgentOptions = {}) {
Expand Down

0 comments on commit c9da0f2

Please sign in to comment.