summaryrefslogtreecommitdiff
path: root/examples/verify-callback.ts
diff options
context:
space:
mode:
authorPawel Zelawski <pawel.zelawski@outlook.com>2025-04-14 10:30:43 +0200
committerPawel Zelawski <pawel.zelawski@outlook.com>2025-04-14 10:30:43 +0200
commitb354d96163e2ba2103f7d8b101dae547eb4747fa (patch)
treea1be4510d0b82797a4ed465e534c15924d8d2082 /examples/verify-callback.ts
parente5a32e3002dfd5c17c847013cd27092f96ac2fba (diff)
fix: Correct Bech32 address verification via dependency change
- Replaced faulty 'digibyte-message' dependency with 'bitcoinjs-message'. - This resolves a critical bug where signatures from DigiByte Bech32 addresses (dgb1...) could not be verified due to issues in the old dependency chain. - digiid-ts now correctly handles Legacy (D...), SegWit (S...), and Bech32 (dgb1...) address signature verification. - Updated build configurations and addressed related linting issues revealed during testing.
Diffstat (limited to 'examples/verify-callback.ts')
-rw-r--r--examples/verify-callback.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/verify-callback.ts b/examples/verify-callback.ts
index a1df685..79edc65 100644
--- a/examples/verify-callback.ts
+++ b/examples/verify-callback.ts
@@ -5,8 +5,14 @@
* The callback contains a signature that needs to be verified against the original challenge.
*/
-// Import directly from src for running locally before publishing
-// In a real project, you'd import from 'digiid-ts' after installing
-import { verifyDigiIDCallback, DigiIDError } from '../src/index';
+// This example assumes you have a basic Express.js server setup.
+// Run with: ts-node examples/verify-callback.ts
+
+// Import only what's needed
+
+// In-memory store for demo purposes. Replace with a database in production.
+// Store nonce => { expectedUrl: string, timestamp: number }
+const nonceStore = new Map<string, { expectedUrl: string; timestamp: number }>();
+const NONCE_EXPIRY_MS = 5 * 60 * 1000; // 5 minutes
// ... existing code ... \ No newline at end of file