diff --git a/README.md b/README.md index 00019ae..9eb937e 100644 --- a/README.md +++ b/README.md @@ -74,12 +74,6 @@ GET /api/v1/key?fingerprint=e3317db04d3958fd5f662c37b8e4105cc9dedc77 GET /api/v1/key?email=user@example.com ``` -#### By email address (shorthand link for sharing) - -``` -GET /user/user@example.com -``` - #### Payload (JSON): ```json diff --git a/src/app.js b/src/app.js index 9636fff..ba304f8 100644 --- a/src/app.js +++ b/src/app.js @@ -65,9 +65,6 @@ router.get('/api/v1/removeKey', function *() { router.get('/api/v1/verifyRemove', function *() { yield rest.verifyRemove(this); }); -router.get('/user/:search', function *() { - yield rest.share(this); -}); // Redirect all http traffic to https app.use(function *(next) { diff --git a/src/route/rest.js b/src/route/rest.js index 8cab93a..c6171f9 100644 --- a/src/route/rest.js +++ b/src/route/rest.js @@ -61,7 +61,7 @@ class REST { } yield this._publicKey.verify(q); // create link for sharing - let link = util.url(util.origin(ctx), '/user/' + q.keyId.toUpperCase()); + let link = util.url(util.origin(ctx), '/pks/lookup?op=get&search=0x' + q.keyId.toUpperCase()); ctx.body = `

Email address successfully verified!

Link to share your key: ${link}

`; ctx.set('Content-Type', 'text/html; charset=utf-8'); } @@ -78,25 +78,6 @@ class REST { ctx.body = yield this._publicKey.get(q); } - /** - * Public key fetch via http GET (shorthand link for sharing) - * @param {Object} ctx The koa request/response context - */ - *share(ctx) { - let q, search = ctx.params.search; - if (util.isEmail(search)) { - q = { email:search }; - } else if (util.isKeyId(search)) { - q = { keyId:search }; - } else if (util.isFingerPrint(search)) { - q = { fingerprint:search }; - } - if (!q) { - ctx.throw(400, 'Invalid request!'); - } - ctx.body = (yield this._publicKey.get(q)).publicKeyArmored; - } - /** * Request public key removal via http DELETE * @param {Object} ctx The koa request/response context diff --git a/test/integration/app-test.js b/test/integration/app-test.js index 9e4f176..743387a 100644 --- a/test/integration/app-test.js +++ b/test/integration/app-test.js @@ -190,76 +190,6 @@ describe('Koa App (HTTP Server) Integration Tests', function() { }); }); - describe('GET /user/:search (sharing link)', () => { - beforeEach(done => { - request(app.listen()) - .post('/api/v1/key') - .send({ publicKeyArmored, primaryEmail }) - .expect(201) - .end(done); - }); - - describe('Not yet verified', () => { - it('should return 404', done => { - request(app.listen()) - .get('/user/' + primaryEmail) - .expect(404) - .end(done); - }); - }); - - describe('Verified', () => { - beforeEach(done => { - request(app.listen()) - .get('/api/v1/verify?keyId=' + emailParams.keyId + '&nonce=' + emailParams.nonce) - .expect(200) - .end(done); - }); - - it('should return 200 for email address', done => { - request(app.listen()) - .get('/user/' + primaryEmail) - .expect(200, publicKeyArmored) - .end(done); - }); - - it('should return 200 for key id', done => { - request(app.listen()) - .get('/user/' + emailParams.keyId) - .expect(200, publicKeyArmored) - .end(done); - }); - - it('should return 200 for fingerprint', done => { - request(app.listen()) - .get('/user/' + fingerprint) - .expect(200, publicKeyArmored) - .end(done); - }); - - it('should return 400 for invalid email', done => { - request(app.listen()) - .get('/user/a@bco') - .expect(400) - .end(done); - }); - - it('should return 404 for unkown email', done => { - request(app.listen()) - .get('/user/a@b.co') - .expect(404) - .end(done); - }); - - it('should return 404 for missing email', done => { - request(app.listen()) - .get('/user/') - .expect(404) - .end(done); - }); - }); - }); - describe('DELETE /api/v1/key', () => { beforeEach(done => { request(app.listen())