Changed anchor proof file

This commit is contained in:
Vins 2024-06-12 14:52:51 +02:00
parent 547ab0b230
commit 98a1694261
3 changed files with 113 additions and 54 deletions

View File

@ -87,7 +87,7 @@ export default class OfficeFoldersController extends ApiController {
}
const sortedHashes = [...folderHashes].sort();
const anchoringProof = await this.secureService.download(sortedHashes);
const anchoringProof = await this.secureService.download(sortedHashes, officeFolder.name);
const addFileToZip = (zip: Zip) => (uid: string): Promise<void> =>
(async () => {

File diff suppressed because one or more lines are too long

View File

@ -63,7 +63,7 @@ export default class SecureService extends BaseService {
* @description : Download the anchoring proof document
* @throws {Error} If transaction is not verified on chain
*/
public async download(hash_sources: string[]) {
public async download(hash_sources: string[], office_name: string) {
const anchor = await this.verify(hash_sources);
if (anchor.transactions.length === 0) {
@ -71,6 +71,8 @@ export default class SecureService extends BaseService {
}
const transaction = anchor.transactions[0];
console.log(transaction);
if (transaction.status !== EAnchoringStatus.VERIFIED_ON_CHAIN) {
throw new Error(`Transaction not verified on chain: ${transaction.status}`);
@ -83,6 +85,7 @@ export default class SecureService extends BaseService {
timeZone: "Europe/Paris",
timeZoneName: "short",
}),
office_name: office_name,
});
}
}