provider.ts (577B)
1 import type { BrowserContext } from '@playwright/test'; 2 3 // HC_TEST_ONLY_PROVIDER: public-only injection; never signs or holds secret keys. 4 export async function installControlledProvider(context: BrowserContext) { 5 await context.addInitScript(() => { 6 Object.defineProperty(window, 'nostr', { 7 configurable: true, 8 value: Object.freeze({ 9 fixture: 'HC_TEST_ONLY_PROVIDER', 10 getPublicKey: () => Promise.resolve('11'.repeat(32)), 11 signEvent: () => 12 Promise.reject(new Error('Controlled fixture cannot sign')) 13 }) 14 }); 15 }); 16 }