Add selfie support.
GitOrigin-RevId: 3a778f7000dc074a568e1e44de0a7ca3d208f77b
This commit is contained in:
parent
fb79d6f95a
commit
022bd092ce
@ -830,11 +830,11 @@ passportDataTypePhoneNumber = PassportDataType;
|
|||||||
passportDataTypeEmailAddress = PassportDataType;
|
passportDataTypeEmailAddress = PassportDataType;
|
||||||
|
|
||||||
|
|
||||||
//@description Contains information about a Telegram Passport data @type Telegram Passport data type @data TODO data should be typed @files List of attached files
|
//@description Contains information about a Telegram Passport data @type Telegram Passport data type @data TODO data should be typed @files List of attached files with a document @selfie Selfie with the document
|
||||||
passportData type:PassportDataType data:string files:vector<file> = PassportData;
|
passportData type:PassportDataType data:string files:vector<file> selfie:file = PassportData;
|
||||||
|
|
||||||
//@description Contains information about a Telegram Passport data to save @type Telegram Passport data type @data TODO data should be typed @files List of attached files
|
//@description Contains information about a Telegram Passport data to save @type Telegram Passport data type @data TODO data should be typed @files List of attached files with a document @selfie Selfie with the document
|
||||||
inputPassportData type:PassportDataType data:string files:vector<InputFile> = InputPassportData;
|
inputPassportData type:PassportDataType data:string files:vector<InputFile> selfie:file = InputPassportData;
|
||||||
|
|
||||||
|
|
||||||
//@class PassportAuthorizationForm Contains information about requested Telegram Passport authorization form @data Available data
|
//@class PassportAuthorizationForm Contains information about requested Telegram Passport authorization form @data Available data
|
||||||
@ -845,8 +845,8 @@ passportAuthorizationForm id:int32 data:vector<PassportData> = PassportAuthoriza
|
|||||||
encryptedCredentials data:bytes hash:bytes secret:bytes = EncryptedCredentials;
|
encryptedCredentials data:bytes hash:bytes secret:bytes = EncryptedCredentials;
|
||||||
|
|
||||||
|
|
||||||
//@description Contains information about an encrypted Telegram Passport data @type Telegram Passport data type @data Encrypted data about the user @files List of attached files @value Unencrypted data, phone number or email address
|
//@description Contains information about an encrypted Telegram Passport data @type Telegram Passport data type @data Encrypted data about the user @files List of attached files @value Unencrypted data, phone number or email address @selfie Selfie with the document
|
||||||
encryptedPassportData type:PassportDataType data:bytes files:vector<file> value:string = EncryptedPassportData;
|
encryptedPassportData type:PassportDataType data:bytes files:vector<file> value:string selfie:file = EncryptedPassportData;
|
||||||
|
|
||||||
|
|
||||||
//@class MessageContent @description Contains the content of a message
|
//@class MessageContent @description Contains the content of a message
|
||||||
|
Binary file not shown.
@ -281,7 +281,7 @@ td_api::object_ptr<td_api::encryptedPassportData> get_encrypted_passport_data_ob
|
|||||||
bool is_plain = value.data.hash.empty();
|
bool is_plain = value.data.hash.empty();
|
||||||
return td_api::make_object<td_api::encryptedPassportData>(
|
return td_api::make_object<td_api::encryptedPassportData>(
|
||||||
get_passport_data_type_object(value.type), is_plain ? string() : value.data.data,
|
get_passport_data_type_object(value.type), is_plain ? string() : value.data.data,
|
||||||
get_encrypted_files_object(file_manager, value.files), is_plain ? value.data.data : string());
|
get_encrypted_files_object(file_manager, value.files), is_plain ? value.data.data : string(), get_encrypted_file_object(file_manager, value.selfie));
|
||||||
}
|
}
|
||||||
|
|
||||||
telegram_api::object_ptr<telegram_api::inputSecureValue> get_input_secure_value_object(
|
telegram_api::object_ptr<telegram_api::inputSecureValue> get_input_secure_value_object(
|
||||||
@ -351,6 +351,7 @@ Result<SecureValue> get_secure_value(td_api::object_ptr<td_api::inputPassportDat
|
|||||||
res.type = get_secure_value_type_td_api(std::move(input_passport_data->type_));
|
res.type = get_secure_value_type_td_api(std::move(input_passport_data->type_));
|
||||||
res.data = std::move(input_passport_data->data_);
|
res.data = std::move(input_passport_data->data_);
|
||||||
// res.files = TODO
|
// res.files = TODO
|
||||||
|
// res.selfie = TODO
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,6 +394,8 @@ Result<SecureValue> decrypt_encrypted_secure_value(FileManager *file_manager, co
|
|||||||
// TODO
|
// TODO
|
||||||
//TRY_RESULT(files, decrypt_secure_files(file_manager, secret, encrypted_secure_value.files));
|
//TRY_RESULT(files, decrypt_secure_files(file_manager, secret, encrypted_secure_value.files));
|
||||||
//res.files = std::move(files);
|
//res.files = std::move(files);
|
||||||
|
//TRY_RESULT(selfie, decrypt_secure_file(file_manager, secret, encrypted_secure_value.selfie));
|
||||||
|
//res.selfie = std::move(selfie);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -404,11 +407,13 @@ SecureFile encrypt_secure_file(FileManager *file_manager, const secure_storage::
|
|||||||
//TODO:
|
//TODO:
|
||||||
return SecureFile{};
|
return SecureFile{};
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<SecureFile> encrypt_secure_files(FileManager *file_manager, const secure_storage::Secret &master_secret,
|
vector<SecureFile> encrypt_secure_files(FileManager *file_manager, const secure_storage::Secret &master_secret,
|
||||||
vector<FileId> files, string &to_hash) {
|
vector<FileId> files, string &to_hash) {
|
||||||
return transform(files,
|
return transform(files,
|
||||||
[&](auto file_id) { return encrypt_secure_file(file_manager, master_secret, file_id, to_hash); });
|
[&](auto file_id) { return encrypt_secure_file(file_manager, master_secret, file_id, to_hash); });
|
||||||
}
|
}
|
||||||
|
|
||||||
SecureData encrypt_secure_data(const secure_storage::Secret &master_secret, Slice data, string &to_hash) {
|
SecureData encrypt_secure_data(const secure_storage::Secret &master_secret, Slice data, string &to_hash) {
|
||||||
namespace ss = secure_storage;
|
namespace ss = secure_storage;
|
||||||
auto secret = ss::Secret::create_new();
|
auto secret = ss::Secret::create_new();
|
||||||
@ -422,6 +427,7 @@ SecureData encrypt_secure_data(const secure_storage::Secret &master_secret, Slic
|
|||||||
to_hash.append(secret.as_slice().str());
|
to_hash.append(secret.as_slice().str());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
EncryptedSecureValue encrypt_secure_value(FileManager *file_manager, const secure_storage::Secret &master_secret,
|
EncryptedSecureValue encrypt_secure_value(FileManager *file_manager, const secure_storage::Secret &master_secret,
|
||||||
const SecureValue &secure_value) {
|
const SecureValue &secure_value) {
|
||||||
namespace ss = secure_storage;
|
namespace ss = secure_storage;
|
||||||
@ -438,6 +444,7 @@ EncryptedSecureValue encrypt_secure_value(FileManager *file_manager, const secur
|
|||||||
res.data = encrypt_secure_data(master_secret, secure_value.data, to_hash);
|
res.data = encrypt_secure_data(master_secret, secure_value.data, to_hash);
|
||||||
// TODO
|
// TODO
|
||||||
//res.files = encrypt_secure_files(file_manager, master_secret, secure_value.files, to_hash);
|
//res.files = encrypt_secure_files(file_manager, master_secret, secure_value.files, to_hash);
|
||||||
|
//res.selfie = encrypt_secure_file(file_manager, master_secret, secure_value.selfie, to_hash);
|
||||||
res.hash = ss::calc_value_hash(to_hash).as_slice().str();
|
res.hash = ss::calc_value_hash(to_hash).as_slice().str();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -126,6 +126,7 @@ class SecureValue {
|
|||||||
SecureValueType type;
|
SecureValueType type;
|
||||||
string data;
|
string data;
|
||||||
vector<FileId> files;
|
vector<FileId> files;
|
||||||
|
FileId selfie;
|
||||||
};
|
};
|
||||||
|
|
||||||
Result<SecureValue> get_secure_value(td_api::object_ptr<td_api::inputPassportData> &&input_passport_data);
|
Result<SecureValue> get_secure_value(td_api::object_ptr<td_api::inputPassportData> &&input_passport_data);
|
||||||
|
Loading…
Reference in New Issue
Block a user