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
155 stars 96 forks source link

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

Closed krpeacock closed 1 month ago

krpeacock commented 4 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 4 months ago

size-limit report 📦

Path Size
@dfinity/agent 86.93 KB (+0.17% 🔺)
@dfinity/candid 13.58 KB (0%)
@dfinity/principal 4.97 KB (0%)
@dfinity/auth-client 61.05 KB (+0.02% 🔺)
@dfinity/assets 81.7 KB (+0.05% 🔺)
@dfinity/identity 58.18 KB (+0.03% 🔺)
@dfinity/identity-secp256k1 131.56 KB (+0.13% 🔺)
krpeacock commented 4 months ago

cc @robin-kunzler for prodsec review