diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-16 11:08:25 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | efc32059d980c51793e8e9ac0fb6a885a8026f94 (patch) | |
tree | c272e63fd57a9625b53dc26ceb1b46aee35d21d3 /server/helpers/peertube-crypto.ts | |
parent | d846501818c2d29e66e6fd141789cb04fd55a437 (diff) | |
download | PeerTube-efc32059d980c51793e8e9ac0fb6a885a8026f94.tar.gz PeerTube-efc32059d980c51793e8e9ac0fb6a885a8026f94.tar.zst PeerTube-efc32059d980c51793e8e9ac0fb6a885a8026f94.zip |
Send server announce when users upload a video
Diffstat (limited to 'server/helpers/peertube-crypto.ts')
-rw-r--r-- | server/helpers/peertube-crypto.ts | 10 |
1 files changed, 5 insertions, 5 deletions
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 @@ | |||
1 | import * as jsonld from 'jsonld' | ||
1 | import * as jsig from 'jsonld-signatures' | 2 | import * as jsig from 'jsonld-signatures' |
3 | jsig.use('jsonld', jsonld) | ||
2 | 4 | ||
3 | import { | 5 | import { |
4 | PRIVATE_RSA_KEY_SIZE, | 6 | PRIVATE_RSA_KEY_SIZE, |
@@ -9,9 +11,7 @@ import { | |||
9 | bcryptGenSaltPromise, | 11 | bcryptGenSaltPromise, |
10 | bcryptHashPromise, | 12 | bcryptHashPromise, |
11 | createPrivateKey, | 13 | createPrivateKey, |
12 | getPublicKey, | 14 | getPublicKey |
13 | jsonldSignPromise, | ||
14 | jsonldVerifyPromise | ||
15 | } from './core-utils' | 15 | } from './core-utils' |
16 | import { logger } from './logger' | 16 | import { logger } from './logger' |
17 | import { AccountInstance } from '../models/account/account-interface' | 17 | import { AccountInstance } from '../models/account/account-interface' |
@@ -45,7 +45,7 @@ function isSignatureVerified (fromAccount: AccountInstance, signedDocument: obje | |||
45 | publicKeyOwner: publicKeyOwnerObject | 45 | publicKeyOwner: publicKeyOwnerObject |
46 | } | 46 | } |
47 | 47 | ||
48 | return jsonldVerifyPromise(signedDocument, options) | 48 | return jsig.promises.verify(signedDocument, options) |
49 | .catch(err => { | 49 | .catch(err => { |
50 | logger.error('Cannot check signature.', err) | 50 | logger.error('Cannot check signature.', err) |
51 | return false | 51 | return false |
@@ -58,7 +58,7 @@ function signObject (byAccount: AccountInstance, data: any) { | |||
58 | creator: byAccount.url | 58 | creator: byAccount.url |
59 | } | 59 | } |
60 | 60 | ||
61 | return jsonldSignPromise(data, options) | 61 | return jsig.promises.sign(data, options) |
62 | } | 62 | } |
63 | 63 | ||
64 | function comparePassword (plainPassword: string, hashPassword: string) { | 64 | function comparePassword (plainPassword: string, hashPassword: string) { |