Refactor Docker configuration and update encryption channels schema
Some checks are pending
CI / release_executable (push) Waiting to run
CI / release (push) Waiting to run
CI / debug (push) Waiting to run
CI / debug_executable (push) Waiting to run
CI / check-phpunit (push) Waiting to run
CI / check-phpdoc (push) Waiting to run
CI / generate-phpdoc (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / release-documentation (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
Some checks are pending
CI / release_executable (push) Waiting to run
CI / release (push) Waiting to run
CI / debug (push) Waiting to run
CI / debug_executable (push) Waiting to run
CI / check-phpunit (push) Waiting to run
CI / check-phpdoc (push) Waiting to run
CI / generate-phpdoc (push) Blocked by required conditions
CI / test (push) Blocked by required conditions
CI / release-documentation (push) Blocked by required conditions
CI / release-artifacts (push) Blocked by required conditions
This commit is contained in:
parent
40f871dbea
commit
71563e51ee
9 changed files with 60 additions and 153 deletions
|
@ -1,41 +1,27 @@
|
|||
DROP TABLE IF EXISTS encryption_channels_com;
|
||||
CREATE TABLE encryption_channels_com
|
||||
create table encryption_channels
|
||||
(
|
||||
uuid varchar(36) DEFAULT uuid() NOT NULL COMMENT 'The Unique Universal Identifier of the message for the encryption channel',
|
||||
channel_uuid varchar(36) NOT NULL COMMENT 'The UUID of the channel that the message belongs to',
|
||||
recipient ENUM ('CALLER', 'RECEIVER') NOT NULL COMMENT 'The recipient of the message',
|
||||
status ENUM ('SENT', 'RECEIVED', 'REJECTED') DEFAULT 'SENT' NOT NULL COMMENT 'The status of the message, SENT being the default, RECEIVED is when the recipient receives the message successfully and REJECTED is when the message cannot be decrypted, or the checksum failed.',
|
||||
checksum varchar(64) NOT NULL COMMENT 'The SHA512 hash of the decrypted message contents',
|
||||
data text NOT NULL COMMENT 'The data of the message',
|
||||
timestamp timestamp DEFAULT current_timestamp() NOT NULL COMMENT 'The Timestamp of the message',
|
||||
PRIMARY KEY (uuid, channel_uuid) COMMENT 'The Unique Primary Index Pair for the channel_uuid and uuid of the message',
|
||||
CONSTRAINT encryption_channels_com_uuid_channel_uuid_uindex
|
||||
UNIQUE (uuid, channel_uuid) COMMENT 'The Unique Primary Index Pair for the channel_uuid and uuid of the message'
|
||||
uuid varchar(36) default uuid() not null comment 'The Unique Universal Identifier of the encryption channel'
|
||||
primary key comment 'The Unique Index for the Encryption Channel UUID',
|
||||
status enum ('AWAITING_RECEIVER', 'SERVER_REJECTED', 'PEER_REJECTED', 'ERROR', 'OPENED', 'CLOSED') default 'AWAITING_RECEIVER' not null comment 'The status of the encryption channel',
|
||||
calling_peer_address varchar(320) not null comment 'The address of the calling peer for the encryption channel',
|
||||
calling_public_encryption_key varchar(64) not null comment 'The public encryption key of the caller used for dhe',
|
||||
receiving_peer_address varchar(320) not null comment 'The receiving peer of the the encryption channel',
|
||||
receiving_public_encryption_key varchar(64) null comment 'The public encryption key of the receiver used for dhe',
|
||||
created timestamp default current_timestamp() not null comment 'The Timestamp for when this channel was created',
|
||||
constraint encryption_channels_uuid_uindex
|
||||
unique (uuid) comment 'The Unique Index for the Encryption Channel UUID'
|
||||
)
|
||||
COMMENT 'The table for housing communication messages sent over encryption channels';
|
||||
comment 'Table for housing end to end encryption channels for peers';
|
||||
|
||||
CREATE INDEX encryption_channels_com_recipient_index
|
||||
ON encryption_channels_com (recipient)
|
||||
COMMENT 'The index of the recipient column used for indexing';
|
||||
create index encryption_channels_calling_peer_address_index
|
||||
on encryption_channels (calling_peer_address)
|
||||
comment 'The index of the calling peer address';
|
||||
|
||||
CREATE INDEX encryption_channels_com_timestamp_index
|
||||
ON encryption_channels_com (timestamp)
|
||||
COMMENT 'The index of the Timestamp column';
|
||||
create index encryption_channels_receiving_peer_address_index
|
||||
on encryption_channels (receiving_peer_address)
|
||||
comment 'The index of the receiving peer address';
|
||||
|
||||
SET @constraint_exists = (
|
||||
SELECT COUNT(*)
|
||||
FROM information_schema.table_constraints
|
||||
WHERE constraint_name = 'encryption_channels_com_encryption_channels_uuid_fk'
|
||||
AND table_name = 'encryption_channels_com'
|
||||
);
|
||||
create index encryption_channels_status_index
|
||||
on encryption_channels (status)
|
||||
comment 'The index of the encryption channel status';
|
||||
|
||||
SET @sql = IF(@constraint_exists = 0,
|
||||
'ALTER TABLE encryption_channels_com
|
||||
ADD CONSTRAINT encryption_channels_com_encryption_channels_uuid_fk
|
||||
FOREIGN KEY (channel_uuid) REFERENCES encryption_channels (uuid)
|
||||
ON UPDATE CASCADE ON DELETE CASCADE',
|
||||
'SELECT 1');
|
||||
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
|
@ -61,6 +61,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
Logger::getLogger()->debug('Received request from ' . $_SERVER['REMOTE_ADDR']);
|
||||
$clientRequest = new ClientRequest($requestHeaders, file_get_contents('php://input') ?? null);
|
||||
|
||||
// Handle the request type, only `init` and `dhe` are not encrypted using the session's encrypted key
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue