diff --git a/src/core/utils/http_ece.d.ts b/src/core/utils/http_ece.d.ts new file mode 100644 index 0000000..6ba5bb4 --- /dev/null +++ b/src/core/utils/http_ece.d.ts @@ -0,0 +1,15 @@ +declare module 'http_ece' { + interface EceParams { + version: string; + authSecret: string; + dh: string; + privateKey: crypto.ECDH; + salt: string; + } + + function decrypt(buffer: Buffer, params: EceParams): Buffer; + + export = { + decrypt: decrypt + }; +} diff --git a/src/index.ts b/src/index.ts index e48317b..8a0adda 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1,2 @@ -export { add } from './utils.js'; +export { listen } from './core/listen.js'; +export { register } from './core/register.js'; diff --git a/src/register.test.ts b/src/register.test.ts index 952a17c..f86e2ce 100644 --- a/src/register.test.ts +++ b/src/register.test.ts @@ -4,24 +4,32 @@ import { describe, it, expect } from 'vitest'; import { register, type RegisterCredentials } from './core/register.js'; describe('register function', () => { - it('should return a valid credentials (with vapid key)', async () => { - const credentials: RegisterCredentials = await register({ - apiKey: process.env.API_KEY!, - appId: process.env.APP_ID!, - projectId: process.env.PROJECT_ID!, - vapidKey: process.env.FCM_VAPID_KEY!, - }); + it( + 'should return a valid credentials (with vapid key)', + async () => { + const credentials: RegisterCredentials = await register({ + apiKey: process.env.API_KEY!, + appId: process.env.APP_ID!, + projectId: process.env.PROJECT_ID!, + vapidKey: process.env.FCM_VAPID_KEY!, + }); - expect(credentials).toBeDefined(); - }, { timeout: 10000 }); + expect(credentials).toBeDefined(); + }, + { timeout: 10000 }, + ); - it('should return a valid credentials (without vapid key)', async () => { - const credentials: RegisterCredentials = await register({ - apiKey: process.env.API_KEY!, - appId: process.env.APP_ID!, - projectId: process.env.PROJECT_ID!, - }); + it( + 'should return a valid credentials (without vapid key)', + async () => { + const credentials: RegisterCredentials = await register({ + apiKey: process.env.API_KEY!, + appId: process.env.APP_ID!, + projectId: process.env.PROJECT_ID!, + }); - expect(credentials).toBeDefined(); - }, { timeout: 10000 }); + expect(credentials).toBeDefined(); + }, + { timeout: 10000 }, + ); });