+ it('Should refresh the actor keys', async function () {
+ this.timeout(20000)
+
+ // Wait refresh invalidation
+ await wait(10000)
+
+ // Update keys of server 3 to invalid keys
+ // Server 1 should refresh the actor and fail
+ await setKeysOfServer(servers[2], servers[2], invalidKeys.publicKey, invalidKeys.privateKey)
+
+ const body = getAnnounceWithoutContext(servers[1])
+ body.actor = 'http://localhost:' + servers[2].port + '/accounts/peertube'
+
+ const signer: any = { privateKey: keys.privateKey, url: 'http://localhost:' + servers[2].port + '/accounts/peertube' }
+ const signedBody = await buildSignedActivity(signer, body)
+
+ const headers = buildGlobalHeaders(signedBody)
+
+ try {
+ await makePOSTAPRequest(url, signedBody, baseHttpSignature(), headers)
+ expect(true, 'Did not throw').to.be.false
+ } catch (err) {
+ expect(err.statusCode).to.equal(HttpStatusCode.FORBIDDEN_403)
+ }