Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Include an auto-lock feature that locks Alby after a certain amount of time #2625

Open
brihuang99 opened this issue Aug 2, 2023 · 5 comments
Assignees
Labels
hacktoberfest idea A feature idea that needs to be more specification

Comments

@brihuang99
Copy link

Feature description

As of right now, the web extension for Alby does not have an auto-locking feature. Users have to manually open the extension and select 'Lock'. For users who desire an increased sense of security and to follow practices of other hot wallets, providing an auto-locking feature that will lock Alby after a specified amount of time may prove to be useful.

Describe the solution

Front-end

Screenshot_20230802_101118

I believe that a good place in the UI for this feature would be adding a row under 'Settings' and giving users a drop down with some time intervals (1 minute, 5 minutes, 10 minutes, etc.)

I can provide a basic mock up for this later today.

Back-end

There would need to be a function for Alby to track the amount of time that has passed and then execute the locking of the wallet. Maybe create a JavaScript Date object?

Describe alternatives

No response

Additional context

No response

Are you working on this?

Yes

@brihuang99 brihuang99 added the idea A feature idea that needs to be more specification label Aug 2, 2023
@brihuang99
Copy link
Author

Here are the designs:

Default

Screenshot_20230802_144414

Drop down options

Screenshot_20230802_144428

New option selected

Screenshot_20230802_144440

I think there could be a number of time intervals to provide. Here's the Figma link for reference.

P.S. I also noticed that right now in prod, the drop down arrow does not invert when the field is opened; that should be something to fix, though minor.

@pushp1997
Copy link

Hi, I would like to work on this, can you please assign this to me?

@rolznz
Copy link
Contributor

rolznz commented Oct 5, 2023

Hi @pushp1997 , thanks for offering. Go ahead!

@pushp1997
Copy link

Hi @rolznz

Just a doubt, I am thinking to do it in this way:

let autoLockTimeout: NodeJS.Timeout | undefined;

function startAutoLockTimer(timeoutMinutes: number): void {
  const auth = useAccount();
  const timeoutMilliseconds = timeoutMinutes * 60 * 1000;
  autoLockTimeout = setTimeout(async () => {
    auth.lock(() => {
      window.close();
    });
  }, timeoutMilliseconds);
}

/**
 * Get the active auto lock preference and start the background process to lock the app
 */
export function setAutoLock(): void {
  api.getSettings().then((settings) => {
    // check if settings theme selection is system (this is the default)
    if (settings.autoLock === "1_min") {
      startAutoLockTimer(1);
    } else if (settings.autoLock === "5_mins") {
      startAutoLockTimer(5);
    } else if (settings.autoLock === "10_mins") {
      startAutoLockTimer(10);
    } else if (settings.autoLock === "30_mins") {
      startAutoLockTimer(30);
    } else {
      // settings.autoLock === "off"
      clearTimeout(autoLockTimeout);
    }
  });
}

Where should I keep this global variable autoLockTimeout?
I am keeping the setAutoLock() in src/app/utils/index.ts and will call it from SettingsContext.tsx.

@rolznz
Copy link
Contributor

rolznz commented Oct 19, 2023

@pavanjoshi914 could you review this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest idea A feature idea that needs to be more specification
Projects
None yet
Development

No branches or pull requests

4 participants