0.1.1-beta • Published 1 year ago

curator-bb v0.1.1-beta

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

version npm package minimized gzipped size (select exports) downloads jsdelivr NPM

Description :-

curator-bb - used to validate users at any web form. It is made up of React, TypeScript & Vite.

i). Overview

  • The Curator Web SDK serves the primary purpose of validating preregistered users to enhance client app privacy and protect against potential security threats.
  • The package exposes two key APIs: 'initialize' and 'curate'.
  • The 'initialize' API facilitates the registration of users on the client app by making a request to the Axiom Protect server. This request includes parameters such as serverURL, operatorId, appId, and password.
  • Users are required to define their form key name fields for inclusion in the Axiom policy under the pre-registration tab.
  • Upon submitting the form, the 'curate' API is invoked, sending a request to the server, which responds with either 'true' or 'false' based on user validation. This information determines whether the user can proceed with the registration process in the client app.

Installation :-

i). Install at HTML pages

  • Step 1: Be ready with HTML form and import the package
<script type="module">
   // import curator package
   import curatorBB from 'https://cdn.jsdelivr.net/npm/curator-bb@0.1.1/+esm'
</script>
  • Step 2: Initially, call initialize function to get the curator service
   // initialize curator operator
   curatorBB.initialize({
      serverURL: string,
      operatorId: string,
      appId:string,
      password: string,
      onMessage: (arg) => { }
   });

Note: It is recommended to call initialize function before calling user validator.

KeyRequiredvalueDescription
serverURLtruestringIt is used call the back office server base URL.
operatorIdtruestringIt is used to identify the operator/developer, who created account at back office.
appIdtruestringIt is used to uniquely identify the application.
passwordtruestringIt is used to validate the operator/developer.
onMessagefalsefunctionIt is used get the response with more details (Optional).
  • Step 3: Call curate function to get the curator service
   // form submission with curator for validating user
   curatorBB.curate({
      userDetails: object, 
      onMessage: (arg) => { }
   });

Note: It is recommended to call curate function after initializing the operator/developer. And make sure you prevent default.

Example :-

document.addEventListener("DOMContentLoaded", function () {
   document.getElementById("myForm").addEventListener("submit", function (event) {
      // Prevent the default form submission behavior
      event.preventDefault();
      ...
      // call curate
      curatorBB.curate({
         ...
      });
   }
}
KeyRequiredvalueDescription
userDetailstrueobjectIt is used to get the user details, given in the form.
onMessagefalsefunctionIt is used get the response with more details (Optional).

You can get the return response or can use onMessage to know more about the return response. Use with one argument and check for arg.code

  • 0 - failed message
  • 1 - success message
  • 2 - info message
  • -1 - error message

Authors

0.1.1-beta

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.14

1 year ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago