curator-bb
v0.1.1-beta
Published
<!-- # React + TypeScript + Vite
Downloads
91
Maintainers
Readme
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/[email protected]/+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.
| Key | Required | value | Description |
| ----------- | :-----------: | :-----------: | :----------- |
| serverURL | true
| string | It is used call the back office server base URL. |
| operatorId | true
| string | It is used to identify the operator/developer, who created account at back office. |
| appId | true
| string | It is used to uniquely identify the application. |
| password | true
| string | It is used to validate the operator/developer. |
| onMessage | false
| function | It 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({
...
});
}
}
| Key | Required | value | Description |
| ----------- | :-----------: | :-----------: | :----------- |
| userDetails | true
| object | It is used to get the user details, given in the form. |
| onMessage | false
| function | It 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