@smartface/security

5.1.7 • Public • Published

Twitter: @Smartface_io License: MIT

Security

Intro

This module provides security tools (e.g. GoogleSafetyNet) for Smartface applications.

GooglePlayServices

Helper class for Google Play Services. Android relies on a security Provider to provide secure network communications. However, from time to time, vulnerabilities are found in the default security provider. To protect against these vulnerabilities, Google Play services provides a way to automatically update a device's security provider to protect against known exploits. By calling Google Play services methods, your app can ensure that it's running on a device that has the latest updates to protect against known exploits.

Example Usage

import { GooglePlayServices } from "@smartface/security";
if (System.OS === "Android") {
  GooglePlayServices.upgradeSecurityProvider()
    .then(() => {
      console.info(
        "Provider is up-to-date, app can make secure network calls."
      );
    })
    .catch((errorCode) => {
      console.error("Error code: ", errorCode);
    });
}

GoogleSafetyNet

Helper class for Google's SafetyNet. SafetyNet provides a set of services and APIs that help protect your app against security threats, including device tampering, bad URLs, potentially harmful apps, and fake users.

Example Usage

import { GoogleSafetyNet } from "@smartface/security";
if (System.OS === System.OSType.ANDROID) {
  const googleSafetyNet = new GoogleSafetyNet({
    apiKey: "**********",
  });
  if (googleSafetyNet.isPlayServicesAvailable()) {
    let nonce = googleSafetyNet.generateNonce();
    // Nonce should be at least 16 bytes length
    googleSafetyNet
      .sendAttestationRequest(nonce)
      .then((jws) => {
        console.info(`JWS ${jws}`);
      })
      .catch((e) => {
        console.error(e);
      });
  } else {
    console.info(
      "Google Play services are not available. You cannot proceed further"
    );
  }
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
5.1.70latest

Version History

VersionDownloads (Last 7 Days)Published
5.1.70
5.1.60
5.1.50
5.1.40
5.1.30
5.1.20
5.1.10
5.1.00
5.1.0-beta.00
5.0.100
5.0.90
5.0.80
5.0.8-alpha.20
5.0.70
5.0.50
5.0.5-alpha.50
5.0.5-alpha.40
5.0.5-alpha.30
5.0.5-alpha.20
5.0.5-alpha.10
5.0.40
5.0.3-beta.20
5.0.30
5.0.2-alpha.00
5.0.10
5.0.00
5.0.0-beta.10
5.0.0-alpha.00
5.0.0-beta.00
1.0.00

Package Sidebar

Install

npm i @smartface/security

Weekly Downloads

0

Version

5.1.7

License

MIT

Unpacked Size

35.6 kB

Total Files

20

Last publish

Collaborators

  • sbasbug
  • alnyli07
  • smf
  • furkan.arabaci