mirror of
https://github.com/standardnotes/server
synced 2026-07-14 00:01:54 -04:00
fix(workspace): rename private key to encrypted private key
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { MigrationInterface, QueryRunner } from 'typeorm'
|
||||
|
||||
export class renamePrivateKey1665389240189 implements MigrationInterface {
|
||||
name = 'renamePrivateKey1665389240189'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
'ALTER TABLE `workspace_users` CHANGE `private_key` `encrypted_private_key` varchar(255) NOT NULL',
|
||||
)
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(
|
||||
'ALTER TABLE `workspace_users` CHANGE `encrypted_private_key` `private_key` varchar(255) NOT NULL',
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ describe('CreateWorkspace', () => {
|
||||
expect(workspaceUserRepository.save).toHaveBeenCalledWith({
|
||||
accessLevel: 'owner',
|
||||
encryptedWorkspaceKey: 'bar',
|
||||
privateKey: 'foo',
|
||||
encryptedPrivateKey: 'foo',
|
||||
publicKey: 'buzz',
|
||||
status: 'active',
|
||||
userUuid: '1-2-3',
|
||||
@@ -64,7 +64,7 @@ describe('CreateWorkspace', () => {
|
||||
expect(workspaceUserRepository.save).toHaveBeenCalledWith({
|
||||
accessLevel: 'owner',
|
||||
encryptedWorkspaceKey: 'bar',
|
||||
privateKey: 'foo',
|
||||
encryptedPrivateKey: 'foo',
|
||||
publicKey: 'buzz',
|
||||
status: 'active',
|
||||
userUuid: '1-2-3',
|
||||
|
||||
@@ -31,7 +31,7 @@ export class CreateWorkspace implements UseCaseInterface {
|
||||
const ownerAssociation = new WorkspaceUser()
|
||||
ownerAssociation.accessLevel = WorkspaceAccessLevel.Owner
|
||||
ownerAssociation.encryptedWorkspaceKey = dto.encryptedWorkspaceKey
|
||||
ownerAssociation.privateKey = dto.encryptedPrivateKey
|
||||
ownerAssociation.encryptedPrivateKey = dto.encryptedPrivateKey
|
||||
ownerAssociation.publicKey = dto.publicKey
|
||||
ownerAssociation.status = WorkspaceUserStatus.Active
|
||||
ownerAssociation.userUuid = dto.ownerUuid
|
||||
|
||||
@@ -42,11 +42,11 @@ export class WorkspaceUser {
|
||||
declare publicKey: string
|
||||
|
||||
@Column({
|
||||
name: 'private_key',
|
||||
name: 'encrypted_private_key',
|
||||
length: 255,
|
||||
type: 'varchar',
|
||||
})
|
||||
declare privateKey: string
|
||||
declare encryptedPrivateKey: string
|
||||
|
||||
@Column({
|
||||
name: 'status',
|
||||
|
||||
Reference in New Issue
Block a user