From 00d28826b9bb2bb65c90fc4c03ddd571faa7c7f6 Mon Sep 17 00:00:00 2001 From: Nya Candy Date: Tue, 31 Jan 2023 18:37:39 +0800 Subject: [PATCH] fix(try): ld signature normalizer (#9758) --- packages/backend/src/core/activitypub/LdSignatureService.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/core/activitypub/LdSignatureService.ts b/packages/backend/src/core/activitypub/LdSignatureService.ts index 5a1e01574..a29e1be56 100644 --- a/packages/backend/src/core/activitypub/LdSignatureService.ts +++ b/packages/backend/src/core/activitypub/LdSignatureService.ts @@ -1,5 +1,6 @@ import * as crypto from 'node:crypto'; import { Inject, Injectable } from '@nestjs/common'; +import jsonld from 'jsonld'; import { HttpRequestService } from '@/core/HttpRequestService.js'; import { bindThis } from '@/decorators.js'; import { CONTEXTS } from './misc/contexts.js'; @@ -84,7 +85,9 @@ class LdSignature { @bindThis public async normalize(data: any) { const customLoader = this.getLoader(); - return 42; + return await jsonld.normalize(data, { + documentLoader: customLoader, + }); } @bindThis