For more information on the process of verifying HTTP requests it is suggested that you look at the documentation for XEP-0070: Verifying HTTP requests via XMPP.
Requests are received as follows:
socket.on(
'xmpp.http.verify',
function(data) { console.log(data) }
)
Requests can come in the form of <iq/> or <message/> there are some minor differences to how the data is received and how a response is sent. These will be noted as required.
An example payload is as follows:
{
from: { domain: 'media.evilprofessor.co.uk' } /* ...JID object... */
id: 'abc-123',
type: 'message',
description: 'Did you request this file?',
request: {
method: 'GET',
url: 'https://media.evilprofessor.co.uk/secret.txt',
id: 'request-1'
}
}
Notes:
socket.send(
'xmpp.http.confirm',
{
"to": "media.evilprofessor.co.uk",
"id": "abc-123",
"type": "iq",
"request": {
"url": "https://media.evilprofessor.co.uk/secret.txt",
"method": "GET",
"id": "request-1"
}
},
function(error, data) { console.log(error, data) }
)
Notes:
socket.send(
'xmpp.http.deny',
{
"to": "media.evilprofessor.co.uk",
"id": "abc-123",
"type": "iq",
"request": {
"url": "https://media.evilprofessor.co.uk/secret.txt",
"method": "GET",
"id": "request-1"
}
},
function(error, data) { console.log(error, data) }
)
Notes: