Made message signing in Cryptography use SHA512 as the message content for... #1
5 changed files with 81 additions and 0 deletions
3
.idea/sqldialects.xml
generated
3
.idea/sqldialects.xml
generated
|
@ -3,10 +3,13 @@
|
||||||
<component name="SqlDialectMappings">
|
<component name="SqlDialectMappings">
|
||||||
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/authentication_otp.sql" dialect="MariaDB" />
|
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/authentication_otp.sql" dialect="MariaDB" />
|
||||||
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/captcha_images.sql" dialect="MariaDB" />
|
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/captcha_images.sql" dialect="MariaDB" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/contact_known_keys.sql" dialect="MariaDB" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/contacts.sql" dialect="MariaDB" />
|
||||||
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/external_sessions.sql" dialect="MariaDB" />
|
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/external_sessions.sql" dialect="MariaDB" />
|
||||||
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/peer_information.sql" dialect="MariaDB" />
|
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/peer_information.sql" dialect="MariaDB" />
|
||||||
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/peers.sql" dialect="MariaDB" />
|
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/peers.sql" dialect="MariaDB" />
|
||||||
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/sessions.sql" dialect="MariaDB" />
|
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/sessions.sql" dialect="MariaDB" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/signing_keys.sql" dialect="MariaDB" />
|
||||||
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/variables.sql" dialect="MariaDB" />
|
<file url="file://$PROJECT_DIR$/src/Socialbox/Classes/Resources/database/variables.sql" dialect="MariaDB" />
|
||||||
<file url="file://$PROJECT_DIR$/src/Socialbox/Managers/CaptchaManager.php" dialect="MariaDB" />
|
<file url="file://$PROJECT_DIR$/src/Socialbox/Managers/CaptchaManager.php" dialect="MariaDB" />
|
||||||
<file url="file://$PROJECT_DIR$/src/Socialbox/Managers/ContactManager.php" dialect="MariaDB" />
|
<file url="file://$PROJECT_DIR$/src/Socialbox/Managers/ContactManager.php" dialect="MariaDB" />
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
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',
|
||||||
|
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';
|
||||||
|
|
||||||
|
create index contacts_known_keys_key_name_index
|
||||||
|
on contacts_known_keys (key_name)
|
||||||
|
comment 'The index for the key name';
|
||||||
|
|
18
src/Socialbox/Classes/Resources/database/contacts.sql
Normal file
18
src/Socialbox/Classes/Resources/database/contacts.sql
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
create table contacts
|
||||||
|
(
|
||||||
|
uuid varchar(36) default uuid() not null comment 'The contact UUID for the record'
|
||||||
|
primary key comment 'The Primary Unique Universal Identifier for the contact record',
|
||||||
|
peer_uuid varchar(36) not null comment 'The Peer UUID',
|
||||||
|
contact_peer_address varchar(256) not null comment 'The contact peer address',
|
||||||
|
relationship enum ('MUTUAL', 'TRUSTED', 'BLOCKED') default 'MUTUAL' not null comment 'The relationship between the two peers, MUTUAL=The contact peer is recognized',
|
||||||
|
created timestamp default current_timestamp() not null comment 'The Timestamp for when this contact was created',
|
||||||
|
constraint contacts_uuid_uindex
|
||||||
|
unique (uuid) comment 'The Primary Unique Universal Identifier for the contact record',
|
||||||
|
constraint peer_contacts_peer_uuid_contact_peer_address_uindex
|
||||||
|
unique (peer_uuid, contact_peer_address) comment 'The Unique Peer UUID & Contact Peer Address combination pair',
|
||||||
|
constraint peer_contacts_registered_peers_uuid_fk
|
||||||
|
foreign key (peer_uuid) references registered_peers (uuid)
|
||||||
|
on update cascade on delete cascade
|
||||||
|
)
|
||||||
|
comment 'Table for housing personal contacts for peers';
|
||||||
|
|
32
src/Socialbox/Classes/Resources/database/signing_keys.sql
Normal file
32
src/Socialbox/Classes/Resources/database/signing_keys.sql
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
create table signing_keys
|
||||||
|
(
|
||||||
|
peer_uuid varchar(36) not null comment 'The UUID of the peer',
|
||||||
|
uuid varchar(36) default uuid() not null comment 'The UUID of the key record',
|
||||||
|
name varchar(64) null comment 'Optional. User provided name for the key',
|
||||||
|
public_key varchar(64) not null comment 'The Public Signature Key',
|
||||||
|
state enum ('ACTIVE', 'EXPIRED') default 'ACTIVE' not null comment 'The state of the public key',
|
||||||
|
expires timestamp null comment 'The Timestamp for when this key expires, null = Never expires',
|
||||||
|
created timestamp default current_timestamp() not null comment 'The Timestamp for when the signing key record was created',
|
||||||
|
primary key (peer_uuid, uuid) comment 'The Unique Index pair for the signing key name and the UUID of the peer',
|
||||||
|
constraint signing_keys_peer_uuid_uuid_uindex
|
||||||
|
unique (peer_uuid, uuid) comment 'The Unique Index pair for the signing key name and the UUID of the peer',
|
||||||
|
constraint signing_keys_pk
|
||||||
|
unique (peer_uuid, uuid) comment 'The Unique Index pair for the signing key name and the UUID of the peer',
|
||||||
|
constraint signing_keys_registered_peers_uuid_fk
|
||||||
|
foreign key (peer_uuid) references registered_peers (uuid)
|
||||||
|
on update cascade on delete cascade
|
||||||
|
)
|
||||||
|
comment 'Table for housing public signing keys for peers on the network';
|
||||||
|
|
||||||
|
create index signing_keys_peer_uuid_index
|
||||||
|
on signing_keys (peer_uuid)
|
||||||
|
comment 'The primary index for the peer UUID column';
|
||||||
|
|
||||||
|
create index signing_keys_state_index
|
||||||
|
on signing_keys (state)
|
||||||
|
comment 'Signing key state index';
|
||||||
|
|
||||||
|
create index signing_keys_uuid_index
|
||||||
|
on signing_keys (uuid)
|
||||||
|
comment 'The index for the signing key name';
|
||||||
|
|
|
@ -14,8 +14,12 @@
|
||||||
case AUTHENTICATION_OTP = 'authentication_otp.sql';
|
case AUTHENTICATION_OTP = 'authentication_otp.sql';
|
||||||
case CAPTCHA_IMAGES = 'captcha_images.sql';
|
case CAPTCHA_IMAGES = 'captcha_images.sql';
|
||||||
case SESSIONS = 'sessions.sql';
|
case SESSIONS = 'sessions.sql';
|
||||||
|
case CONTACTS = 'contacts.sql';
|
||||||
|
case SIGNING_KEYS = 'signing_keys.sql';
|
||||||
case EXTERNAL_SESSIONS = 'external_sessions.sql';
|
case EXTERNAL_SESSIONS = 'external_sessions.sql';
|
||||||
|
|
||||||
|
case CONTACT_KNOWN_KEYS = 'contact_known_keys.sql';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the priority of the database object
|
* Returns the priority of the database object
|
||||||
*
|
*
|
||||||
|
@ -34,8 +38,12 @@
|
||||||
self::AUTHENTICATION_PASSWORDS,
|
self::AUTHENTICATION_PASSWORDS,
|
||||||
self::AUTHENTICATION_OTP,
|
self::AUTHENTICATION_OTP,
|
||||||
self::CAPTCHA_IMAGES,
|
self::CAPTCHA_IMAGES,
|
||||||
|
self::CONTACTS,
|
||||||
self::SESSIONS,
|
self::SESSIONS,
|
||||||
|
self::SIGNING_KEYS,
|
||||||
self::EXTERNAL_SESSIONS => 2,
|
self::EXTERNAL_SESSIONS => 2,
|
||||||
|
|
||||||
|
self::CONTACT_KNOWN_KEYS => 3,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue