Various bug fixes in Services

This commit is contained in:
NicolasCantu 2025-06-05 15:42:12 +02:00
parent c5b58d999f
commit 99400a71f7

View File

@ -557,7 +557,7 @@ export default class Services {
notes: [], notes: [],
...folderData, ...folderData,
}; };
const ownerRoleFields = [Object.keys(privateData), 'roles']; const ownerRoleFields = [...Object.keys(privateData), 'roles'];
const stakeholdersRoleFields = ['documents', 'notes']; const stakeholdersRoleFields = ['documents', 'notes'];
const roles: Record<string, RoleDefinition> = { const roles: Record<string, RoleDefinition> = {
@ -599,7 +599,7 @@ export default class Services {
await this.getTokensFromFaucet(); await this.getTokensFromFaucet();
try { try {
return this.getProcess( return this.createProcess(
privateData, privateData,
{}, {},
roles roles
@ -1695,6 +1695,12 @@ export default class Services {
} }
public hexToBlob(hexString: string): Blob { public hexToBlob(hexString: string): Blob {
const uint8Array = this.hexToUInt8Array(hexString);
return new Blob([uint8Array], { type: "application/octet-stream" });
}
public hexToUInt8Array(hexString: string): Uint8Array {
if (hexString.length % 2 !== 0) { if (hexString.length % 2 !== 0) {
throw new Error("Invalid hex string: length must be even"); throw new Error("Invalid hex string: length must be even");
} }
@ -1703,7 +1709,7 @@ export default class Services {
uint8Array[i / 2] = parseInt(hexString.substr(i, 2), 16); uint8Array[i / 2] = parseInt(hexString.substr(i, 2), 16);
} }
return new Blob([uint8Array], { type: "application/octet-stream" }); return uint8Array;
} }
public async blobToHex(blob: Blob): Promise<string> { public async blobToHex(blob: Blob): Promise<string> {