Skip to main content

Install

npm install @sierrafy/sdk
Package managerCommand
pnpmpnpm add @sierrafy/sdk
yarnyarn add @sierrafy/sdk
bunbun add @sierrafy/sdk

Requires Node 20 or later.

Import only what you need​

The package has three entry points. Which one you import matters, because the OCR engine needs native dependencies and the validator does not.

ImportContainsNative dependencies
@sierrafy/sdk/ninThe NIN validator aloneNone
@sierrafy/sdk/ocrThe OCR engine alonesharp, tesseract.js
@sierrafy/sdkBothLoaded only when OCR runs

If you only validate NIN formats, import @sierrafy/sdk/nin. That subpath is dependency-free and isomorphic, so it runs in the browser and in React Native as well as on a server.

import { validateNin } from '@sierrafy/sdk/nin';

Optional dependencies for OCR​

sharp and tesseract.js are optional peer dependencies. They are not installed for you, because a project that only validates NIN formats should not pay for a native image-processing binary and a WebAssembly OCR bundle.

npm install sharp tesseract.js
Package managerCommand
pnpmpnpm add sharp tesseract.js
yarnyarn add sharp tesseract.js
bunbun add sharp tesseract.js

They load on the first ocr() call, not at import time, so importing the package root costs nothing until you actually run OCR. Calling ocr() without them throws an error naming the missing package.

Verifying what you installed​

Releases are published from CI with npm provenance, so you can confirm a tarball was built by this repository's workflow:

npm view @sierrafy/sdk --json | jq '.dist.attestations'

The package page on npm shows the commit and workflow that produced the build. Provenance attests where an artifact came from, not that its behaviour is correct, so it complements reading the source rather than replacing it. The published package includes src/ for exactly that reason.