https://github.com/c-geek/connect-pgp
Connect.js middleware to sign HTTTP responses.
https://github.com/c-geek/connect-pgp
Last synced: 26 days ago
JSON representation
Connect.js middleware to sign HTTTP responses.
- Host: GitHub
- URL: https://github.com/c-geek/connect-pgp
- Owner: c-geek
- License: mit
- Created: 2013-07-29T14:27:07.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2014-05-09T11:25:15.000Z (over 11 years ago)
- Last Synced: 2025-06-01T12:03:07.749Z (5 months ago)
- Language: JavaScript
- Size: 375 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Connect-pgp
A middleware for Connect.js signing HTTP responses.
## Usage
```js
var connect = require('connect');
var pgpsign = require('connect-pgp');
// This is your super signing own function!
function doSign(msg, callback) {
// Do signing stuff...
callback(err, pgpSignedMessage);
}
// New connect app
var app = connect();
// Now signing HTTP requests!
app.use(pgpsign(doSign));
```
## Triggering
Middleware triggers on HTTP header:
"Accept: multipart/signed"
then answers:
HTTP/1.1 200 OK
Content-Type: multipart/signed; boundary=bar; micalg=pgp-sha1; protocol="application/pgp-signature"
--bar
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
& This is the body content.
&
& Every word and every space in the body content body will be
& signed, even the two fields "Content-Type" and "Content-Transfer-Encoding"
& above, with the new line before this body content.
--bar
Content-Type: application/pgp-signature
-----BEGIN PGP MESSAGE-----
Version: 2.6.2
iQCVAwUBMJrRF2N9oWBghPDJAQE9UQQAtl7LuRVndBjrk4EqYBIb3h5QXIX/LC//
jJV5bNvkZIGPIcEmI5iFd9boEgvpirHtIREEqLQRkYNoBActFBZmh9GC3C041WGq
uMbrbxc+nIs1TIKlA08rVi9ig/2Yh7LFrK5Ein57U/W72vgSxLhe/zhdfolT9Brn
HOxEa44b+EI=
=ndaj
-----END PGP MESSAGE-----
--bar--
N.B.: the part of the response with '&' is what is signed.
# License
This software is provided under [MIT license](https://raw.github.com/c-geek/connect-pgp/master/LICENSE).