Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
com.guardanis:applock
Advanced tools
A simple library for locking and unlocking Activities (e.g. child lock) with a PIN code or Fingerprint.
A simple library for locking and unlocking Activities with a PIN code or Fingerprint (e.g. a child lock).
repositories {
maveCentral()
}
dependencies {
compile('com.guardanis:applock:3.0.2')
}
The goal of AppLock is to allow users to enroll and authenticate with a PIN or Fingerprint to lock the application from being used by unauthorized parties.
To open the Activity to create a PIN, you can simply open the AppLockActivity
via (PS: If you want to use the dialog instead of the Activity (which looks cooler), see the dialog stuff below) Intents
:
Intent intent = new Intent(activity, LockCreationActivity.class);
startActivityForResult(intent, LockingHelper.REQUEST_CODE_CREATE_LOCK);
To check if the user has elected to enroll in AppLock authentication, you can simply call AppLock.isEnrolled(Contect) and redirect to the UnlockActivity if the action requires authentication:
Intent intent = new Intent(activity, UnlockActivity.class);
startActivityForResult(intent, AppLock.REQUEST_CODE_ULOCK);
If you want to do both of the above in a single step (that is, check if the user is enrolled and open the unlock flow if true), you can call:
if(!AppLock.unlockIfRequired(Activity))
doSomethingThatRequiresLockingIfEnabled();
...
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data){
if(requestCode == LockingHelper.REQUEST_CODE_ULOCK && resultCode == Activity.RESULT_OK)
doSomethingThatRequiresLockingIfEnabled();
}
If you want to do the above with a Dialog, instead of an Activity (which looks cooler), you can simply call:
new UnlockDialogBuilder(activity)
.onUnlocked(() -> { doSomethingThatRequiresLockingIfEnabled(); })
.onCanceled(() -> { })
.showIfRequiredOrSuccess(TimeUnit.MINUTES.toMillies(15));
Or, create the enrollment with a Dialog:
new LockCreationDialogBuilder(this)
.onCanceled(() -> { showIndicatorMessage("You canceled..."); })
.onLockCreated(() -> { showIndicatorMessage("Lock created!"); })
.show()
If you want an Activity to remain fully locked once a PIN has been entered, ensure that you override onPostResume() and call AppLock.onActivityResumed(Activity); e.g.
@Override
protected void onPostResume(){
super.onPostResume();
AppLock.onActivityResumed(this);
}
or you can simply have your Activity extend the LockableCompatActivity supplied with this library.
By default, AppLock considers a successful login as valid for 15 minutes, regardless of application state. You can shorten or extend that length by overriding the integer value for applock__activity_lock_reenable_minutes in your resources. Doing so will cause any Activity to re-open the UnlockActivity after the delay has passed. If you only want authentication present on a specific action (e.g. payments), you should use the UnlockDialogBuilder
's methods posted above instead of locking the entire Activity.
To change the default length of the PIN, you can override
<integer name="applock__input_pin_item_count">4</integer>
All themes, styles, dimensions, strings, etc. are all customizable via overriding the resources. See applock/src/main/res/values/
for details.
As of version 3.0.2, applock will be hosted on MavenCentral. Versions 3.0.1 and below will remain on JCenter.
FAQs
A simple library for locking and unlocking Activities (e.g. child lock) with a PIN code or Fingerprint.
We found that com.guardanis:applock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.