Joi Factom
Joi extension for validating Factom data.
Install and import
Install for your project:
npm install joi-factom
Import the extension:
const Joi = ;
Validate Factoid addresses
Use Joi.factom().factoidAddress([type])
.
const Joi = ; // Validate if a string is either a public or private Factoid addressconst fctSchema = Joi;// Validate if a string is a public Factoid addressconst publicFctSchema = Joi;// Validate if a string is a private Factoid addressconst secretFctSchema = Joi; // 'secret' is interchangeable with 'private' keyword Joi;Joi;Joi;
Validate Entry Credit addresses
Use Joi.factom().entryCreditAddress([type])
.
const Joi = ; // Validate if a string is either a public or private Entry Credit addressconst ecSchema = Joi;// Validate if a string is a public Entry Credit addressconst publicEcSchema = Joi;// Validate if a string is a private Entry Credit addressconst secretEcSchema = Joi; // 'secret' is interchangeable with 'private' keyword Joi;Joi;Joi;
Validate Identity keys
Use Joi.factom().identityKey([type])
.
const Joi = ; // Validate if a string is either a public or private identity keysconst idSchema = Joi;// Validate if a string is a public identity keyconst publicIdSchema = Joi;// Validate if a string is a private identity keyconst secretIdSchema = Joi; // 'secret' is interchangeable with 'private' keyword Joi;Joi;Joi;
Validate Server Identity keys
Use Joi.factom().serverIdentityKey([{type: string, priority: number}])
.
const Joi = ; // Validate if a string is either a public or private identity keys of any priorityconst idSchema = Joi;// Validate if a string is a public identity keyconst publicIdSchema = Joi;// Validate if a string is a private identity keyconst secretIdSchema = Joi; // 'secret' is interchangeable with 'private' keyword// Validate if a string is a key of priority 2 (either public or private)const priority2Schema = Joi;// Validate if a string is a sk1 keyconst sk1Schema = Joi; Joi;Joi;Joi;Joi;Joi;