From 33156cc249ebfbcb4a6f669817096945442c06e9 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Mon, 2 Mar 2026 14:48:37 -0800 Subject: [PATCH] fix: resolve all pre-existing tsc --noEmit errors (10 errors across 5 files) - folk-map-viewer.ts: remove explicit return type, let TS infer - test-x402.ts: cast account as any (test script, readContract unused) - key-derivation.ts: cast Uint8Array at WebCrypto boundaries (BufferSource/ArrayBuffer) - wallet-store.ts: cast .buffer as ArrayBuffer - webauthn.ts: cast PRF output as ArrayBuffer | undefined Co-Authored-By: Claude Opus 4.6 --- modules/rmaps/components/folk-map-viewer.ts | 2 +- scripts/test-x402.ts | 2 +- src/encryptid/key-derivation.ts | 10 +++++----- src/encryptid/wallet-store.ts | 2 +- src/encryptid/webauthn.ts | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/rmaps/components/folk-map-viewer.ts b/modules/rmaps/components/folk-map-viewer.ts index 8df7fc9..1861797 100644 --- a/modules/rmaps/components/folk-map-viewer.ts +++ b/modules/rmaps/components/folk-map-viewer.ts @@ -99,7 +99,7 @@ class FolkMapViewer extends HTMLElement { this.renderDemo(); } - private getFilteredProviders(): { provider: typeof this.providers[0]; index: number }[] { + private getFilteredProviders() { if (!this.searchQuery.trim()) return this.providers.map((p, i) => ({ provider: p, index: i })); const q = this.searchQuery.toLowerCase(); return this.providers.map((p, i) => ({ provider: p, index: i })) diff --git a/scripts/test-x402.ts b/scripts/test-x402.ts index f995a8c..6a5ca03 100644 --- a/scripts/test-x402.ts +++ b/scripts/test-x402.ts @@ -59,7 +59,7 @@ async function main() { console.log(" Wallet:", account.address); const client = new x402Client(); - client.register("eip155:84532", new ExactEvmScheme(account)); + client.register("eip155:84532", new ExactEvmScheme(account as any)); const paidFetch = wrapFetchWithPayment(fetch, client); diff --git a/src/encryptid/key-derivation.ts b/src/encryptid/key-derivation.ts index 47fc505..38f7cf9 100644 --- a/src/encryptid/key-derivation.ts +++ b/src/encryptid/key-derivation.ts @@ -115,7 +115,7 @@ export class EncryptIDKeyManager { const masterKeyMaterial = await crypto.subtle.deriveBits( { name: 'PBKDF2', - salt: salt, + salt: salt as BufferSource, iterations: 600000, hash: 'SHA-256', }, @@ -296,7 +296,7 @@ export class EncryptIDKeyManager { // For now, we'll create a placeholder using the seed hash // TODO: Use @noble/ed25519 for proper Ed25519 key generation - const publicKeyHash = await crypto.subtle.digest('SHA-256', seed); + const publicKeyHash = await crypto.subtle.digest('SHA-256', seed as BufferSource); const publicKeyBytes = new Uint8Array(publicKeyHash).slice(0, 32); // Multicodec prefix for Ed25519 public key: 0xed01 @@ -369,7 +369,7 @@ export async function encryptData( if (typeof data === 'string') { plaintext = new TextEncoder().encode(data).buffer; } else if (data instanceof Uint8Array) { - plaintext = data.buffer; + plaintext = data.buffer as ArrayBuffer; } else { plaintext = data; } @@ -400,7 +400,7 @@ export async function decryptData( return crypto.subtle.decrypt( { name: 'AES-GCM', - iv: encrypted.iv, + iv: encrypted.iv as BufferSource, }, key, encrypted.ciphertext @@ -434,7 +434,7 @@ export async function signData( if (typeof data === 'string') { dataBuffer = new TextEncoder().encode(data).buffer; } else if (data instanceof Uint8Array) { - dataBuffer = data.buffer; + dataBuffer = data.buffer as ArrayBuffer; } else { dataBuffer = data; } diff --git a/src/encryptid/wallet-store.ts b/src/encryptid/wallet-store.ts index e7646d5..3e8d523 100644 --- a/src/encryptid/wallet-store.ts +++ b/src/encryptid/wallet-store.ts @@ -256,7 +256,7 @@ export class WalletStore { const blob: PersistedBlob = { c: bufferToBase64url(encrypted.ciphertext), - iv: bufferToBase64url(encrypted.iv.buffer), + iv: bufferToBase64url(encrypted.iv.buffer as ArrayBuffer), }; try { diff --git a/src/encryptid/webauthn.ts b/src/encryptid/webauthn.ts index b92cfed..d27af0a 100644 --- a/src/encryptid/webauthn.ts +++ b/src/encryptid/webauthn.ts @@ -329,7 +329,7 @@ export async function authenticatePasskey( userId: response.userHandle ? bufferToBase64url(response.userHandle) : '', - prfOutput: prfOutput, + prfOutput: prfOutput as ArrayBuffer | undefined, signature: response.signature, authenticatorData: response.authenticatorData, }; @@ -426,7 +426,7 @@ export async function startConditionalUI( userId: response.userHandle ? bufferToBase64url(response.userHandle) : '', - prfOutput: prfResults?.first, + prfOutput: prfResults?.first as ArrayBuffer | undefined, signature: response.signature, authenticatorData: response.authenticatorData, };