From a45bcd5f84b2e7be982e170aa31f64afac61a337 Mon Sep 17 00:00:00 2001 From: Pawel Zelawski Date: Wed, 9 Apr 2025 20:18:15 +0200 Subject: docs: Add README, usage examples, and example runner instructions - Create comprehensive README.md including: - Features, Installation (from GitHub), Usage examples (URI generation, callback verification), API Reference, Dependency status note, Testing instructions. - Review and confirm adequacy of TSDoc comments in source files. - Update README intro sentence and add explicit notes on required URL format. - Create `examples/` directory with runnable scripts: - `examples/generate-uri.ts` - `examples/verify-callback-example.ts` - Update signature verification helper (`_internalVerifySignature`) to use `createRequire` for CJS dependency loading in ESM context (required for examples). - Add "Running Examples" section to README with the correct `node --loader ts-node/esm` command. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'README.md') diff --git a/README.md b/README.md index 155aa09..6fce048 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,16 @@ app.post('/api/digiid/callback', async (req, res) => { (Refer to `src/types.ts` for detailed interface definitions) +## Running Examples + +Examples are available in the `examples/` directory. You can run them using `ts-node` via the Node.js loader: + +```bash +# Ensure ts-node is installed (npm install -D ts-node) +node --loader ts-node/esm examples/generate-uri.ts +node --loader ts-node/esm examples/verify-callback-example.ts +``` + ## Dependencies This library currently uses a specific commit from a fork of `bitcore-message` (`digicontributer/bitcore-message`) for signature verification, matching the original `digiid-js` library. This is an older dependency. -- cgit v1.2.3