saqib-verinvo v0.1.7
Verinvo SDK Documentation
Overview
Verinvo revolutionizes invoice security by combining blockchain's robustness with the efficiency of a centralized system, ensuring secure, transparent, and meticulously recorded invoice lifecycles. Its design emphasizes transaction integrity through digital signatures, supports both online and offline operations, and meets diverse business needs. Verinvo enables businesses to secure transactions, comply with regulations, and ensure the reliability of digital invoices with blockchain technology.
Installation
Before you begin, ensure you have the necessary dependencies for the Verinvo library.
Getting Started
To start using the Verinvo library in your project, you'll first need to initialize it with your API credentials and the base URL of your backend service.
Initialization
Create an instance of the Verinvo class by passing your API key, API secret, and the base URL as follows:
const verinvo = new Verinvo('yourApiKey', 'yourApiSecret', 'yourBaseUrl');
Ensure that all three parameters are provided; otherwise, an error will be thrown.
Signing a Device
To sign a device, create an object containing the device's details and pass it to the signDevice method of your Verinvo instance.
Required Device Details
- deviceName: A unique name identifying the device.
- deviceType: The type of device (e.g., sensor, actuator).
- deviceSerial: A unique serial number for the device.
- authority: The authority under which the device is registered.
- businessId: A unique identifier for the business entity the device is associated with.
Example
const deviceDetails = {
deviceName: 'MyDevice',
deviceType: 'harware',
deviceSerial: '123456789',
authority: 'AAD',
businessId: '001'
};
const signedDevice = verinvo.signDevice(deviceDetails);
The signDevice method will throw an error if any required device details are missing.
Upon successful device signing, the method returns an object containing the device's public key, public key signature, and additional signatures returned from the signing service. for example:
{
"id": "1",
"publicKey" : "86e5d4b18b3756b94b68c6bc2613c933fd290ae2e04c3145655fb0a6d02d4d44",
"privateKey" : "8f69f066ad23ac7876c2158341b6e50448b756e6648023eac7ed7867cb883a93",
"publicKeySignature" : "1f2a5c1d635aea96c389e2fd66ac3be21775856c9a4105eeaf906c6abda31926a0be5a1a1f08f6acefedadcdbc6e882de31783f954a637fed57110f90a405509",
"deviceSignature": "8f69f066ad23ac7876c2158341b6e50448b756e6648023eac7ed7867cb883a93"
}
Key Components
Ed25519
: Utilized for generating public/private key pairs and signatures.
HttpService
: Manages the communication with the backend, including header generation and POST requests.
Security Notes
Always secure your API key and secret; never expose them in client-side code. The Ed25519 algorithm is chosen for its strength and efficiency in signing and verification processes.