Return JSON from /_publicKey
This commit is contained in:
parent
ba6fb43aa4
commit
a38eebfe7e
11
docs/api.md
11
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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue