diff options
Diffstat (limited to 'server/helpers/peertube-crypto.ts')
-rw-r--r-- | server/helpers/peertube-crypto.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/helpers/peertube-crypto.ts b/server/helpers/peertube-crypto.ts index 9148df2eb..1424949d0 100644 --- a/server/helpers/peertube-crypto.ts +++ b/server/helpers/peertube-crypto.ts | |||
@@ -1,12 +1,17 @@ | |||
1 | import { Request } from 'express' | 1 | import { Request } from 'express' |
2 | import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants' | 2 | import { BCRYPT_SALT_SIZE, HTTP_SIGNATURE, PRIVATE_RSA_KEY_SIZE } from '../initializers/constants' |
3 | import { ActorModel } from '../models/activitypub/actor' | 3 | import { ActorModel } from '../models/activitypub/actor' |
4 | import { bcryptComparePromise, bcryptGenSaltPromise, bcryptHashPromise, createPrivateKey, getPublicKey, sha256 } from './core-utils' | 4 | import { createPrivateKey, getPublicKey, promisify1, promisify2, sha256 } from './core-utils' |
5 | import { jsig, jsonld } from './custom-jsonld-signature' | 5 | import { jsig, jsonld } from './custom-jsonld-signature' |
6 | import { logger } from './logger' | 6 | import { logger } from './logger' |
7 | import { cloneDeep } from 'lodash' | 7 | import { cloneDeep } from 'lodash' |
8 | import { createVerify } from 'crypto' | 8 | import { createVerify } from 'crypto' |
9 | import { buildDigest } from '../lib/job-queue/handlers/utils/activitypub-http-utils' | 9 | import { buildDigest } from '../lib/job-queue/handlers/utils/activitypub-http-utils' |
10 | import * as bcrypt from 'bcrypt' | ||
11 | |||
12 | const bcryptComparePromise = promisify2<any, string, boolean>(bcrypt.compare) | ||
13 | const bcryptGenSaltPromise = promisify1<number, string>(bcrypt.genSalt) | ||
14 | const bcryptHashPromise = promisify2<any, string | number, string>(bcrypt.hash) | ||
10 | 15 | ||
11 | const httpSignature = require('http-signature') | 16 | const httpSignature = require('http-signature') |
12 | 17 | ||
@@ -147,3 +152,5 @@ export { | |||
147 | cryptPassword, | 152 | cryptPassword, |
148 | signJsonLDObject | 153 | signJsonLDObject |
149 | } | 154 | } |
155 | |||
156 | // --------------------------------------------------------------------------- | ||