Closed russellmoya closed 4 years ago
ok
how to know the phone number or the uid of the users in this data uploaded
How did you manage to get the upload PIN? @russellmoya
@russellmoya you can download uploaded file by ObjectMetadata and decode msg (where contains encoded contacted user id) from the records list and token (where contains encoded user id who uploaded data). But your token is empty and it seems you are avoided getToken process.
Thanks a lot @rinekri for answer me. i remove the token , but in the original code , i have the token . @rinekri . i have Encryption secret key , that i store in google cloud secret manager . but i want know how to decode msg and token
@russellmoya you can download uploaded file by ObjectMetadata and decode msg (where contains encoded contacted user id) from the records list and token (where contains encoded user id who uploaded data). But your token is empty and it seems you are avoided getToken process.
How did you manage to get the upload PIN? @russellmoya
i modify getUploadToken.ts file . in the getUploadToken.ts , i change if (data) code . the new code :
if (data) {
//const uploadCodes = await retrieveUploadCodes();
const uploadCodes = uid.substring(0, 6).toUpperCase();
console.log('getUploadToken:', obtained ${uploadCodes.length} upload codes
);
console.log("voici le code de retrive",uploadCodes);
if(uploadCodes.length >0){
if(uploadCodes === data.toUpperCase()){
valid = true ;
} else {
valid = false ;
}
}
// valid = uploadCodes.find(x => x === data) !== undefined;
console.log('getUploadToken:', data is ${valid ? 'valid' : 'not valid'} code
);
}
@rinekri yeah. This is an example how you can download uploaded data to decrypt it:
async function getCurrentUploadedData(event: ObjectMetadata): Promise<UploadedData> {
return admin.storage().bucket(event.bucket).file(event.name!).download().then(file => {
const uploadedData = JSON.parse(file[0].toString())
console.log('getUploadedData:', `Uploaded data token: ${uploadedData.token}`);
return uploadedData
}).catch(function (error) {
console.log("getUploadedData", error);
return null
})
}
interface UploadedData {
records: Record[];
token: string
}
interface Record {
id: string,
msg: string,
timestamp: string
}
thanks
Can you please use a valid title and explain your issue in the "description" section?