Skip to content
Merged
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
18 changes: 18 additions & 0 deletions migrations/20260428124349-remove-salt-from-mail-address-keys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

const TABLE_NAME = 'mail_address_keys';
const COLUMN_NAME = 'salt';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface) {
await queryInterface.removeColumn(TABLE_NAME, COLUMN_NAME);
},

async down(queryInterface, Sequelize) {
await queryInterface.addColumn(TABLE_NAME, COLUMN_NAME, {
type: Sequelize.STRING(64),
allowNull: false,
});
},
};
1 change: 0 additions & 1 deletion src/modules/account/account.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ describe('AccountService', () => {
publicKey: keysAttrs.publicKey,
encryptionPrivateKey: keysAttrs.encryptionPrivateKey,
recoveryPrivateKey: keysAttrs.recoveryPrivateKey,
salt: keysAttrs.salt,
});
});

Expand Down
2 changes: 0 additions & 2 deletions src/modules/account/account.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export interface MailAddressKeyBundle {
publicKey: string;
encryptionPrivateKey: string;
recoveryPrivateKey: string;
salt: string;
}

@Injectable()
Expand Down Expand Up @@ -78,7 +77,6 @@ export class AccountService {
publicKey: keys.publicKey,
encryptionPrivateKey: keys.encryptionPrivateKey,
recoveryPrivateKey: keys.recoveryPrivateKey,
salt: keys.salt,
};
}

Expand Down
2 changes: 0 additions & 2 deletions src/modules/account/domain/mail-address-keys.domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export interface MailAddressKeysAttributes {
publicKey: string;
encryptionPrivateKey: string;
recoveryPrivateKey: string;
salt: string;
createdAt: Date;
updatedAt: Date;
}
Expand All @@ -15,7 +14,6 @@ export class MailAddressKeys {
readonly publicKey!: string;
readonly encryptionPrivateKey!: string;
readonly recoveryPrivateKey!: string;
readonly salt!: string;
readonly createdAt!: Date;
readonly updatedAt!: Date;

Expand Down
7 changes: 0 additions & 7 deletions src/modules/account/dto/create-mail-account.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ export class MailAddressKeyBundleDto {
@IsString()
@IsNotEmpty()
recoveryPrivateKey!: string;

@ApiProperty({
description: 'Base64-encoded Argon2id salt used to derive the keystore key',
})
@IsString()
@IsNotEmpty()
salt!: string;
}

export class CreateMailAccountDto {
Expand Down
4 changes: 0 additions & 4 deletions src/modules/account/models/mail-address-keys.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ export class MailAddressKeysModel extends Model {
@Column(DataType.TEXT)
declare recoveryPrivateKey: string;

@AllowNull(false)
@Column(DataType.STRING(64))
declare salt: string;

@BelongsTo(() => MailAddressModel)
declare address: MailAddressModel;
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ describe('MailAddressKeysRepository', () => {
publicKey: attrs.publicKey,
encryptionPrivateKey: attrs.encryptionPrivateKey,
recoveryPrivateKey: attrs.recoveryPrivateKey,
salt: attrs.salt,
};
keysModel.create.mockResolvedValue(
attrs as unknown as MailAddressKeysModel,
Expand All @@ -46,7 +45,6 @@ describe('MailAddressKeysRepository', () => {
expect(result.id).toBe(attrs.id);
expect(result.mailAddressId).toBe(attrs.mailAddressId);
expect(result.publicKey).toBe(attrs.publicKey);
expect(result.salt).toBe(attrs.salt);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export interface CreateMailAddressKeysParams {
publicKey: string;
encryptionPrivateKey: string;
recoveryPrivateKey: string;
salt: string;
}

@Injectable()
Expand Down Expand Up @@ -44,7 +43,6 @@ export class MailAddressKeysRepository {
publicKey: model.publicKey,
encryptionPrivateKey: model.encryptionPrivateKey,
recoveryPrivateKey: model.recoveryPrivateKey,
salt: model.salt,
createdAt: model.createdAt as Date,
updatedAt: model.updatedAt as Date,
};
Expand Down
1 change: 0 additions & 1 deletion src/modules/account/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export class UserController {
publicKey: dto.keys.publicKey,
encryptionPrivateKey: dto.keys.encryptionPrivateKey,
recoveryPrivateKey: dto.keys.recoveryPrivateKey,
salt: dto.keys.salt,
},
});

Expand Down
1 change: 1 addition & 0 deletions src/modules/provisioning/provisioning.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
type CanActivate,
type ExecutionContext,
Injectable,
ForbiddenException,
} from '@nestjs/common';
import { AccountService } from '../account/account.service.js';
import type { UserPayload } from '../auth/jwt-payload.dto.js';
Expand Down
1 change: 0 additions & 1 deletion test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ export function newMailAddressKeyBundle(
publicKey: random.hash({ length: 64 }),
encryptionPrivateKey: random.hash({ length: 128 }),
recoveryPrivateKey: random.hash({ length: 128 }),
salt: random.hash({ length: 24 }),
...attrs,
};
}
Expand Down
Loading