nip98: skip timestamp validation

Signed-off-by: dzdidi <deniszalessky@gmail.com>
This commit is contained in:
dzdidi
2024-02-28 17:13:55 +00:00
parent cddf39bfad
commit 5f1e3bd212
3 changed files with 16 additions and 17 deletions

29
npm-shrinkwrap.json generated
View File

@@ -15,7 +15,7 @@
"corestore": "^6.15.13", "corestore": "^6.15.13",
"hyperdrive": "^11.6.3", "hyperdrive": "^11.6.3",
"hyperswarm": "^4.7.13", "hyperswarm": "^4.7.13",
"nostr-tools": "^2.1.5", "nostr-tools": "github:dzdidi/nostr-tools",
"protomux-rpc": "^1.5.1", "protomux-rpc": "^1.5.1",
"random-access-memory": "^6.2.0" "random-access-memory": "^6.2.0"
}, },
@@ -241,9 +241,9 @@
} }
}, },
"node_modules/@noble/ciphers": { "node_modules/@noble/ciphers": {
"version": "0.2.0", "version": "0.5.1",
"resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-0.2.0.tgz", "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-0.5.1.tgz",
"integrity": "sha512-6YBxJDAapHSdd3bLDv6x2wRPwq4QFMUaB3HvljNBUTThDd12eSm7/3F+2lnfzx2jvM+S6Nsy0jEt9QbPqSwqRw==", "integrity": "sha512-aNE06lbe36ifvMbbWvmmF/8jx6EQPu2HVg70V95T+iGjOuYwPpAccwAQc2HlXO2D0aiQ3zavbMga4jjWnrpiPA==",
"funding": { "funding": {
"url": "https://paulmillr.com/funding/" "url": "https://paulmillr.com/funding/"
} }
@@ -3098,11 +3098,11 @@
} }
}, },
"node_modules/nostr-tools": { "node_modules/nostr-tools": {
"version": "2.1.5", "version": "2.3.1",
"resolved": "https://registry.npmjs.org/nostr-tools/-/nostr-tools-2.1.5.tgz", "resolved": "git+ssh://git@github.com/dzdidi/nostr-tools.git#83e1286d5e88c55348835def60d5cac64f474228",
"integrity": "sha512-Gug/j54YGQ0ewB09dZW3mS9qfXWFlcOQMlyb1MmqQsuNO/95mfNOQSBi+jZ61O++Y+jG99SzAUPFLopUsKf0MA==", "license": "Unlicense",
"dependencies": { "dependencies": {
"@noble/ciphers": "0.2.0", "@noble/ciphers": "^0.5.1",
"@noble/curves": "1.2.0", "@noble/curves": "1.2.0",
"@noble/hashes": "1.3.1", "@noble/hashes": "1.3.1",
"@scure/base": "1.1.1", "@scure/base": "1.1.1",
@@ -4958,9 +4958,9 @@
} }
}, },
"@noble/ciphers": { "@noble/ciphers": {
"version": "0.2.0", "version": "0.5.1",
"resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-0.2.0.tgz", "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-0.5.1.tgz",
"integrity": "sha512-6YBxJDAapHSdd3bLDv6x2wRPwq4QFMUaB3HvljNBUTThDd12eSm7/3F+2lnfzx2jvM+S6Nsy0jEt9QbPqSwqRw==" "integrity": "sha512-aNE06lbe36ifvMbbWvmmF/8jx6EQPu2HVg70V95T+iGjOuYwPpAccwAQc2HlXO2D0aiQ3zavbMga4jjWnrpiPA=="
}, },
"@noble/curves": { "@noble/curves": {
"version": "1.2.0", "version": "1.2.0",
@@ -7161,11 +7161,10 @@
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA=="
}, },
"nostr-tools": { "nostr-tools": {
"version": "2.1.5", "version": "git+ssh://git@github.com/dzdidi/nostr-tools.git#83e1286d5e88c55348835def60d5cac64f474228",
"resolved": "https://registry.npmjs.org/nostr-tools/-/nostr-tools-2.1.5.tgz", "from": "nostr-tools@github:dzdidi/nostr-tools",
"integrity": "sha512-Gug/j54YGQ0ewB09dZW3mS9qfXWFlcOQMlyb1MmqQsuNO/95mfNOQSBi+jZ61O++Y+jG99SzAUPFLopUsKf0MA==",
"requires": { "requires": {
"@noble/ciphers": "0.2.0", "@noble/ciphers": "^0.5.1",
"@noble/curves": "1.2.0", "@noble/curves": "1.2.0",
"@noble/hashes": "1.3.1", "@noble/hashes": "1.3.1",
"@scure/base": "1.1.1", "@scure/base": "1.1.1",

View File

@@ -46,7 +46,7 @@
"corestore": "^6.15.13", "corestore": "^6.15.13",
"hyperdrive": "^11.6.3", "hyperdrive": "^11.6.3",
"hyperswarm": "^4.7.13", "hyperswarm": "^4.7.13",
"nostr-tools": "^2.1.5", "nostr-tools": "github:dzdidi/nostr-tools",
"protomux-rpc": "^1.5.1", "protomux-rpc": "^1.5.1",
"random-access-memory": "^6.2.0" "random-access-memory": "^6.2.0"
} }

View File

@@ -15,7 +15,7 @@ async function getToken ({ url, method, data }) {
// FIXME // FIXME
async function getId ({ payload, url, method, data }) { async function getId ({ payload, url, method, data }) {
const event = JSON.parse(Buffer.from(payload, 'base64').toString()) const event = JSON.parse(Buffer.from(payload, 'base64').toString())
const isValid = await nip98.validateEvent(event, url, method, data) const isValid = await nip98.validateEvent(event, url, method, data, { skipTimestampValidation: true })
if (!isValid) throw new Error('Invalid event') if (!isValid) throw new Error('Invalid event')
return { return {
...event, ...event,