npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

kejayangu-node-sdk

v1.0.2

Published

The official Node.js SDK for the KejaYangu Kenya Real Estate Platform API

Downloads

23

Readme

KejaYangu Node SDK

The official Node.js / TypeScript SDK for the KejaYangu Trust API.

This SDK allows developers to easily integrate KejaYangu's B2B Trust Infrastructure—verifying real estate agents, validating property authenticity, and running user KYC—directly into their own applications with zero manual HTTP configuration.


📦 Installation

Install the package via NPM or Yarn:

npm install kejayangu
# or
yarn add kejayangu

🚀 Quick Start

Initialize the SDK using your Secret or Test API Key.

import { KejaYangu } from 'kejayangu';

// Initialize the client
const keja = new KejaYangu('kj_test_847392847...', { 
  environment: 'sandbox' // Use 'live' for production
});

async function run() {
  try {
    const result = await keja.trust.verifyAgent('EARB-12345');
    console.log('Agent Status:', result.status);
  } catch (error) {
    console.error('API Error:', error.message);
  }
}

run();

🛡️ Trust Infrastructure API

The keja.trust service provides three primary methods for mitigating fraud in the Kenyan Real Estate sector.

1. Verify Estate Agent (verifyAgent)

Cross-references an agent's license number against the Estate Agents Registration Board (EARB) database.

const result = await keja.trust.verifyAgent('EARB-12345');

/* Response:
{
  "status": "verified",
  "last_checked": "2026-02-27T18:55:15.648Z",
  "provider": "EARB"
}
*/

2. Verify Property Authenticity (verifyProperty)

Validates Land Reference (LR) numbers to ensure the property belongs to the claimed owner and isn't subject to ongoing disputes.

const result = await keja.trust.verifyProperty({
  lrNumber: 'LR-NBI-99482',
  location: 'Kilimani, Nairobi' // Optional
});

/* Response:
{
  "status": "pending_verification",
  "message": "Verification requested for LR No: LR-NBI-99482"
}
*/

3. User Identity Check (kycUser)

Performs a KYC flow on a user, checking for SIM Swaps and matching National ID credentials.

const result = await keja.trust.kycUser({
  phoneNumber: '+254712345678',
  idNumber: '34567890'
});

/* Response:
{
  "status": "kyc_initiated",
  "message": "KYC process has been queued.",
  "reference_id": "live_kyc_1709062345"
}
*/

❌ Error Handling

The KejaYangu API returns programmatic, Stripe-grade error schemas. If a request fails (e.g., due to an invalid API key, missing parameters, or hitting a rate limit), the SDK throws the parsed JSON error directly.

try {
  await keja.trust.verifyAgent('');
} catch (error) {
  console.log(error.type);    // "invalid_request_error"
  console.log(error.code);    // "missing_parameter"
  console.log(error.message); // "Missing required parameter: license_number"
  console.log(error.param);   // "license_number"
  
  // A link to our developer docs explaining this exact error!
  console.log(error.doc_url); // "https://docs.kejayangu.co.ke/errors/missing_parameter"
}

📘 Typescript Support

This SDK is written entirely in TypeScript and exports all relevant types and interfaces. Modern IDEs like VS Code will provide full autocomplete hints for every method and response object.

import { KejaYangu, VerificationResult } from 'kejayangu';

// `result` will be strictly typed as `VerificationResult`
const result: VerificationResult = await keja.trust.verifyAgent('EARB-123');

🔒 Security

Never expose your live API Key (kj_live_...) in client-side code like React, React Native, or Vue. This SDK is intended for backend Node.js environments (Express, Next.js API Routes, Serverless Functions).

If you need to test the frontend integration, safely use your sandbox key (kj_test_...) or proxy the requests through your own backend.