Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
global-input-react
Advanced tools
This React JS library allows you to introduce interoperability between your mobile app and your React applications. With this library, you will be able to receive mobile events from within your React applications, implementing interoperability logic in your device application instead of separating it across the two interacting applications. This mechanism offers a range of features that include Mobile Encryption, Mobile Authentication, Mobile Input & Control, Second Screen Experience, Mobile Personal Storage, Mobile Encryption & Signing, Mobile Content Transfer.
npm i global-input-react
The custom React hook useGlobalInputApp
allows a React component specify a mobile user interface declaratively.
The following example application defines a login screen allowing user to use their mobile to carry out login operation using their mobile.
import {useGlobalInputApp} from 'global-input-react';
import React, {useState} from 'react';
const initData={
form:{
title: 'Sign In',
id: '###username###@mycompany.com',
fields: [{
label: 'Username',
id: 'username'
},{
label: 'Password',
id: 'password',
},{
id: 'login',
label: 'Sign In',
type: 'button'
}]
}
};
export default ({login}){
const [username,setUser] = useState('');
const [password,setPassword] = useState('');
const {connectionMessage,setOnFieldChanged}=useGlobalInputApp({initData});
setOnFieldChanged(({field})=>{
const fds=initData.form.fields;
switch(field.id){
case fds[0].id: setUsername(field.value); break;
case fds[1].id: setPassword(field.value); break;
case fds[2].id: login(username,password);
}
});
return (
<>
{connectionMessage}
</>
);
};
The content of {connectionMessage}
returned by the hook contains an encrypted QR Code that you can scan to connect to the application. Having connected, your mobile displays the user interface specified in the initData
variable, allowing you to operate on the application. You can use setOnFieldChanged
function to set your callback function to receive the form events through the field
variable.
The initData
specifies a form, in which id
is used for autofill operation inside the connected mobile app through filtering the existing data in its encrypted storage. The form contain a set of fields, representing data that device application and the connected mobile need to collaborate on composing. The type of each field defines the related data operation. For example, if the type is "encrypt"/"decrypt", the mobile app initiates the encrypt/decrypt workflow inside the mobile app. This is useful when you would like to secure data stored on other devices or cloud.
Other values returned by the useGlobalInputApp
function are listed in the table below:
Attributes | Description |
---|---|
connectionMessage | The variable containing the QR Code for the mobile app to scan to obtain the connection information securely |
setFieldValueById | The function you can use interact with the form displayed on the connected mobile app. |
field | The field that contains the id and value of the field sent by the mobile app |
WhenWaiting | A 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 |
WhenConnected | A 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 |
WhenDisconnected | A 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 |
WhenError | A container React component that you can use it to wrap content that you would like to display when there is an error, you can use {errorMessage} to find out what has happened, for example <WhenError>{errorMessage}</WhenError> |
errorMessage | This value wil be populated when an error is raised |
The type definition file is included within the module. You can obtain more information from this end-to-end test example on how to use this library within a TypeScript application.
FAQs
global input react component
The npm package global-input-react receives a total of 0 weekly downloads. As such, global-input-react popularity was classified as not popular.
We found that global-input-react demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.