Compare commits
No commits in common. "7d5861b831d01a7a7644f5f4ff1ffcd13203bac4" and "760ba211759029fddf729b011a2fe3d9900a9e9e" have entirely different histories.
7d5861b831
...
760ba21175
@ -238,54 +238,6 @@ export class SDKSignerClient {
|
|||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
async createProcess(processData: { [label: string]: any }, privateFields: string[], roles: any): Promise<ServerResponse> {
|
|
||||||
const message: ClientMessage = {
|
|
||||||
type: MessageType.CREATE_PROCESS,
|
|
||||||
processData,
|
|
||||||
privateFields,
|
|
||||||
roles,
|
|
||||||
messageId: this.generateMessageId()
|
|
||||||
};
|
|
||||||
|
|
||||||
return this.sendAndWait(message, MessageType.PROCESS_CREATED);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Are we part of user process as a validator?
|
|
||||||
// User on first connection do have his idnot
|
|
||||||
// we must check if there's already a process for this user
|
|
||||||
// if yes, user can add a new device he made the idnot login on
|
|
||||||
// if not, we create a new process and add it's pairing id
|
|
||||||
async getUserProcessByIdnot(idNot: string): Promise<{ processId: string, processData: any } | null> {
|
|
||||||
console.log('Getting user process by idnot:', idNot);
|
|
||||||
try {
|
|
||||||
const signerResponse: ServerResponse = await this.getOwnedProcesses();
|
|
||||||
// We are interested in the data
|
|
||||||
const processesData: any = signerResponse.data;
|
|
||||||
for (const [processId, processData] of Object.entries(processesData)) {
|
|
||||||
if (processData
|
|
||||||
&& typeof processData === 'object'
|
|
||||||
&& 'utype' in processData
|
|
||||||
&& 'idNot' in processData
|
|
||||||
&& 'office' in processData
|
|
||||||
&& 'contact' in processData
|
|
||||||
&& 'office_role' in processData
|
|
||||||
&& 'role' in processData
|
|
||||||
&& (processData as any).utype === 'collaborator'
|
|
||||||
&& (processData as any).office
|
|
||||||
&& (processData as any).office.idNot
|
|
||||||
&& (processData as any).idNot === idNot
|
|
||||||
) {
|
|
||||||
console.log('Found matching process:', processId);
|
|
||||||
return { processId, processData };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error getting user process by idnot:', error);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify an update for a process
|
* Notify an update for a process
|
||||||
|
Loading…
x
Reference in New Issue
Block a user