diff options
author | Pawel Zelawski <pawel.zelawski@outlook.com> | 2025-04-09 20:18:15 +0200 |
---|---|---|
committer | Pawel Zelawski <pawel.zelawski@outlook.com> | 2025-04-09 20:18:15 +0200 |
commit | a45bcd5f84b2e7be982e170aa31f64afac61a337 (patch) | |
tree | 7050422e138b7ffdc75222639a9038ed4a457dfd /src | |
parent | 14d86ef2043828ad624f2bded91de838c3a13fcd (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/digiid.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/digiid.ts b/src/digiid.ts index 8b1dc07..363a82f 100644 --- a/src/digiid.ts +++ b/src/digiid.ts @@ -1,4 +1,6 @@ import { randomBytes } from 'crypto'; +// Import createRequire for CJS dependencies in ESM +import { createRequire } from 'module'; import { DigiIDUriOptions, DigiIDError, @@ -20,6 +22,8 @@ export async function _internalVerifySignature( address: string, signature: string ): Promise<boolean> { + // Create a require function scoped to this module + const require = createRequire(import.meta.url); // eslint-disable-next-line @typescript-eslint/no-var-requires const Message = require('digibyte-message'); try { |