Upgrade nostr-tools, add groups/circles to Tags

This commit is contained in:
Jon Staab
2024-01-09 11:01:10 -08:00
parent 0af0375f62
commit 7cb792ba17
3 changed files with 34 additions and 9 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "paravel", "name": "paravel",
"version": "0.4.17", "version": "0.4.18",
"description": "Yet another toolkit for nostr", "description": "Yet another toolkit for nostr",
"author": "hodlbod", "author": "hodlbod",
"license": "MIT", "license": "MIT",
@@ -36,7 +36,7 @@
"dependencies": { "dependencies": {
"isomorphic-ws": "^5.0.0", "isomorphic-ws": "^5.0.0",
"normalize-url": "^8.0.0", "normalize-url": "^8.0.0",
"nostr-tools": "^1.15.0", "nostr-tools": "^2.1.2",
"ws": "^8.14.2" "ws": "^8.14.2"
}, },
"devDependencies": { "devDependencies": {
+26 -5
View File
@@ -12,8 +12,8 @@ dependencies:
specifier: ^8.0.0 specifier: ^8.0.0
version: 8.0.0 version: 8.0.0
nostr-tools: nostr-tools:
specifier: ^1.15.0 specifier: ^2.1.2
version: 1.17.0(typescript@5.1.6) version: 2.1.2(typescript@5.1.6)
ws: ws:
specifier: ^8.14.2 specifier: ^8.14.2
version: 8.15.1 version: 8.15.1
@@ -131,11 +131,22 @@ packages:
'@noble/hashes': 1.3.1 '@noble/hashes': 1.3.1
dev: false dev: false
/@noble/curves@1.2.0:
resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==}
dependencies:
'@noble/hashes': 1.3.2
dev: false
/@noble/hashes@1.3.1: /@noble/hashes@1.3.1:
resolution: {integrity: sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==} resolution: {integrity: sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==}
engines: {node: '>= 16'} engines: {node: '>= 16'}
dev: false dev: false
/@noble/hashes@1.3.2:
resolution: {integrity: sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==}
engines: {node: '>= 16'}
dev: false
/@nodelib/fs.scandir@2.1.5: /@nodelib/fs.scandir@2.1.5:
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
@@ -1391,6 +1402,10 @@ packages:
kind-of: 6.0.3 kind-of: 6.0.3
dev: true dev: true
/mitata@0.1.6:
resolution: {integrity: sha512-VKQ0r3jriTOU9E2Z+mwbZrUmbg4Li4QyFfi7kfHKl6reZhGzL0AYlu3wE0VPXzIwA5xnFzmEQoBwCcNT8stUkA==}
dev: false
/ms@2.1.2: /ms@2.1.2:
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
dev: true dev: true
@@ -1436,8 +1451,8 @@ packages:
engines: {node: '>=14.16'} engines: {node: '>=14.16'}
dev: false dev: false
/nostr-tools@1.17.0(typescript@5.1.6): /nostr-tools@2.1.2(typescript@5.1.6):
resolution: {integrity: sha512-LZmR8GEWKZeElbFV5Xte75dOeE9EFUW/QLI1Ncn3JKn0kFddDKEfBbFN8Mu4TMs+L4HR/WTPha2l+PPuRnJcMw==} resolution: {integrity: sha512-7a30ipG5N3pMeRT5tjNodFbYy8JO37Ndh54yshkGjSRa08umLDmEcmVzdIoSI7yxdac24WbFz4OBoJhR7kHFkw==}
peerDependencies: peerDependencies:
typescript: '>=5.0.0' typescript: '>=5.0.0'
peerDependenciesMeta: peerDependenciesMeta:
@@ -1445,14 +1460,20 @@ packages:
optional: true optional: true
dependencies: dependencies:
'@noble/ciphers': 0.2.0 '@noble/ciphers': 0.2.0
'@noble/curves': 1.1.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
'@scure/bip32': 1.3.1 '@scure/bip32': 1.3.1
'@scure/bip39': 1.2.1 '@scure/bip39': 1.2.1
mitata: 0.1.6
nostr-wasm: 0.1.0
typescript: 5.1.6 typescript: 5.1.6
dev: false dev: false
/nostr-wasm@0.1.0:
resolution: {integrity: sha512-78BTryCLcLYv96ONU8Ws3Q1JzjlAt+43pWQhIl86xZmWeegYCNLPml7yQ+gG3vR6V5h4XGj+TxO+SS5dsThQIA==}
dev: false
/npm-run-path@4.0.1: /npm-run-path@4.0.1:
resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==}
engines: {node: '>=8'} engines: {node: '>=8'}
+6 -2
View File
@@ -1,6 +1,6 @@
import type {Event} from 'nostr-tools' import type {Event} from 'nostr-tools'
import normalizeUrl from "normalize-url" import normalizeUrl from "normalize-url"
import {verifySignature, getEventHash, matchFilter as nostrToolsMatchFilter} from 'nostr-tools' import {verifyEvent, getEventHash, matchFilter as nostrToolsMatchFilter} from 'nostr-tools'
import {cached} from "./LRUCache" import {cached} from "./LRUCache"
// =========================================================================== // ===========================================================================
@@ -82,7 +82,7 @@ export const hasValidSignature = cached<string, boolean, [Event]>({
return 'invalid' return 'invalid'
} }
}, },
getValue: ([e]: [Event]) => verifySignature(e), getValue: ([e]: [Event]) => verifyEvent(e),
}) })
// ========================================================================== // ==========================================================================
@@ -215,8 +215,12 @@ export class Tags extends Fluent<string[]> {
replies = (type = null) => this.getAncestors(type).replies replies = (type = null) => this.getAncestors(type).replies
groups = () => this.type("a").values().filter(a => a.startsWith('35834:'))
communities = () => this.type("a").values().filter(a => a.startsWith('34550:')) communities = () => this.type("a").values().filter(a => a.startsWith('34550:'))
circles = () => this.type("a").values().filter(a => a.match(/^(34550|35834):/))
getReply = (type = null) => this.replies(type).values().first() getReply = (type = null) => this.replies(type).values().first()
getRoot = (type = null) => this.roots(type).values().first() getRoot = (type = null) => this.roots(type).values().first()