Remove redundant log and dead code
This commit is contained in:
parent
ac11893e93
commit
ed4fa732f7
@ -604,7 +604,6 @@ export async function registerAllListeners() {
|
|||||||
const publicData: Record<string, any> = {};
|
const publicData: Record<string, any> = {};
|
||||||
|
|
||||||
for (const field of Object.keys(newData)) {
|
for (const field of Object.keys(newData)) {
|
||||||
console.log('🚀 ~ handleUpdateProcess ~ newData[field]:', newData[field]);
|
|
||||||
// Public data are carried along each new state
|
// Public data are carried along each new state
|
||||||
// So the first thing we can do is check if the new data is public data
|
// So the first thing we can do is check if the new data is public data
|
||||||
if (lastState.public_data[field]) {
|
if (lastState.public_data[field]) {
|
||||||
@ -743,8 +742,6 @@ export async function registerAllListeners() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Initialized event handlers');
|
|
||||||
|
|
||||||
window.parent.postMessage(
|
window.parent.postMessage(
|
||||||
{
|
{
|
||||||
type: MessageType.LISTENING
|
type: MessageType.LISTENING
|
||||||
|
@ -488,7 +488,6 @@ export default class Services {
|
|||||||
try {
|
try {
|
||||||
// console.log('parsing new cipher');
|
// console.log('parsing new cipher');
|
||||||
const apiReturn = this.sdkClient.parse_cipher(message, membersList);
|
const apiReturn = this.sdkClient.parse_cipher(message, membersList);
|
||||||
console.log('🚀 ~ Services ~ parseCipher ~ apiReturn:', apiReturn);
|
|
||||||
await this.handleApiReturn(apiReturn);
|
await this.handleApiReturn(apiReturn);
|
||||||
|
|
||||||
// Device 1 wait Device 2
|
// Device 1 wait Device 2
|
||||||
@ -526,7 +525,6 @@ export default class Services {
|
|||||||
if (apiReturn.partial_tx) {
|
if (apiReturn.partial_tx) {
|
||||||
try {
|
try {
|
||||||
const res = this.sdkClient.sign_transaction(apiReturn.partial_tx);
|
const res = this.sdkClient.sign_transaction(apiReturn.partial_tx);
|
||||||
console.log('Adding tx to new_tx_to_send');
|
|
||||||
apiReturn.new_tx_to_send = res.new_tx_to_send;
|
apiReturn.new_tx_to_send = res.new_tx_to_send;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Failed to sign transaction:', e);
|
console.error('Failed to sign transaction:', e);
|
||||||
@ -574,9 +572,6 @@ export default class Services {
|
|||||||
|
|
||||||
if (updatedProcess.encrypted_data && Object.keys(updatedProcess.encrypted_data).length != 0) {
|
if (updatedProcess.encrypted_data && Object.keys(updatedProcess.encrypted_data).length != 0) {
|
||||||
for (const [hash, cipher] of Object.entries(updatedProcess.encrypted_data)) {
|
for (const [hash, cipher] of Object.entries(updatedProcess.encrypted_data)) {
|
||||||
// console.log('Saving encrypted data');
|
|
||||||
// console.log(`hash: ${hash}`);
|
|
||||||
// console.log(`cipher: ${cipher}`);
|
|
||||||
const blob = this.hexToBlob(cipher);
|
const blob = this.hexToBlob(cipher);
|
||||||
try {
|
try {
|
||||||
await this.saveBlobToDb(hash, blob);
|
await this.saveBlobToDb(hash, blob);
|
||||||
@ -661,7 +656,6 @@ export default class Services {
|
|||||||
this.processId = null;
|
this.processId = null;
|
||||||
this.stateId = null;
|
this.stateId = null;
|
||||||
const newDevice = this.dumpDeviceFromMemory();
|
const newDevice = this.dumpDeviceFromMemory();
|
||||||
console.log(newDevice);
|
|
||||||
await this.saveDeviceInDatabase(newDevice);
|
await this.saveDeviceInDatabase(newDevice);
|
||||||
await navigate('account');
|
await navigate('account');
|
||||||
}
|
}
|
||||||
@ -819,13 +813,11 @@ export default class Services {
|
|||||||
|
|
||||||
async dumpWallet() {
|
async dumpWallet() {
|
||||||
const wallet = await this.sdkClient.dump_wallet();
|
const wallet = await this.sdkClient.dump_wallet();
|
||||||
console.log('🚀 ~ Services ~ dumpWallet ~ wallet:', wallet);
|
|
||||||
return wallet;
|
return wallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public createFaucetMessage() {
|
public createFaucetMessage() {
|
||||||
const message = this.sdkClient.create_faucet_msg();
|
const message = this.sdkClient.create_faucet_msg();
|
||||||
console.log('🚀 ~ Services ~ createFaucetMessage ~ message:', message);
|
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -834,7 +826,6 @@ export default class Services {
|
|||||||
try {
|
try {
|
||||||
spAddress = await this.sdkClient.create_new_device(0, 'signet');
|
spAddress = await this.sdkClient.create_new_device(0, 'signet');
|
||||||
const device = this.dumpDeviceFromMemory();
|
const device = this.dumpDeviceFromMemory();
|
||||||
console.log('🚀 ~ Services ~ device:', device);
|
|
||||||
await this.saveDeviceInDatabase(device);
|
await this.saveDeviceInDatabase(device);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Services ~ Error:', e);
|
console.error('Services ~ Error:', e);
|
||||||
@ -1109,7 +1100,6 @@ export default class Services {
|
|||||||
if (clear) {
|
if (clear) {
|
||||||
// deserialize the result to get the actual data
|
// deserialize the result to get the actual data
|
||||||
const decoded = this.sdkClient.decode_value(clear);
|
const decoded = this.sdkClient.decode_value(clear);
|
||||||
// console.log('Decoded value:', JSON.stringify(decoded));
|
|
||||||
return decoded;
|
return decoded;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('decrypt_data returned null');
|
throw new Error('decrypt_data returned null');
|
||||||
@ -1578,143 +1568,4 @@ export default class Services {
|
|||||||
document.body.removeChild(a);
|
document.body.removeChild(a);
|
||||||
URL.revokeObjectURL(url);
|
URL.revokeObjectURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public async getProfilesAttributes(): Promise<Record<string, Record<string, any>>> {
|
|
||||||
// const processes = await this.getProcesses();
|
|
||||||
// const profilesAttributes: Record<string, Record<string, any>> = {};
|
|
||||||
|
|
||||||
// for (const processId of Object.keys(processes)) {
|
|
||||||
// try {
|
|
||||||
// const process = await this.getProcess(processId);
|
|
||||||
// let lastCommitedState = this.getLastCommitedState(process);
|
|
||||||
|
|
||||||
// // If no committed state, use the first state
|
|
||||||
// if (!lastCommitedState) {
|
|
||||||
// lastCommitedState = process.states[0];
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Check if it's a profile process
|
|
||||||
// const description = await this.decryptAttribute(processId, lastCommitedState, 'description');
|
|
||||||
// if (!description || description !== "profile") {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Get all attributes for this profile
|
|
||||||
// if (lastCommitedState.pcd_commitment) {
|
|
||||||
// const attributesKeys = Object.keys(lastCommitedState.pcd_commitment);
|
|
||||||
// const decryptedAttributes: Record<string, any> = {};
|
|
||||||
|
|
||||||
// // Decrypt each attribute
|
|
||||||
// for (const key of attributesKeys) {
|
|
||||||
// try {
|
|
||||||
// const attribute = await this.decryptAttribute(processId, lastCommitedState, key);
|
|
||||||
// if (attribute !== null) {
|
|
||||||
// decryptedAttributes[key] = attribute;
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// console.error(`Failed to decrypt attribute ${key}:`, e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Add public data (like certification status)
|
|
||||||
// const publicData = this.getPublicData(process);
|
|
||||||
// if (publicData) {
|
|
||||||
// for (const [key, value] of Object.entries(publicData)) {
|
|
||||||
// decryptedAttributes[key] = value;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Only add profiles that have attributes
|
|
||||||
// if (Object.keys(decryptedAttributes).length > 0) {
|
|
||||||
// profilesAttributes[processId] = decryptedAttributes;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// console.error(`Error processing process ${processId}:`, e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return profilesAttributes;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// public async getNotaryAttributes(): Promise<Record<string, Record<string, any>>> {
|
|
||||||
// const processes = await this.getProcesses();
|
|
||||||
// const notaryAttributes: Record<string, Record<string, any>> = {};
|
|
||||||
|
|
||||||
// for (const [processId, process] of Object.entries(processes)) {
|
|
||||||
// try {
|
|
||||||
// const publicData = this.getPublicData(process);
|
|
||||||
|
|
||||||
// if (!publicData || !publicData.name || !publicData.lastName) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// const attributes = {
|
|
||||||
// name: publicData.name,
|
|
||||||
// lastName: publicData.lastName,
|
|
||||||
// };
|
|
||||||
// notaryAttributes[processId] = attributes;
|
|
||||||
|
|
||||||
// } catch (e) {
|
|
||||||
// console.error(`Error processing process ${processId}:`, e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return notaryAttributes;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// public async addDevice(processId: string) {
|
|
||||||
// const process = await this.getProcess(processId);
|
|
||||||
// const publicData = this.getPublicData(process);
|
|
||||||
// if (!publicData) {
|
|
||||||
// console.error('Invalid process: Failed to get public data');
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// const pairedAddresses = publicData.pairedAddresses;
|
|
||||||
// if (!pairedAddresses) {
|
|
||||||
// console.error('Not a pairing process, no pairedAddresses');
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const roles = this.getRoles(process);
|
|
||||||
// if (!roles) {
|
|
||||||
// console.error('Invalid process: Failed to get roles');
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// if (!roles.pairing) {
|
|
||||||
// console.error('Not a pairing process, no pairing role');
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const deviceAddress = await this.getDeviceAddress();
|
|
||||||
|
|
||||||
// this.device1 = true;
|
|
||||||
|
|
||||||
// publicData.pairedAddresses.push(deviceAddress);
|
|
||||||
// let newState = {
|
|
||||||
// pairedAddresses: publicData.pairedAddresses,
|
|
||||||
// }
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// console.log("process", process);
|
|
||||||
// console.log("newState", newState);
|
|
||||||
// console.log("roles", roles);
|
|
||||||
// apiReturn = await this.updateProcess(process, newState, publicData, roles);
|
|
||||||
// } catch (e) {
|
|
||||||
// throw new Error(e);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// const updatedProcess = apiReturn.updated_process.current_process;
|
|
||||||
// const newStateId = updatedProcess.states[0].state_id;
|
|
||||||
// await this.handleApiReturn(apiReturn);
|
|
||||||
|
|
||||||
// const modalService = await ModalService.getInstance();
|
|
||||||
// await modalService.openPairingConfirmationModal(roles, processId, newStateId);
|
|
||||||
// await modalService.confirmAddingDevice();
|
|
||||||
// } catch (e) {
|
|
||||||
// console.error('Failed to add device:', e);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,6 @@ export default class TokenService {
|
|||||||
.setExpirationTime(this.REFRESH_TOKEN_EXPIRATION)
|
.setExpirationTime(this.REFRESH_TOKEN_EXPIRATION)
|
||||||
.sign(secret);
|
.sign(secret);
|
||||||
|
|
||||||
console.log('Tokens JWT générés - Access:', accessToken);
|
|
||||||
console.log('Tokens JWT générés - Refresh:', refreshToken);
|
|
||||||
|
|
||||||
return { accessToken, refreshToken };
|
return { accessToken, refreshToken };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,9 +44,6 @@ export default class TokenService {
|
|||||||
const secret = new Uint8Array(this.encoder.encode(this.SECRET_KEY));
|
const secret = new Uint8Array(this.encoder.encode(this.SECRET_KEY));
|
||||||
const { payload } = await jose.jwtVerify(token, secret);
|
const { payload } = await jose.jwtVerify(token, secret);
|
||||||
|
|
||||||
console.log('Validation du token JWT:', token);
|
|
||||||
console.log('Données décodées:', payload);
|
|
||||||
|
|
||||||
return payload.origin === origin;
|
return payload.origin === origin;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
if (error?.code === 'ERR_JWT_EXPIRED') {
|
if (error?.code === 'ERR_JWT_EXPIRED') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user