From 178cb01ef8af33b6de98181f555c42674811df65 Mon Sep 17 00:00:00 2001 From: Kyle Peacock Date: Wed, 30 Mar 2022 15:23:50 -0700 Subject: [PATCH] feat: support idle management in AuthClient (#547) * feat: idleManager * feat: setup idleManager in authClient * test: full lifecycle test of idle logout * some basic documentation * feat: registerActor and registerCallback Allows the authClient to register actors to automatically invalidate them going idle, or revalidate them after logging in * fixing test typing * reverting actorMap and using onIdle for creation options * friendlier JSDOC formatting * changelog * typescript checks for tests * feat: idleManager * feat: setup idleManager in authClient * test: full lifecycle test of idle logout * some basic documentation * feat: registerActor and registerCallback Allows the authClient to register actors to automatically invalidate them going idle, or revalidate them after logging in * fixing test typing * reverting actorMap and using onIdle for creation options * friendlier JSDOC formatting * changelog * typescript checks for tests * chore: setting default idle timeout to 10 minutes --- docs/generated/changelog.html | 6 + packages/auth-client/README.md | 34 +++++ packages/auth-client/src/idleManager.test.ts | 97 +++++++++++++ packages/auth-client/src/idleManager.ts | 136 +++++++++++++++++++ packages/auth-client/src/index.test.ts | 127 ++++++++++++++++- packages/auth-client/src/index.ts | 31 ++++- 6 files changed, 427 insertions(+), 4 deletions(-) create mode 100644 packages/auth-client/src/idleManager.test.ts create mode 100644 packages/auth-client/src/idleManager.ts diff --git a/docs/generated/changelog.html b/docs/generated/changelog.html index e5f15c9cb..6b3ead8fd 100644 --- a/docs/generated/changelog.html +++ b/docs/generated/changelog.html @@ -16,6 +16,12 @@

Version 0.10.5

makeNonce now returns unique values. Previously only the first byte of the nonce was populated. +
  • + Introduces IdleManager to the auth-client. You can now use it to detect when the user has + been idle for a configurable amount of time, and then to register callbacks for the sake + of logging the user out and prompting re-authentication. See the @dfinity/auth-client + Readme for more details +
  • Version 0.10.3