Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: tobiasKaminsky <[email protected]>
  • Loading branch information
tobiasKaminsky committed Aug 28, 2023
1 parent e438a11 commit 9695831
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 94 deletions.
190 changes: 98 additions & 92 deletions app/schemas/com.nextcloud.client.database.NextcloudDatabase/72.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"formatVersion": 1,
"database": {
"version": 72,
"identityHash": "01c9860bc7f6f6995e66391b1674a0d8",
"entities": [
{
"tableName": "arbitrary_data",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `cloud_id` TEXT, `key` TEXT, `value` TEXT)",
"fields": [
{
"fieldPath": "id",
"columnName": "_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "cloudId",
"columnName": "cloud_id",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "key",
"columnName": "key",
"version": 72,
"identityHash": "fdeb76a909f0dc781a4097d8e49828e7",
"entities": [
{
"tableName": "arbitrary_data",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `cloud_id` TEXT, `key` TEXT, `value` TEXT)",
"fields": [
{
"fieldPath": "id",
"columnName": "_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "cloudId",
"columnName": "cloud_id",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "key",
"columnName": "key",
"affinity": "TEXT",
"notNull": false
},
Expand All @@ -32,39 +32,39 @@
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"_id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "capabilities",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` TEXT, `version_mayor` INTEGER, `version_minor` INTEGER, `version_micro` INTEGER, `version_string` TEXT, `version_edition` TEXT, `extended_support` INTEGER, `core_pollinterval` INTEGER, `sharing_api_enabled` INTEGER, `sharing_public_enabled` INTEGER, `sharing_public_password_enforced` INTEGER, `sharing_public_expire_date_enabled` INTEGER, `sharing_public_expire_date_days` INTEGER, `sharing_public_expire_date_enforced` INTEGER, `sharing_public_send_mail` INTEGER, `sharing_public_upload` INTEGER, `sharing_user_send_mail` INTEGER, `sharing_resharing` INTEGER, `sharing_federation_outgoing` INTEGER, `sharing_federation_incoming` INTEGER, `files_bigfilechunking` INTEGER, `files_undelete` INTEGER, `files_versioning` INTEGER, `external_links` INTEGER, `server_name` TEXT, `server_color` TEXT, `server_text_color` TEXT, `server_element_color` TEXT, `server_slogan` TEXT, `server_logo` TEXT, `background_url` TEXT, `end_to_end_encryption` INTEGER, `end_to_end_encryption_keys_exist` INTEGER, `activity` INTEGER, `background_default` INTEGER, `background_plain` INTEGER, `richdocument` INTEGER, `richdocument_mimetype_list` TEXT, `richdocument_direct_editing` INTEGER, `richdocument_direct_templates` INTEGER, `richdocument_optional_mimetype_list` TEXT, `sharing_public_ask_for_optional_password` INTEGER, `richdocument_product_name` TEXT, `direct_editing_etag` TEXT, `user_status` INTEGER, `user_status_supports_emoji` INTEGER, `etag` TEXT, `files_locking_version` TEXT, `groupfolders` INTEGER)",
"fields": [
{
"fieldPath": "id",
"columnName": "_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "accountName",
"columnName": "account",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "versionMajor",
"columnName": "version_mayor",
"affinity": "INTEGER",
"notNull": false
},
{
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"_id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "capabilities",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` TEXT, `version_mayor` INTEGER, `version_minor` INTEGER, `version_micro` INTEGER, `version_string` TEXT, `version_edition` TEXT, `extended_support` INTEGER, `core_pollinterval` INTEGER, `sharing_api_enabled` INTEGER, `sharing_public_enabled` INTEGER, `sharing_public_password_enforced` INTEGER, `sharing_public_expire_date_enabled` INTEGER, `sharing_public_expire_date_days` INTEGER, `sharing_public_expire_date_enforced` INTEGER, `sharing_public_send_mail` INTEGER, `sharing_public_upload` INTEGER, `sharing_user_send_mail` INTEGER, `sharing_resharing` INTEGER, `sharing_federation_outgoing` INTEGER, `sharing_federation_incoming` INTEGER, `files_bigfilechunking` INTEGER, `files_undelete` INTEGER, `files_versioning` INTEGER, `external_links` INTEGER, `server_name` TEXT, `server_color` TEXT, `server_text_color` TEXT, `server_element_color` TEXT, `server_slogan` TEXT, `server_logo` TEXT, `background_url` TEXT, `end_to_end_encryption` INTEGER, `end_to_end_encryption_keys_exist` INTEGER, `end_to_end_encryption_api_version` TEXT, `activity` INTEGER, `background_default` INTEGER, `background_plain` INTEGER, `richdocument` INTEGER, `richdocument_mimetype_list` TEXT, `richdocument_direct_editing` INTEGER, `richdocument_direct_templates` INTEGER, `richdocument_optional_mimetype_list` TEXT, `sharing_public_ask_for_optional_password` INTEGER, `richdocument_product_name` TEXT, `direct_editing_etag` TEXT, `user_status` INTEGER, `user_status_supports_emoji` INTEGER, `etag` TEXT, `files_locking_version` TEXT, `groupfolders` INTEGER)",
"fields": [
{
"fieldPath": "id",
"columnName": "_id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "accountName",
"columnName": "account",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "versionMajor",
"columnName": "version_mayor",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "versionMinor",
"columnName": "version_minor",
"affinity": "INTEGER",
Expand Down Expand Up @@ -234,41 +234,47 @@
},
{
"fieldPath": "serverBackgroundUrl",
"columnName": "background_url",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "endToEndEncryption",
"columnName": "end_to_end_encryption",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "endToEndEncryptionKeysExist",
"columnName": "end_to_end_encryption_keys_exist",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "activity",
"columnName": "activity",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "serverBackgroundDefault",
"columnName": "background_default",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "serverBackgroundPlain",
"columnName": "background_plain",
"affinity": "INTEGER",
"notNull": false
},
{
"columnName": "background_url",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "endToEndEncryption",
"columnName": "end_to_end_encryption",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "endToEndEncryptionKeysExist",
"columnName": "end_to_end_encryption_keys_exist",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "endToEndEncryptionApiVersion",
"columnName": "end_to_end_encryption_api_version",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "activity",
"columnName": "activity",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "serverBackgroundDefault",
"columnName": "background_default",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "serverBackgroundPlain",
"columnName": "background_plain",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "richdocument",
"columnName": "richdocument",
"affinity": "INTEGER",
Expand Down Expand Up @@ -1143,7 +1149,7 @@
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '01c9860bc7f6f6995e66391b1674a0d8')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'fdeb76a909f0dc781a4097d8e49828e7')"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ data class CapabilityEntity(
val endToEndEncryption: Int?,
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_END_TO_END_ENCRYPTION_KEYS_EXIST)
val endToEndEncryptionKeysExist: Int?,
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_END_TO_END_ENCRYPTION_API_VERSION)
val endToEndEncryptionApiVersion: String?,
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_ACTIVITY)
val activity: Int?,
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_SERVER_BACKGROUND_DEFAULT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.lib.resources.shares.ShareeUser;
import com.owncloud.android.lib.resources.status.CapabilityBooleanType;
import com.owncloud.android.lib.resources.status.E2EVersion;
import com.owncloud.android.lib.resources.status.OCCapability;
import com.owncloud.android.operations.RemoteOperationFailedException;
import com.owncloud.android.utils.FileStorageUtils;
Expand Down Expand Up @@ -1910,6 +1911,8 @@ private ContentValues createContentValues(String accountName, OCCapability capab
capability.getEndToEndEncryption().getValue());
contentValues.put(ProviderTableMeta.CAPABILITIES_END_TO_END_ENCRYPTION_KEYS_EXIST,
capability.getEndToEndEncryptionKeysExist().getValue());
contentValues.put(ProviderTableMeta.CAPABILITIES_END_TO_END_ENCRYPTION_API_VERSION,
capability.getEndToEndEncryptionApiVersion().getValue());
contentValues.put(ProviderTableMeta.CAPABILITIES_SERVER_BACKGROUND_DEFAULT,
capability.getServerBackgroundDefault().getValue());
contentValues.put(ProviderTableMeta.CAPABILITIES_SERVER_BACKGROUND_PLAIN,
Expand Down Expand Up @@ -2061,6 +2064,11 @@ private OCCapability createCapabilityInstance(Cursor cursor) {
getBoolean(cursor,
ProviderTableMeta.CAPABILITIES_END_TO_END_ENCRYPTION_KEYS_EXIST)
);
capability.setEndToEndEncryptionApiVersion(
E2EVersion.fromValue(
getString(cursor, ProviderTableMeta.CAPABILITIES_END_TO_END_ENCRYPTION_API_VERSION)
)
);
capability.setServerBackgroundDefault(
getBoolean(cursor, ProviderTableMeta.CAPABILITIES_SERVER_BACKGROUND_DEFAULT));
capability.setServerBackgroundPlain(getBoolean(cursor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ static public class ProviderTableMeta implements BaseColumns {
public static final String CAPABILITIES_SERVER_BACKGROUND_PLAIN = "background_plain";
public static final String CAPABILITIES_END_TO_END_ENCRYPTION = "end_to_end_encryption";
public static final String CAPABILITIES_END_TO_END_ENCRYPTION_KEYS_EXIST = "end_to_end_encryption_keys_exist";
public static final String CAPABILITIES_END_TO_END_ENCRYPTION_API_VERSION = "end_to_end_encryption_api_version";
public static final String CAPABILITIES_ACTIVITY = "activity";
public static final String CAPABILITIES_RICHDOCUMENT = "richdocument";
public static final String CAPABILITIES_RICHDOCUMENT_MIMETYPE_LIST = "richdocument_mimetype_list";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ private Dialog createDialog(View v) {

try {
String privateKey = task.get();
String mnemonicUnchanged = binding.encryptionPasswordInput.getText().toString();
String mnemonicUnchanged = binding.encryptionPasswordInput.getText().toString().trim();
String mnemonic = binding.encryptionPasswordInput.getText().toString().replaceAll("\\s", "")
.toLowerCase(Locale.ROOT);
String decryptedPrivateKey = EncryptionUtils.decryptPrivateKey(privateKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public static DecryptedFolderMetadataFileV1 decryptFolderMetaData(EncryptedFolde
}

// verify checksum
String mnemonic = arbitraryDataProvider.getValue(user.getAccountName(), EncryptionUtils.MNEMONIC);
String mnemonic = arbitraryDataProvider.getValue(user.getAccountName(), EncryptionUtils.MNEMONIC).trim();
String checksum = EncryptionUtils.generateChecksum(decryptedFolderMetadata, mnemonic);
String decryptedFolderChecksum = decryptedFolderMetadata.getMetadata().getChecksum();

Expand Down

0 comments on commit 9695831

Please sign in to comment.