diff --git a/docs/api.md b/docs/api.md index f85034c..12bf81e 100644 --- a/docs/api.md +++ b/docs/api.md @@ -56,7 +56,7 @@ Example: ### GET /\_publicKey -The [public key](https://en.wikipedia.org/wiki/Public-key_cryptography) unpkg uses to encrypt authentication tokens, in plain text. You can also find the key [on GitHub](https://github.com/unpkg/unpkg/blob/master/public.key). +The [public key](https://en.wikipedia.org/wiki/Public-key_cryptography) unpkg uses to encrypt authentication tokens, as JSON. You can also find the key as plain text [on GitHub](https://github.com/unpkg/unpkg/blob/master/public.key). This can be useful to verify a token was issued by unpkg. @@ -64,6 +64,15 @@ Required scope: none Query parameters: none +Example: + +```log +> curl "https://unpkg.com/_publicKey" +{ + "publicKey": "..." +} +``` + # Blacklist To protect unpkg users and prevent abuse, unpkg manages a blacklist of npm packages that are known to contain harmful code. diff --git a/server/actions/showPublicKey.js b/server/actions/showPublicKey.js index 8fb46d1..445eb71 100644 --- a/server/actions/showPublicKey.js +++ b/server/actions/showPublicKey.js @@ -1,7 +1,7 @@ const AuthAPI = require('../AuthAPI') function showPublicKey(req, res) { - res.type('text').send(AuthAPI.getPublicKey()) + res.send({ publicKey: AuthAPI.getPublicKey() }) } module.exports = showPublicKey