Added Encrypted channels and communication methods
This commit is contained in:
parent
b380df95fe
commit
0e08bef3bc
10 changed files with 1066 additions and 0 deletions
32
src/Socialbox/Classes/Resources/database/channel_com.sql
Normal file
32
src/Socialbox/Classes/Resources/database/channel_com.sql
Normal file
|
@ -0,0 +1,32 @@
|
|||
create table channel_com
|
||||
(
|
||||
uuid varchar(36) default uuid() not null comment 'The UUID of the message',
|
||||
channel_uuid varchar(36) not null comment 'The UUID of the encryption channel used',
|
||||
recipient enum ('SENDER', 'RECEIVER') not null comment 'The recipient of the message',
|
||||
message text not null comment 'The encrypted message content',
|
||||
signature varchar(64) not null comment 'The signature of the decrypted message',
|
||||
received tinyint(1) default 0 not null comment 'True if the message was received by the recipient',
|
||||
timestamp timestamp default current_timestamp() not null comment 'The timestamp of the mssage being sent',
|
||||
primary key (uuid, channel_uuid) comment 'The Unique Pair Index for the channel UUID and message UUID',
|
||||
constraint channel_com_uuid_channel_uuid_uindex
|
||||
unique (uuid, channel_uuid) comment 'The Unique Pair Index for the channel UUID and message UUID',
|
||||
constraint channel_com_uuid_channel_uuid_uindex_2
|
||||
unique (uuid, channel_uuid) comment 'The Unique Index Pair for the channel UUID and message UUID',
|
||||
constraint channel_com_encryption_channels_uuid_fk
|
||||
foreign key (channel_uuid) references encryption_channels (uuid)
|
||||
on update cascade on delete cascade
|
||||
)
|
||||
comment 'Table for housing communication messages over encryption channels';
|
||||
|
||||
create index channel_com_received_index
|
||||
on channel_com (received)
|
||||
comment 'The index for the received column';
|
||||
|
||||
create index channel_com_recipient_index
|
||||
on channel_com (recipient)
|
||||
comment 'The index for the recipient column';
|
||||
|
||||
create index channel_com_timestamp_index
|
||||
on channel_com (timestamp)
|
||||
comment 'The index for the Timestamp column';
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
create table encryption_channels
|
||||
(
|
||||
uuid varchar(36) not null comment 'The Unique Universal Identifier for the encryption channel'
|
||||
primary key comment 'The Unique Index of the encryption channel UUID',
|
||||
calling_peer varchar(320) not null comment 'The address of the calling peer',
|
||||
calling_signature_uuid varchar(64) not null comment 'The UUID of the signing key that the calling peer is going to use to sign their messages',
|
||||
calling_signature_public_key varchar(32) not null,
|
||||
calling_encryption_public_key varchar(32) not null comment 'The public encryption key of the caller',
|
||||
receiving_peer varchar(320) not null comment 'The address of the receiving peer',
|
||||
receiving_signature_uuid varchar(256) null comment 'The UUID of the signature that the receiver peer will use to sign messages with',
|
||||
receiving_signature_public_key varchar(32) null comment 'The public key of the receiver''s signing key',
|
||||
receiving_encryption_public_key varchar(32) null comment 'The encryption key of the receiver',
|
||||
transport_encryption_algorithm enum ('xchacha20', 'chacha20', 'aes256gcm') default 'xchacha20' not null comment 'The transport encryption algorithm used as selected by the caller',
|
||||
transport_encryption_key varchar(256) null comment 'The transport encryption key encrypted using the caller''s public encryption key',
|
||||
state enum ('AWAITING_RECEIVER', 'ERROR', 'DECLINED', 'AWAITING_DHE', 'OPENED', 'CLOSED') default 'AWAITING_RECEIVER' not null comment 'The current state of the encryption channel',
|
||||
created timestamp default current_timestamp() not null comment 'The Timestamp for when this record was created',
|
||||
constraint encryption_channels_uuid_uindex
|
||||
unique (uuid) comment 'The Unique Index of the encryption channel UUID'
|
||||
);
|
||||
|
||||
create index encryption_channels_calling_peer_index
|
||||
on encryption_channels (calling_peer)
|
||||
comment 'The index of the calling peer address';
|
||||
|
||||
create index encryption_channels_created_index
|
||||
on encryption_channels (created)
|
||||
comment 'The Index for when the record was created';
|
||||
|
||||
create index encryption_channels_receiving_peer_index
|
||||
on encryption_channels (receiving_peer)
|
||||
comment 'The index of the receiving peer address';
|
||||
|
||||
create index encryption_channels_state_index
|
||||
on encryption_channels (state)
|
||||
comment 'The index for the state column';
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue