From e38ebf277a37fe33f406948d92c68e6ad8f60890 Mon Sep 17 00:00:00 2001 From: netkas Date: Mon, 27 Jan 2025 15:28:41 -0500 Subject: [PATCH] Rewrote contact_known_keys structure --- .../Resources/database/contact_known_keys.sql | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/Socialbox/Classes/Resources/database/contact_known_keys.sql b/src/Socialbox/Classes/Resources/database/contact_known_keys.sql index 9304131..164dc48 100644 --- a/src/Socialbox/Classes/Resources/database/contact_known_keys.sql +++ b/src/Socialbox/Classes/Resources/database/contact_known_keys.sql @@ -1,20 +1,22 @@ create table contacts_known_keys ( - contact_uuid varchar(36) not null comment 'The UUID of the contact in reference to', - key_name varchar(64) not null comment 'The name of the key', - public_key varchar(64) not null comment 'The public signing key', - expires timestamp not null comment 'The Timestamp for when this key expires', - trusted_at timestamp default current_timestamp() not null comment 'The Timestamp for when this signing key was trusted', - primary key (contact_uuid, key_name) comment 'The unique key-name pair with the contact uuid to ensure no keys with the same names should exist', - constraint contacts_known_keys_contact_uuid_key_name_uindex - unique (contact_uuid, key_name) comment 'The unique key-name pair with the contact uuid to ensure no keys with the same names should exist', + contact_uuid varchar(36) not null comment 'The Unique Universal Identifier of the personal contact that this record is associated with', + signature_uuid varchar(36) not null comment 'The Unique Universal Identifier for the signature key', + signature_name varchar(64) not null comment 'The name of the signing key', + signature_key varchar(32) not null comment 'The public signing key', + expires timestamp null comment 'The Timestamp for when this key expires, null means never', + created timestamp not null comment 'The Timestamp for when this key was created', + trusted_on timestamp default current_timestamp() not null comment 'The Timestamp for when the peer trusted this key', + primary key (contact_uuid, signature_uuid), + constraint contacts_known_keys_signature_uuid_contact_uuid_uindex + unique (signature_uuid, contact_uuid) comment 'The Unique Signature Index Pair for the contact UUID and key UUID', constraint contacts_known_keys_contacts_uuid_fk foreign key (contact_uuid) references contacts (uuid) on update cascade on delete cascade ) - comment 'Table for housing known signing keys for peer contacts'; + comment 'Table for housing known keys associated with personal contact records'; -create index contacts_known_keys_key_name_index - on contacts_known_keys (key_name) - comment 'The index for the key name'; +create index contacts_known_keys_contact_uuid_index + on contacts_known_keys (contact_uuid) + comment 'The Index of the contact UUID';