Use new utils splitPrivateData
and isValid32ByteHex
This commit is contained in:
parent
6076c342f8
commit
d31e18d4ae
@ -9,6 +9,7 @@ import { LoginComponent } from './pages/home/home-component';
|
||||
import { prepareAndSendPairingTx } from './utils/sp-address.utils';
|
||||
import ModalService from './services/modal.service';
|
||||
import { MessageType } from './models/process.model';
|
||||
import { splitPrivateData, isValid32ByteHex } from './utils/service.utils';
|
||||
|
||||
const routes: { [key: string]: string } = {
|
||||
home: '/src/pages/home/home.html',
|
||||
@ -457,16 +458,7 @@ export async function registerAllListeners() {
|
||||
throw new Error('Invalid or expired session token');
|
||||
}
|
||||
|
||||
const privateData: Record<string, any> = {};
|
||||
const publicData: Record<string, any> = {};
|
||||
|
||||
Object.entries(processData).forEach(([key, value]) => {
|
||||
if (privateFields.includes(key)) {
|
||||
privateData[key] = value;
|
||||
} else {
|
||||
publicData[key] = value;
|
||||
}
|
||||
});
|
||||
const { privateData, publicData } = splitPrivateData(processData, privateFields);
|
||||
|
||||
const createProcessReturn = await services.createProcess(privateData, publicData, roles);
|
||||
if (!createProcessReturn.updated_process) {
|
||||
@ -512,6 +504,10 @@ export async function registerAllListeners() {
|
||||
throw new Error('Invalid or expired session token');
|
||||
}
|
||||
|
||||
if (!isValid32ByteHex(stateId)) {
|
||||
throw new Error('Invalid state id');
|
||||
}
|
||||
|
||||
const res = await services.createPrdUpdate(processId, stateId);
|
||||
await services.handleApiReturn(res);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user