From a091cb8a70e8e65f4af2777110cc055c8da6da7e Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Thu, 7 Apr 2022 10:27:42 -0700 Subject: [PATCH] feat: generate nonce for HttpAgent calls (#554) * feat: includes nonce generation in httpagent by default --- demos/ledgerhq/src/main.js | 2 - docs/generated/changelog.html | 13 +++++++ e2e/node/basic/counter.test.ts | 24 +++++++++++- e2e/node/canisters/counter.ts | 43 +++++++++++++++++++++- e2e/node/utils/agent.ts | 7 ++-- packages/agent/src/actor.test.ts | 2 +- packages/agent/src/agent/http/http.test.ts | 13 +++++-- packages/agent/src/agent/http/index.ts | 21 ++++++++++- 8 files changed, 110 insertions(+), 15 deletions(-) diff --git a/demos/ledgerhq/src/main.js b/demos/ledgerhq/src/main.js index 4657b34ac..1078d460b 100644 --- a/demos/ledgerhq/src/main.js +++ b/demos/ledgerhq/src/main.js @@ -82,8 +82,6 @@ document.getElementById('sendBtn').addEventListener('click', async () => { // Need to run a replica locally which has ledger canister running on it const agent = new HttpAgent({ host, identity }); - // Ledger Hardware Wallet requires that the request must contain a nonce - agent.addTransform(makeNonceTransform()); const resp = await agent.call(canisterId, { methodName: document.getElementById('methodName').value, diff --git a/docs/generated/changelog.html b/docs/generated/changelog.html index 5d75f50f0..628d9da97 100644 --- a/docs/generated/changelog.html +++ b/docs/generated/changelog.html @@ -28,6 +28,19 @@

Version 0.10.5

versions to 0 for major version updates
  • Removes jest-expect-message, which was making test error messages less useful
  • +
  • +

    + HttpAgent now generates a nonce to ensure that calls are unique by default. If you want + to opt out or provide your own nonce logic, you can now pass an option of + disableNonce: trueduring the agent initialization. +

    +

    + If you are currently using + agent.addTransform(makeNonceTransform()) + , please note that you should remove that logic, or add the disableNonce + option to your agent when upgrading. +

    +
  • Version 0.10.3