dfinity / agent-js

A collection of libraries and tools for building software around the Internet Computer, in JavaScript.
https://agent-js.icp.xyz
Apache License 2.0
153 stars 95 forks source link

feat: allow for setting HttpAgent ingress expiry using `ingressExpiryInMinutes` option #905

Open krpeacock opened 3 months ago

krpeacock commented 3 months ago

Description

Simply adds a configurable ingress expiry option. Includes checks against <= 0 and > 5 minutes, new errors, and e2e tests about behavior.

Important question to resolve: when the expiry is less than or equal to one minute, the tests often fail in practice due to the current "round down to the nearest minute". How should the agent handle this?

Resolution - now matches the agent-rs strategy and rounds down to the nearest second when the delta is < 90 seconds

My suggestion would be either

How Has This Been Tested?

new e2e tests and unit tests

Checklist:

github-actions[bot] commented 3 months ago

size-limit report 📦

Path Size
@dfinity/agent 86.1 KB (+0.13% 🔺)
@dfinity/candid 13.58 KB (0%)
@dfinity/principal 4.97 KB (0%)
@dfinity/auth-client 60.85 KB (+0.01% 🔺)
@dfinity/assets 80.66 KB (+0.01% 🔺)
@dfinity/identity 58.04 KB (+0.01% 🔺)
@dfinity/identity-secp256k1 266.88 KB (+0.12% 🔺)
krpeacock commented 3 months ago

cc @robin-kunzler for prodsec review