Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@internxt/sdk",
"author": "Internxt <[email protected]>",
"version": "1.10.10",
"version": "1.10.11",
"description": "An sdk for interacting with Internxt's services",
"repository": {
"type": "git",
Expand Down
3 changes: 3 additions & 0 deletions src/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,13 +510,15 @@ export class Auth {
* @param password
* @param salt
* @param mnemonic
* @param uuid
* @param keys
*/
public changePasswordWithLinkV2(
token: string | undefined,
password: string,
salt: string,
mnemonic: string,
uuid?: string,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: With the addition of uuid, we now have 6 parameters. Should we refactor to use a payload object for better maintainability? @CandelR wdyt?

keys?: PrivateKeys,
): Promise<void> {
return this.client.put(
Expand All @@ -526,6 +528,7 @@ export class Auth {
salt: salt,
mnemonic: mnemonic,
privateKeys: keys,
uuid: uuid ?? undefined,
},
this.basicHeaders(),
);
Expand Down
8 changes: 4 additions & 4 deletions src/network/errors/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ export type NetworkUploadContext = {
user: string;
crypto: {
mnemonic?: string;
}
}
};
};
export type NetworkDownloadContext = {
bucketId: string;
fileId: string;
user: string;
crypto: {
mnemonic?: string;
}
}
};
};

export type NetworkContext = NetworkUploadContext | NetworkDownloadContext;

Expand Down
6 changes: 4 additions & 2 deletions test/auth/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -843,14 +843,15 @@ describe('# auth service tests', () => {
const salt = 'newSalt';
const mnemonic = 'newMnemonic';

await client.changePasswordWithLinkV2(token, password, salt, mnemonic);
await client.changePasswordWithLinkV2(token, password, salt, mnemonic, 'uuid');

expect(callStub.firstCall.args).toEqual([
`/users/recover-account-v2?token=${token}&reset=false`,
{
password,
salt,
mnemonic,
uuid: 'uuid',
},
headers,
]);
Expand All @@ -868,7 +869,7 @@ describe('# auth service tests', () => {
kyber: 'newKyberKey',
};

await client.changePasswordWithLinkV2(token, password, salt, mnemonic, privateKeys);
await client.changePasswordWithLinkV2(token, password, salt, mnemonic, 'uuid', privateKeys);

// Assert
expect(callStub.firstCall.args).toEqual([
Expand All @@ -878,6 +879,7 @@ describe('# auth service tests', () => {
salt,
mnemonic,
privateKeys,
uuid: 'uuid',
},
headers,
]);
Expand Down
10 changes: 5 additions & 5 deletions test/network/errors/context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import {
NetworkDownloadContext,
getNetworkErrorContext,
DownloadInvalidMnemonicError,
UploadInvalidMnemonicError
UploadInvalidMnemonicError,
} from '../../../src/network/errors';

function getNetworkUploadContext(merge?: Partial<NetworkUploadContext>): NetworkUploadContext {
const defaultContext: NetworkUploadContext = {
bucketId: '',
crypto: {
mnemonic: 'mnemonic'
mnemonic: 'mnemonic',
},
fileSize: 10,
user: 'user'
user: 'user',
};

return { ...defaultContext, ...merge };
Expand All @@ -23,10 +23,10 @@ function getNetworkDownloadContext(merge?: Partial<NetworkUploadContext>): Netwo
const defaultContext: NetworkDownloadContext = {
bucketId: '',
crypto: {
mnemonic: 'mnemonic'
mnemonic: 'mnemonic',
},
fileId: 'fileId',
user: 'user'
user: 'user',
};

return { ...defaultContext, ...merge };
Expand Down
Loading