Skip to content

Commit

Permalink
Merge pull request #264 from internxt/clean_up
Browse files Browse the repository at this point in the history
Rollback all kyber and argon2 changes
  • Loading branch information
xabg2 authored Dec 16, 2024
2 parents 42e5e94 + ee12625 commit 65c8971
Show file tree
Hide file tree
Showing 15 changed files with 1,026 additions and 898 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
packages: write
strategy:
matrix:
node-version: [18.x]
node-version: [16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
packages: write
strategy:
matrix:
node-version: [18.x]
node-version: [16.x]
steps:
- name: Check Out Repo
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v2
with:
node-version: '18.x'
node-version: '16.x'
registry-url: 'https://npm.pkg.github.com'
- run: yarn
env:
Expand Down
24 changes: 12 additions & 12 deletions 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.7.0",
"version": "1.8.0",
"description": "An sdk for interacting with Internxt's services",
"repository": {
"type": "git",
Expand All @@ -28,20 +28,20 @@
"devDependencies": {
"@internxt/eslint-config-internxt": "^1.0.3",
"@internxt/prettier-config": "^1.0.1",
"@types/jest": "^29.5.14",
"@types/sinon": "^17.0.3",
"@types/uuid": "^10.0.0",
"@types/jest": "^27.0.1",
"@types/sinon": "^10.0.6",
"@types/uuid": "^8.3.4",
"eslint": "^7.32.0",
"husky": "^9.1.6",
"jest": "^29.7.0",
"prettier": "^3.3.3",
"sinon": "^19.0.2",
"ts-jest": "^29.2.5",
"typescript": "^5.6.3"
"husky": "^7.0.1",
"jest": "^27.0.6",
"prettier": "^2.3.2",
"sinon": "^12.0.1",
"ts-jest": "^27.0.5",
"typescript": "^4.3.5"
},
"dependencies": {
"axios": "^0.28.0",
"axios": "^0.24.0",
"query-string": "^7.1.0",
"uuid": "^11.0.2"
"uuid": "^8.3.2"
}
}
72 changes: 2 additions & 70 deletions src/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,9 @@ export class Auth {
password: registerDetails.password,
mnemonic: registerDetails.mnemonic,
salt: registerDetails.salt,
/**
/ @deprecated The individual fields for keys should not be used
*/
privateKey: registerDetails.keys.privateKeyEncrypted,
publicKey: registerDetails.keys.publicKey,
revocationKey: registerDetails.keys.revocationCertificate,
keys: {
ecc: {
privateKey: registerDetails.keys.ecc.privateKeyEncrypted,
publicKey: registerDetails.keys.ecc.publicKey,
},
kyber: {
privateKey: registerDetails.keys.kyber.privateKeyEncrypted,
publicKey: registerDetails.keys.kyber.publicKey,
}
},
referral: registerDetails.referral,
referrer: registerDetails.referrer,
},
Expand All @@ -92,22 +79,9 @@ export class Auth {
password: registerDetails.password,
mnemonic: registerDetails.mnemonic,
salt: registerDetails.salt,
/**
/ @deprecated The individual fields for keys should not be used
*/
privateKey: registerDetails.keys.privateKeyEncrypted,
publicKey: registerDetails.keys.publicKey,
revocationKey: registerDetails.keys.revocationCertificate,
keys: {
ecc: {
privateKey: registerDetails.keys.ecc.privateKeyEncrypted,
publicKey: registerDetails.keys.ecc.publicKey,
},
kyber: {
privateKey: registerDetails.keys.kyber.privateKeyEncrypted,
publicKey: registerDetails.keys.kyber.publicKey,
},
},
referral: registerDetails.referral,
referrer: registerDetails.referrer,
invitationId: registerDetails.invitationId,
Expand Down Expand Up @@ -158,7 +132,7 @@ export class Auth {
}> {
const securityDetails = await this.securityDetails(details.email);
const encryptedSalt = securityDetails.encryptedSalt;
const encryptedPasswordHash = await cryptoProvider.encryptPasswordHash(details.password, encryptedSalt);
const encryptedPasswordHash = cryptoProvider.encryptPasswordHash(details.password, encryptedSalt);
const keys = await cryptoProvider.generateKeys(details.password);

return this.client
Expand All @@ -173,22 +147,9 @@ export class Auth {
email: details.email,
password: encryptedPasswordHash,
tfa: details.tfaCode,
/**
/ @deprecated The individual fields for keys should not be used
*/
privateKey: keys.privateKeyEncrypted,
publicKey: keys.publicKey,
revocateKey: keys.revocationCertificate,
keys: {
ecc: {
privateKey: keys.ecc.privateKeyEncrypted,
publicKey: keys.ecc.publicKey,
},
kyber: {
privateKey: keys.kyber.privateKeyEncrypted,
publicKey: keys.kyber.publicKey,
}
},
},
this.basicHeaders(),
)
Expand All @@ -208,23 +169,10 @@ export class Auth {
public updateKeys(keys: Keys, token: Token) {
return this.client.patch(
'/user/keys',
{
/**
/ @deprecated The individual fields for keys should not be used
*/
{
publicKey: keys.publicKey,
privateKey: keys.privateKeyEncrypted,
revocationKey: keys.revocationCertificate,
keys: {
ecc: {
privateKey: keys.ecc.privateKeyEncrypted,
publicKey: keys.ecc.publicKey,
},
kyber: {
privateKey: keys.kyber.privateKeyEncrypted,
publicKey: keys.kyber.publicKey,
}
},
},
this.headersWithToken(token),
);
Expand Down Expand Up @@ -350,22 +298,6 @@ export class Auth {
);
}

/**
* Upgrade hash and salt in the database
* @param newHash
* @param newSalt
*/
public upgradeHash(newHash: string, newSalt: string): Promise<void> {
return this.client.patch(
'/users/:id',
{
newPassword: newHash,
newSalt: newSalt,
},
this.basicHeaders(),
);
}

/**
* Restore password with email link
* @param token
Expand Down
13 changes: 1 addition & 12 deletions src/auth/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,13 @@ export interface RegisterPreCreatedUserResponse {
uuid: UUID;
}
export interface Keys {
/**
/ @deprecated The individual fields for keys should not be used
*/
privateKeyEncrypted: string;
publicKey: string;
revocationCertificate: string;
ecc: {
privateKeyEncrypted: string;
publicKey: string;
};
kyber: {
publicKey: string | null;
privateKeyEncrypted: string | null;
};
}

export interface CryptoProvider {
encryptPasswordHash: (password: Password, encryptedSalt: string) => Promise<string>;
encryptPasswordHash: (password: Password, encryptedSalt: string) => string;
generateKeys: (password: Password) => Promise<Keys>;
}

Expand Down
1 change: 0 additions & 1 deletion src/drive/share/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ export type ShareFolderWithUserPayload = {
encryptionAlgorithm?: string;
roleId: string;
persistPreviousSharing?: boolean;
hybridModeEnabled: boolean;
};

export type CreateSharingPayload = {
Expand Down
3 changes: 1 addition & 2 deletions src/drive/users/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ export type UpdateProfilePayload = Partial<Pick<UserSettings, 'name' | 'lastname

export type PreCreateUserResponse = {
publicKey: string;
publicKyberKey: string;
user: { uuid: UUID; email: string };
};

export type FriendInvite = { guestEmail: string; host: number; accepted: boolean; id: number };

export type UserPublicKeyResponse = { publicKey: string; publicKyberKey: string };
export type UserPublicKeyResponse = { publicKey: string };

export type VerifyEmailChangeResponse = {
oldEmail: string;
Expand Down
14 changes: 0 additions & 14 deletions src/shared/types/userSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,9 @@ export interface UserSettings {
sharedWorkspace: boolean;
credit: number;
mnemonic: string;
/**
/ @deprecated The individual fields for keys should not be used
*/
privateKey: string;
publicKey: string;
revocationKey: string;
keys: {
ecc: {
privateKey: string;
publicKey: string;
revocationKey: string;
}
kyber: {
privateKyberKey: string;
publicKyberKey: string;
}
}
teams?: boolean;
appSumoDetails: AppSumoDetails | null;
registerCompleted: boolean;
Expand Down
5 changes: 0 additions & 5 deletions src/workspaces/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe('Workspaces service tests', () => {
id: '1',
memberId: 'member1',
key: 'user_key_1',
hybridModeEnabled: false,
workspaceId: 'workspace1',
spaceLimit: '10GB',
driveUsage: '2GB',
Expand Down Expand Up @@ -89,7 +88,6 @@ describe('Workspaces service tests', () => {
id: '2',
memberId: 'member2',
key: 'user_key_2',
hybridModeEnabled: false,
workspaceId: 'workspace2',
spaceLimit: '15GB',
driveUsage: '5GB',
Expand Down Expand Up @@ -175,7 +173,6 @@ describe('Workspaces service tests', () => {
address: 'Workspace Address',
description: 'Workspace Description',
encryptedMnemonic: 'encryptedMnemonic',
hybridModeEnabled: false,
};
const workspaceSetupInfo: WorkspaceSetupInfo = {
workspaceId: 'workspaceId',
Expand Down Expand Up @@ -390,7 +387,6 @@ describe('Workspaces service tests', () => {
const { client, headers } = clientAndHeaders();
const postCall = sinon.stub(httpClient, 'post').resolves();
const message = 'Test message';
const hybridModeEnabled = false;

await client.inviteMemberToWorkspace({
workspaceId,
Expand All @@ -399,7 +395,6 @@ describe('Workspaces service tests', () => {
encryptedMnemonicInBase64,
encryptionAlgorithm,
message,
hybridModeEnabled: hybridModeEnabled,
});

expect(postCall.firstCall.args).toEqual([
Expand Down
3 changes: 1 addition & 2 deletions src/workspaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,10 @@ export class Workspaces {
address,
description,
encryptedMnemonic,
hybridModeEnabled,
}: WorkspaceSetupInfo): Promise<void> {
return this.client.patch<void>(
`workspaces/${workspaceId}/setup`,
{ name, address, description, encryptedMnemonic, hybridModeEnabled },
{ name, address, description, encryptedMnemonic },
this.headers(),
);
}
Expand Down
3 changes: 0 additions & 3 deletions src/workspaces/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export interface WorkspaceUser {
isManager: boolean;
isOwner: boolean;
key: string;
hybridModeEnabled: boolean;
member: Member;
memberId: string;
rootFolderId: string;
Expand Down Expand Up @@ -53,7 +52,6 @@ export type WorkspaceSetupInfo = {
address: string;
description: string;
encryptedMnemonic: string;
hybridModeEnabled: boolean;
};

export type PendingWorkspace = {
Expand Down Expand Up @@ -162,7 +160,6 @@ export type InviteMemberBody = {
encryptedMnemonicInBase64: string;
encryptionAlgorithm: string;
message: string;
hybridModeEnabled: boolean;
};

interface Invite {
Expand Down
Loading

0 comments on commit 65c8971

Please sign in to comment.