From 66560681433000ccf975bd5e380d421708b42571 Mon Sep 17 00:00:00 2001 From: jzunigax2 <125698953+jzunigax2@users.noreply.github.com> Date: Wed, 6 May 2026 22:01:03 -0600 Subject: [PATCH 1/3] refactor(mail): update getMailAccountKeys to optionally accept address parameter and adjust documentation accordingly --- src/mail/api.ts | 10 ++++++---- src/mail/mail.ts | 7 ++++--- test/mail/index.test.ts | 18 +++++++++++++++++- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/mail/api.ts b/src/mail/api.ts index c39f90e..876eb67 100644 --- a/src/mail/api.ts +++ b/src/mail/api.ts @@ -202,13 +202,15 @@ export class MailApi { } /** - * Gets the mail account keys for the given address + * Gets the mail account keys for the given address. When omitted, the + * backend returns the keys for the caller's default address. * - * @param address - The mail address whose keys should be retrieved + * @param address - Optional. The mail address whose keys should be retrieved * @returns The public, encrypted private and recovery keys plus the salt */ - async getMailAccountKeys(address: string): Promise { - return this.client.getWithParams('/users/me/mail-account/keys', { address }, this.headers()); + async getMailAccountKeys(address?: string): Promise { + const params = address ? { address } : {}; + return this.client.getWithParams('/users/me/mail-account/keys', params, this.headers()); } /** diff --git a/src/mail/mail.ts b/src/mail/mail.ts index 5bd815a..0a1becc 100644 --- a/src/mail/mail.ts +++ b/src/mail/mail.ts @@ -261,12 +261,13 @@ export class Mail { } /** - * Gets the mail account keys for the given address + * Gets the mail account keys for the given address. When omitted, the + * backend returns the keys for the caller's default address. * - * @param address - The mail address whose keys should be retrieved + * @param address - Optional. The mail address whose keys should be retrieved * @returns The public, encrypted private and recovery keys plus the salt */ - async getMailAccountKeys(address: string): Promise { + async getMailAccountKeys(address?: string): Promise { return this.api.getMailAccountKeys(address); } } diff --git a/test/mail/index.test.ts b/test/mail/index.test.ts index 33583f5..f317515 100644 --- a/test/mail/index.test.ts +++ b/test/mail/index.test.ts @@ -311,7 +311,7 @@ describe('Mail service tests', () => { expect(result).toEqual({ address: 'user@domain.com' }); }); - it('When the mail account keys are requested, then it should GET /users/me/mail-account/keys with the address', async () => { + it('When the mail account keys are requested with an address, then it should GET /users/me/mail-account/keys with that address', async () => { const { client, headers } = clientAndHeadersWithToken(); const expectedKeys = { address: 'user@domain.com', @@ -326,6 +326,22 @@ describe('Mail service tests', () => { expect(getStub).toHaveBeenCalledWith('/users/me/mail-account/keys', { address: 'user@domain.com' }, headers); expect(result).toEqual(expectedKeys); }); + + it('When the mail account keys are requested without an address, then it should GET /users/me/mail-account/keys without query params', async () => { + const { client, headers } = clientAndHeadersWithToken(); + const expectedKeys = { + address: 'user@domain.com', + publicKey: 'public-key', + encryptionPrivateKey: 'encryption-private-key', + recoveryPrivateKey: 'recovery-private-key', + }; + const getStub = vi.spyOn(HttpClient.prototype, 'getWithParams').mockResolvedValue(expectedKeys); + + const result = await client.getMailAccountKeys(); + + expect(getStub).toHaveBeenCalledWith('/users/me/mail-account/keys', {}, headers); + expect(result).toEqual(expectedKeys); + }); }); }); From deac831dfead2221d1c693b1b1084713b27516c4 Mon Sep 17 00:00:00 2001 From: jzunigax2 <125698953+jzunigax2@users.noreply.github.com> Date: Wed, 6 May 2026 22:13:57 -0600 Subject: [PATCH 2/3] chore(package): bump version from 1.15.14 to 1.15.15 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 683599e..b164ea8 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@internxt/sdk", "author": "Internxt ", - "version": "1.15.14", + "version": "1.15.15", "description": "An sdk for interacting with Internxt's services", "repository": { "type": "git", @@ -51,4 +51,4 @@ "prettier --write" ] } -} +} \ No newline at end of file From cd037ef680339afb27f982939759d09c289c0be0 Mon Sep 17 00:00:00 2001 From: jzunigax2 <125698953+jzunigax2@users.noreply.github.com> Date: Thu, 7 May 2026 06:47:09 -0600 Subject: [PATCH 3/3] chore: bump version --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b685233..c36c011 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@internxt/sdk", "author": "Internxt ", - "version": "1.16.1", + "version": "1.16.2", "description": "An sdk for interacting with Internxt's services", "repository": { "type": "git", @@ -50,4 +50,4 @@ "prettier --write" ] } -} +} \ No newline at end of file