Socket
Socket
Sign inDemoInstall

global-input-react

Package Overview
Dependencies
37
Maintainers
1
Versions
185
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    global-input-react

global input react component


Version published
Weekly downloads
4
increased by100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

This is a Global Input App React JS library for applications that are running on computers, SmartTV, IoT and other smart devices to have mobile integration. With the mobile integration, users will be able to use their mobiles to operate on the applications to enjoy many mobile-related features such as Mobile Encryption, Mobile Authentication, Mobile Input & Control, Second Screen Experience, Mobile Personal Storage, Mobile Encryption & Signing, Mobile Content Transfer etc.

Setup

npm i global-input-react

Usage

You just need to pass a configuration to the useGlobalInputApp function, specifying the user interface elements that the Global Input App should display to the user. The mobile application transfers the result of the user interactions with those elements via a secure communication powered by end-to-end encryption.

For example, following will display a Sign In form on the connected mobile device, and the application will receive the events as the user interacts with it:


import {useGlobalInputApp} from 'global-input-react';
import React  from 'react';


export default ({login}){  
  
  const initData={                              
     form:{
       title:"Sign In",
       id:"###username###@mycompany.com",  
       fields:[{
         label:"Username",
         id:"username",
         type:"text"        
       },{
         label:"Password",
         type:"text",        
         id:"password"         
      },{
        label:"Sign In",
        type:"button",            
        operations: {
          onInput:() => login(username, password)
        }
     }]
    }  
 };
 const globalInputApp=useGlobalInputApp({initData});    
    const {connectionMessage,WhenConnected, values}=globalInputApp;
    const [username,password]=values;

    return (
        <>
           {connectionMessage}
          <WhenConnected>
            Now operate on your mobile to login
          </WhenConnected>             
        </>
    );
  };

When the above application runs, it displays an encrypted QR code in the place of connectionMessage that a user would use the Global Input App to scan to establish a communication secured with end-to-end encryption. The values variable that is returned by useGlobalInputApp will contains the received values matching the form fields specified. The id of the form is used by the mobile app to locate an existing data in its encrypted storage for autofill operation.

If a field in a form has the type attribute with "encrypt", its content will be encrypted and sent to the application. In the same way, if the type "decrypt", the content will be decrypted. You may employ this to secure the data stored on the cloud. For more information, please visit Global Input Website.

The some of the useful attribute values in the object that is returned by useGlobalInputApp are listed in the table below:

AttributesDescription
connectionMessageThe connection information that the Global Input App scans to establish a secure connection to the application
valuesAn array of values that corresponds to the fields in the forms
settersAn array of functions, each corresponds to a field in the form, and you can use it set the value of the matching field
WhenWaitingA container React component that you can use it to wrap content that you would like to display only when the application waiting for the user to connect
WhenConnectedA container React component that you can use it to wrap content that you would like to display only when a user has connected to the application
WhenDisconnectedA container React component that you can use it to wrap content that you would like to display only when a user has connected and then disconnected
WhenErrorA container React component that you can use it to wrap content that you would like to display only when the library throws error, you can use {errorMessage} to find out what has happenned, for example <WhenError>{errorMessage}</WhenError>
errorMessagethis variable wil be populated when an error occurs within the library

Keywords

FAQs

Last updated on 20 Feb 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc