forked from Mirrors/doipjs
Release 0.10.4
This commit is contained in:
parent
cee8fa9172
commit
3c6ccfa0da
7 changed files with 56 additions and 21 deletions
|
@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.10.4] - 2021-03-02
|
||||||
|
## Changed
|
||||||
|
- Add Twitter proxy verification
|
||||||
|
|
||||||
## [0.10.3] - 2021-03-02
|
## [0.10.3] - 2021-03-02
|
||||||
## Changed
|
## Changed
|
||||||
- Remove twitter dependency
|
- Remove twitter dependency
|
||||||
|
|
32
dist/doip.js
vendored
32
dist/doip.js
vendored
|
@ -1193,7 +1193,7 @@ process.umask = function() { return 0; };
|
||||||
},{}],9:[function(require,module,exports){
|
},{}],9:[function(require,module,exports){
|
||||||
module.exports={
|
module.exports={
|
||||||
"name": "doipjs",
|
"name": "doipjs",
|
||||||
"version": "0.10.3",
|
"version": "0.10.4",
|
||||||
"description": "Decentralized OpenPGP Identity Proofs library in Node.js",
|
"description": "Decentralized OpenPGP Identity Proofs library in Node.js",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -2994,10 +2994,14 @@ limitations under the License.
|
||||||
const bent = require('bent')
|
const bent = require('bent')
|
||||||
const req = bent('GET')
|
const req = bent('GET')
|
||||||
const serviceproviders = require('../serviceproviders')
|
const serviceproviders = require('../serviceproviders')
|
||||||
|
const utils = require('../utils')
|
||||||
const reURI = /^https:\/\/twitter\.com\/(.*)\/status\/([0-9]*)(?:\?.*)?/
|
const reURI = /^https:\/\/twitter\.com\/(.*)\/status\/([0-9]*)(?:\?.*)?/
|
||||||
|
|
||||||
const customRequestHandler = async (spData, opts) => {
|
const customRequestHandler = async (spData, opts) => {
|
||||||
const match = spData.proof.uri.match(reURI)
|
const match = spData.proof.uri.match(reURI)
|
||||||
|
|
||||||
|
// Attempt direct verification if policy allows it
|
||||||
|
if (opts.proxyPolicy !== 'always') {
|
||||||
if ('twitterBearerToken' in opts && opts.twitterBearerToken) {
|
if ('twitterBearerToken' in opts && opts.twitterBearerToken) {
|
||||||
const res = await req(`https://api.twitter.com/1.1/statuses/show.json?id=${match[2]}`, null, {
|
const res = await req(`https://api.twitter.com/1.1/statuses/show.json?id=${match[2]}`, null, {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
|
@ -3012,6 +3016,26 @@ const customRequestHandler = async (spData, opts) => {
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt proxy verification if policy allows it
|
||||||
|
if (opts.proxyPolicy !== 'never' && spData.proof.fetch) {
|
||||||
|
return req(utils.generateProxyURL('twitter', match[2], opts), null, {
|
||||||
|
Accept: 'application/json',
|
||||||
|
})
|
||||||
|
.then(async (res) => {
|
||||||
|
return await res.json()
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
return res.data.text
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
reject(e)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// No verification
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
const processURI = (uri, opts) => {
|
const processURI = (uri, opts) => {
|
||||||
|
@ -3032,8 +3056,8 @@ const processURI = (uri, opts) => {
|
||||||
},
|
},
|
||||||
proof: {
|
proof: {
|
||||||
uri: uri,
|
uri: uri,
|
||||||
fetch: null,
|
fetch: utils.generateProxyURL('twitter', match[2], opts),
|
||||||
useProxy: true,
|
useProxy: false,
|
||||||
format: 'text',
|
format: 'text',
|
||||||
},
|
},
|
||||||
claim: {
|
claim: {
|
||||||
|
@ -3065,7 +3089,7 @@ exports.reURI = reURI
|
||||||
exports.processURI = processURI
|
exports.processURI = processURI
|
||||||
exports.tests = tests
|
exports.tests = tests
|
||||||
|
|
||||||
},{"../serviceproviders":13,"bent":1}],28:[function(require,module,exports){
|
},{"../serviceproviders":13,"../utils":30,"bent":1}],28:[function(require,module,exports){
|
||||||
/*
|
/*
|
||||||
Copyright 2021 Yarmo Mackenbach
|
Copyright 2021 Yarmo Mackenbach
|
||||||
|
|
||||||
|
|
2
dist/doip.min.js
vendored
2
dist/doip.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
||||||
# doip.js <small>0.10.3</small>
|
# doip.js <small>0.10.4</small>
|
||||||
|
|
||||||
<img src="doip.png" width="120">
|
<img src="doip.png" width="120">
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.10.4]
|
||||||
|
|
||||||
|
[2021-03-02](https://codeberg.org/keyoxide/doipjs/releases/tag/0.10.4)
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
- Add Twitter proxy verification
|
||||||
|
|
||||||
## [0.10.3]
|
## [0.10.3]
|
||||||
|
|
||||||
[2021-03-02](https://codeberg.org/keyoxide/doipjs/releases/tag/0.10.3)
|
[2021-03-02](https://codeberg.org/keyoxide/doipjs/releases/tag/0.10.3)
|
||||||
|
|
|
@ -15,7 +15,7 @@ npm install --save doipjs
|
||||||
Install on website by including the following HTML snippet:
|
Install on website by including the following HTML snippet:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="https://cdn.jsdelivr.net/npm/doipjs@0.10.3/dist/doip.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/doipjs@0.10.4/dist/doip.min.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
Next step: [quick start (Node.js)](quickstart-nodejs.md) and [quick start (browser)](quickstart-browser.md)
|
Next step: [quick start (Node.js)](quickstart-nodejs.md) and [quick start (browser)](quickstart-browser.md)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "doipjs",
|
"name": "doipjs",
|
||||||
"version": "0.10.3",
|
"version": "0.10.4",
|
||||||
"description": "Decentralized OpenPGP Identity Proofs library in Node.js",
|
"description": "Decentralized OpenPGP Identity Proofs library in Node.js",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
Loading…
Reference in a new issue