Skip to content

Commit 827c55e

Browse files
draggcursoragent
andcommitted
Add blocked face API client method
Release the public verification face block endpoint in the Node SDK with the matching minor version bump. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 444dcc8 commit 827c55e

4 files changed

Lines changed: 34 additions & 3 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@proofage/node",
3-
"version": "0.1.1",
3+
"version": "0.2.0",
44
"description": "Node.js client for ProofAge API with HMAC authentication and webhook verification",
55
"license": "MIT",
66
"type": "module",

src/resources/verifications.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,12 @@ export class VerificationResource {
5858
const res = await this.client.makeRequest('POST', `verifications/${this.verificationId}/submit`, {});
5959
return (await res.json()) as Record<string, unknown> | null;
6060
}
61+
62+
async blockFace(): Promise<Record<string, unknown> | null> {
63+
if (!this.verificationId) {
64+
throw new TypeError('Verification ID is required');
65+
}
66+
const res = await this.client.makeRequest('POST', `verifications/${this.verificationId}/blocked-face`, {});
67+
return (await res.json()) as Record<string, unknown> | null;
68+
}
6169
}

tests/client.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,29 @@ describe('ProofAgeClient', () => {
9696
expect(v?.id).toBe('ver_123');
9797
});
9898

99+
it('blocks verification face', async () => {
100+
const spy = vi.fn(async () => Promise.resolve(new Response(null, { status: 204 })));
101+
vi.stubGlobal('fetch', spy);
102+
103+
const client = new ProofAgeClient(baseConfig);
104+
const result = await client.verifications('ver_123').blockFace();
105+
106+
expect(result).toBeNull();
107+
expect(spy).toHaveBeenCalledOnce();
108+
const [url, init] = spy.mock.calls[0] as [string, RequestInit];
109+
const headers = init.headers as Record<string, string>;
110+
expect(url).toBe('https://api.test.com/v1/verifications/ver_123/blocked-face');
111+
expect(init.method).toBe('POST');
112+
expect(headers['X-HMAC-Signature']).toBeDefined();
113+
});
114+
115+
it('throws when blocking verification face without id', async () => {
116+
const client = new ProofAgeClient(baseConfig);
117+
118+
await expect(client.verifications().blockFace()).rejects.toThrow(TypeError);
119+
await expect(client.verifications().blockFace()).rejects.toThrow('Verification ID is required');
120+
});
121+
99122
it('sends X-API-Key and X-HMAC-Signature headers', async () => {
100123
const spy = vi.fn(async () => Promise.resolve(new Response('{}', { status: 200 })));
101124
vi.stubGlobal('fetch', spy);

0 commit comments

Comments
 (0)