For English version, please click here.

TENCENT SOTER profile

TENCENT SOTER is a biometric authentication platform and standard developed by TENCENT in 2015. Through cooperation with manufacturers, it has been supported on more than 100 Android devices and the number is still growing rapidly.

At present, TENCENT SOTER has been used and verified in wechat fingerprint payment, wechat public account/mini program fingerprint authorization interface and other scenarios.

With TENCENT SOTER, you can realize trusted fingerprint authentication on Android devices without obtaining users’ fingerprint patterns, and get a safe and fast authentication experience consistent with wechat fingerprint payment.

Quick access to the

You can quickly experience the TENCENT SOTER Completed fingerprint authorization interface in a few lines of code.

Before using, make sure the test machine you are using is in the supported model list.

Add gradle dependencies

Add the TENCENT SOTER dependency in your project build.gradle

dependencies { ... The compile 'com. Tencent. Soter: soter - wrapper: 1.3.2'... }Copy the code

Declare permissions

Add fingerprint permission to androidmanifest.xml

<uses-permission android:name="android.permission.USE_FINGERPRINT"/>Copy the code

Initialize the

The initialization process is used to generate basic configurations and check device support status only once in the application declaration period. You can choose to initialize it in Application onCreate() or before using TENCENT SOTER.

InitializeParam param = new InitializeParam. InitializeParamBuilder () setScenes value (0) / / scene, subsequent use the constants in the key generation or fingerprint authentication. The build ();  SoterWrapperApi.init(context, new SoterProcessCallback<SoterProcessNoExtResult>() {... }, param);Copy the code

To prepare the key

You need to generate the relevant key before using fingerprint authentication

SoterWrapperApi.prepareAuthKey(new SoterProcessCallback<SoterProcessKeyPreparationResult>() {... },false, true, 0, null, null);Copy the code

Fingerprint Authentication

After the key is generated, you can use the encapsulation interface to invoke the fingerprint sensor for authentication.

AuthenticationParam param = new AuthenticationParam.AuthenticationParamBuilder() .setScene(0) .setContext(MainActivity.this) .setFingerprintCanceller(mSoterFingerprintCanceller) .setPrefilledChallenge("test challenge") .setSoterFingerprintStateCallback(new SoterFingerprintStateCallback() {... }).build(); SoterWrapperApi.requestAuthorizeAndSign(new SoterProcessCallback<SoterProcessAuthenticationResult>() {... }, param);Copy the code

The release of

When you stop using TENCENT SOTER, you can choose to release all resources to stop all build, upload tasks and support status. When released and used again, it needs to be re-initialized. In fact, TENCENT SOTER doesn’t take up too much resources on its own, and you just release it once if you’re sure you won’t use it again (for example, before switching accounts).

SoterWrapperApi.release();Copy the code

More documentation

  • Want to know more about TENCENT SOTER? Look here.
  • Want more security for login and even payment scenarios? Look here.

Contribute code

Developers are welcome to contribute code rich TENCENT SOTER app, please refer to this document.

agreement

TENCENT SOTER is based on BSD protocol. Refer to the protocol documentation.

A Quick Look at TENCENT SOTER

TENCENT SOTER is a biometric standard as well as a platform held by Tencent.

There are more than 100 models, hundreds of millions Android devices supporting TENCENT SOTER, and the number is still increasing fast.

TENCENT SOTER has been already used in scenarios like WeChat fingerprint payment, fingerprint authentication in Official Account Webpages and Mini Programs.

You can get a consistent experience in fingerprint authenticating in your application, like what it is like in WeChat Payment, by getting access to TENCENT SOTER.

Quick Start

You can get access to TENCENT SOTER in few lines of code to quick experience.

You should make sure your device for testing is in support list.

Add Gradle Dependency

Add TENCENT SOTER dependency in your project’s build.gradle

dependencies { ... The compile 'com. Tencent. Soter: soter - wrapper: 1.3.2'... }Copy the code

Declare Permission

Add fingerprint permission declaration in AndroidManifest.xml

<uses-permission android:name="android.permission.USE_FINGERPRINT"/>Copy the code

Initialize

You need to initialize only once in application’s lifecycle. You can either do it in Application‘s onCreate(), or anywhere before you need to use TENCENT SOTER.

InitializeParam param = new InitializeParam.InitializeParamBuilder() .setScenes(0) // The senary constant for business index .build(); SoterWrapperApi.init(context, new SoterProcessCallback<SoterProcessNoExtResult>() {... }, param);Copy the code

Prepare Keys

You need to prepare keys before authentication process.

SoterWrapperApi.prepareAuthKey(new SoterProcessCallback<SoterProcessKeyPreparationResult>() {... },false, true, 0, null, null);Copy the code

Authenticate With Fingerprint

You can use wrapped interface to authenticate when fingerprint.

AuthenticationParam param = new AuthenticationParam.AuthenticationParamBuilder() .setScene(0) .setContext(MainActivity.this) .setFingerprintCanceller(mSoterFingerprintCanceller) .setPrefilledChallenge("test challenge") .setSoterFingerprintStateCallback(new SoterFingerprintStateCallback() {... }).build(); SoterWrapperApi.requestAuthorizeAndSign(new SoterProcessCallback<SoterProcessAuthenticationResult>() {... }, param);Copy the code

Release

You can release all the resource when you do not use TENCENT SOTER again by calling release. It will abort on-going tasks and remove support status. TENCENT SOTER will not occupy too much room actually. You can only do it when you confirm that you did not need to use it, like switch an account.

SoterWrapperApi.release();Copy the code

More Document

Contributing

For more information about contributing issues or pull requests, check our CONTRIBUTING document.

License

TENCENT SOTER is based on BSD license. Please check our LICENSE document.