@ogstack/agent-sdk
v1.0.9
Published
Agent SDK for communication with OG Stack
Readme
og-stack-agent-node
SDK to use while enrolling your service to Og Stack.
Agent SDK provides utility for secure communication between Og Stack and Enrolled Services.
Installation
Install the dependencies and devDependencies and start the server.
npm i og-stack-agent-nodeDevelopment
Setting Up Agent:
await OgStackSdk.configure({
serviceUrl: "URL of Og Stack BEH",
serviceName: "init.serviceName",
sandbox: "init.sandbox",
serviceProviderName: "init.serviceProviderName",
configLocation: "Location of config.json (you can keep ignore this if you want to use default location)"
});Decrypting the payload:
ogSdk.decryptPayload(req.body);Decrypting redirect token:
ogSdk.decryptToken(req.query.payload, 'operation | admin')Publish service "init" event:
ogSdk.publishServiceInit(subscriptionId, serviceId, configUrl, executionContext)Publish service "ready" event:
ogSdk.publishServiceReady(subscriptionId, serviceId, configUrl, executionContext)Publish service "metering" event:
payload = {
Name: "SERVICE_METERING",
subscriptionId: subscriptionId,
serviceId: serviceId,
txnValue: parseInt(txnValue),
executionContext: subscriptionData.executionContext,
eventName: 'e-payments',
};
ogSdk.publishTransactionEvent(payload)Building for source
For build:
npm run build