X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=server%2Fhelpers%2Fpeertube-crypto.ts;h=04a8d5681d6be87cc97746a35efff993b5f59413;hb=efc32059d980c51793e8e9ac0fb6a885a8026f94;hp=6d50e446f59a124488f2eb392e3212142d426e69;hpb=e4f97babf701481b55cc10fb3448feab5f97c867;p=oweals%2Fpeertube.git diff --git a/server/helpers/peertube-crypto.ts b/server/helpers/peertube-crypto.ts index 6d50e446f..04a8d5681 100644 --- a/server/helpers/peertube-crypto.ts +++ b/server/helpers/peertube-crypto.ts @@ -1,4 +1,6 @@ +import * as jsonld from 'jsonld' import * as jsig from 'jsonld-signatures' +jsig.use('jsonld', jsonld) import { PRIVATE_RSA_KEY_SIZE, @@ -9,9 +11,7 @@ import { bcryptGenSaltPromise, bcryptHashPromise, createPrivateKey, - getPublicKey, - jsonldSignPromise, - jsonldVerifyPromise + getPublicKey } from './core-utils' import { logger } from './logger' import { AccountInstance } from '../models/account/account-interface' @@ -45,7 +45,7 @@ function isSignatureVerified (fromAccount: AccountInstance, signedDocument: obje publicKeyOwner: publicKeyOwnerObject } - return jsonldVerifyPromise(signedDocument, options) + return jsig.promises.verify(signedDocument, options) .catch(err => { logger.error('Cannot check signature.', err) return false @@ -58,7 +58,7 @@ function signObject (byAccount: AccountInstance, data: any) { creator: byAccount.url } - return jsonldSignPromise(data, options) + return jsig.promises.sign(data, options) } function comparePassword (plainPassword: string, hashPassword: string) {