mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c6f39e4ae | ||
|
|
08885ab8da | ||
|
|
9f896479d0 | ||
|
|
82caa2aad9 | ||
|
|
67a8ee23ce | ||
|
|
18e8227123 | ||
|
|
64caef9cda | ||
|
|
6a07d2d9d3 | ||
|
|
341ccc5ac5 | ||
|
|
d2a9af2586 | ||
|
|
5d92be05bb | ||
|
|
03cc18d53b | ||
|
|
ac7598b5e3 | ||
|
|
424449c773 | ||
|
|
ab6abe6815 | ||
|
|
30fd6b6215 | ||
|
|
8a53b3b8b3 | ||
|
|
d0bd599ce8 | ||
|
|
1cbb62e6b9 | ||
|
|
977316915b | ||
|
|
dd8f555094 | ||
|
|
87f5ea4291 | ||
|
|
595ae21baf | ||
|
|
9fa554ca8e | ||
|
|
1647601727 | ||
|
|
b66ca1787a | ||
|
|
278cdda9c2 | ||
|
|
552530fa3f | ||
|
|
13e9b4aa3e | ||
|
|
9a3e05ce5f |
@@ -2,7 +2,7 @@
|
||||
"root": true,
|
||||
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"plugins": ["@typescript-eslint", "babel"],
|
||||
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 9,
|
||||
@@ -18,8 +18,6 @@
|
||||
"node": true
|
||||
},
|
||||
|
||||
"plugins": ["babel"],
|
||||
|
||||
"globals": {
|
||||
"document": false,
|
||||
"navigator": false,
|
||||
@@ -103,7 +101,6 @@
|
||||
"no-octal-escape": 2,
|
||||
"no-path-concat": 0,
|
||||
"no-proto": 2,
|
||||
"no-redeclare": 2,
|
||||
"no-regex-spaces": 2,
|
||||
"no-return-assign": 0,
|
||||
"no-self-assign": 2,
|
||||
@@ -153,5 +150,13 @@
|
||||
"wrap-iife": [2, "any"],
|
||||
"yield-star-spacing": [2, "both"],
|
||||
"yoda": [0]
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["**/*.test.ts"],
|
||||
"env": { "jest/globals": true },
|
||||
"plugins": ["jest"],
|
||||
"extends": ["plugin:jest/recommended"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@@ -15,5 +15,4 @@ jobs:
|
||||
node-version: 18
|
||||
- uses: extractions/setup-just@v1
|
||||
- run: just install-dependencies
|
||||
- run: just build
|
||||
- run: just test
|
||||
|
||||
10
README.md
10
README.md
@@ -27,7 +27,7 @@ let pk = getPublicKey(sk) // `pk` is a hex string
|
||||
import {
|
||||
validateEvent,
|
||||
verifySignature,
|
||||
signEvent,
|
||||
getSignature,
|
||||
getEventHash,
|
||||
getPublicKey
|
||||
} from 'nostr-tools'
|
||||
@@ -41,7 +41,7 @@ let event = {
|
||||
}
|
||||
|
||||
event.id = getEventHash(event)
|
||||
event.sig = signEvent(event, privateKey)
|
||||
event.sig = getSignature(event, privateKey)
|
||||
|
||||
let ok = validateEvent(event)
|
||||
let veryOk = verifySignature(event)
|
||||
@@ -55,7 +55,7 @@ import {
|
||||
generatePrivateKey,
|
||||
getPublicKey,
|
||||
getEventHash,
|
||||
signEvent
|
||||
getSignature
|
||||
} from 'nostr-tools'
|
||||
|
||||
const relay = relayInit('wss://relay.example.com')
|
||||
@@ -104,7 +104,7 @@ let event = {
|
||||
content: 'hello world'
|
||||
}
|
||||
event.id = getEventHash(event)
|
||||
event.sig = signEvent(event, sk)
|
||||
event.sig = getSignature(event, sk)
|
||||
|
||||
let pub = relay.publish(event)
|
||||
pub.on('ok', () => {
|
||||
@@ -266,7 +266,7 @@ sendEvent(event)
|
||||
|
||||
// on the receiver side
|
||||
sub.on('event', event => {
|
||||
let sender = event.tags.find(([k, v]) => k === 'p' && v && v !== '')[1]
|
||||
let sender = event.pubkey
|
||||
pk1 === sender
|
||||
let plaintext = await nip04.decrypt(sk2, pk1, event.content)
|
||||
})
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
const {
|
||||
import {
|
||||
getBlankEvent,
|
||||
finishEvent,
|
||||
serializeEvent,
|
||||
getEventHash,
|
||||
validateEvent,
|
||||
verifySignature,
|
||||
signEvent,
|
||||
getPublicKey,
|
||||
Kind
|
||||
} = require('./lib/nostr.cjs')
|
||||
getSignature,
|
||||
Kind,
|
||||
} from './event.ts'
|
||||
import {getPublicKey} from './keys.ts'
|
||||
|
||||
describe('Event', () => {
|
||||
describe('getBlankEvent', () => {
|
||||
@@ -20,6 +20,15 @@ describe('Event', () => {
|
||||
created_at: 0
|
||||
})
|
||||
})
|
||||
|
||||
it('should return a blank event object with defined kind', () => {
|
||||
expect(getBlankEvent(Kind.Text)).toEqual({
|
||||
kind: 1,
|
||||
content: '',
|
||||
tags: [],
|
||||
created_at: 0
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('finishEvent', () => {
|
||||
@@ -88,6 +97,7 @@ describe('Event', () => {
|
||||
}
|
||||
|
||||
expect(() => {
|
||||
// @ts-expect-error
|
||||
serializeEvent(invalidEvent)
|
||||
}).toThrow("can't serialize event with wrong or missing properties")
|
||||
})
|
||||
@@ -281,8 +291,8 @@ describe('Event', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('signEvent', () => {
|
||||
it('should sign an event object', () => {
|
||||
describe('getSignature', () => {
|
||||
it('should produce the correct signature for an event object', () => {
|
||||
const privateKey =
|
||||
'd217c1ff2f8a65c3e3a1740db3b9f58b8c848bb45e26d00ed4714e4a0f4ceecf'
|
||||
const publicKey = getPublicKey(privateKey)
|
||||
@@ -295,9 +305,10 @@ describe('Event', () => {
|
||||
pubkey: publicKey
|
||||
}
|
||||
|
||||
const sig = signEvent(unsignedEvent, privateKey)
|
||||
const sig = getSignature(unsignedEvent, privateKey)
|
||||
|
||||
// verify the signature
|
||||
// @ts-expect-error
|
||||
const isValid = verifySignature({
|
||||
...unsignedEvent,
|
||||
sig
|
||||
@@ -324,9 +335,10 @@ describe('Event', () => {
|
||||
pubkey: publicKey
|
||||
}
|
||||
|
||||
const sig = signEvent(unsignedEvent, wrongPrivateKey)
|
||||
const sig = getSignature(unsignedEvent, wrongPrivateKey)
|
||||
|
||||
// verify the signature
|
||||
// @ts-expect-error
|
||||
const isValid = verifySignature({
|
||||
...unsignedEvent,
|
||||
sig
|
||||
71
event.ts
71
event.ts
@@ -1,8 +1,9 @@
|
||||
import * as secp256k1 from '@noble/secp256k1'
|
||||
import {schnorr} from '@noble/curves/secp256k1'
|
||||
import {sha256} from '@noble/hashes/sha256'
|
||||
import {bytesToHex} from '@noble/hashes/utils'
|
||||
|
||||
import {utf8Encoder} from './utils'
|
||||
import {getPublicKey} from './keys'
|
||||
import {getPublicKey} from './keys.ts'
|
||||
import {utf8Encoder} from './utils.ts'
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
export enum Kind {
|
||||
@@ -12,6 +13,7 @@ export enum Kind {
|
||||
Contacts = 3,
|
||||
EncryptedDirectMessage = 4,
|
||||
EventDeletion = 5,
|
||||
Repost = 6,
|
||||
Reaction = 7,
|
||||
BadgeAward = 8,
|
||||
ChannelCreation = 40,
|
||||
@@ -19,6 +21,7 @@ export enum Kind {
|
||||
ChannelMessage = 42,
|
||||
ChannelHideMessage = 43,
|
||||
ChannelMuteUser = 44,
|
||||
Blank = 255,
|
||||
Report = 1984,
|
||||
ZapRequest = 9734,
|
||||
Zap = 9735,
|
||||
@@ -29,40 +32,45 @@ export enum Kind {
|
||||
Article = 30023
|
||||
}
|
||||
|
||||
export type EventTemplate = {
|
||||
kind: Kind
|
||||
export type EventTemplate<K extends number = Kind> = {
|
||||
kind: K
|
||||
tags: string[][]
|
||||
content: string
|
||||
created_at: number
|
||||
}
|
||||
|
||||
export type UnsignedEvent = EventTemplate & {
|
||||
export type UnsignedEvent<K extends number = Kind> = EventTemplate<K> & {
|
||||
pubkey: string
|
||||
}
|
||||
|
||||
export type Event = UnsignedEvent & {
|
||||
export type Event<K extends number = Kind> = UnsignedEvent<K> & {
|
||||
id: string
|
||||
sig: string
|
||||
}
|
||||
|
||||
export function getBlankEvent(): EventTemplate {
|
||||
export function getBlankEvent(): EventTemplate<Kind.Blank>
|
||||
export function getBlankEvent<K extends number>(kind: K): EventTemplate<K>
|
||||
export function getBlankEvent<K>(kind: K | Kind.Blank = Kind.Blank) {
|
||||
return {
|
||||
kind: 255,
|
||||
kind,
|
||||
content: '',
|
||||
tags: [],
|
||||
created_at: 0
|
||||
}
|
||||
}
|
||||
|
||||
export function finishEvent(t: EventTemplate, privateKey: string): Event {
|
||||
let event = t as Event
|
||||
export function finishEvent<K extends number = Kind>(
|
||||
t: EventTemplate<K>,
|
||||
privateKey: string
|
||||
): Event<K> {
|
||||
let event = t as Event<K>
|
||||
event.pubkey = getPublicKey(privateKey)
|
||||
event.id = getEventHash(event)
|
||||
event.sig = signEvent(event, privateKey)
|
||||
event.sig = getSignature(event, privateKey)
|
||||
return event
|
||||
}
|
||||
|
||||
export function serializeEvent(evt: UnsignedEvent): string {
|
||||
export function serializeEvent(evt: UnsignedEvent<number>): string {
|
||||
if (!validateEvent(evt))
|
||||
throw new Error("can't serialize event with wrong or missing properties")
|
||||
|
||||
@@ -76,14 +84,15 @@ export function serializeEvent(evt: UnsignedEvent): string {
|
||||
])
|
||||
}
|
||||
|
||||
export function getEventHash(event: UnsignedEvent): string {
|
||||
export function getEventHash(event: UnsignedEvent<number>): string {
|
||||
let eventHash = sha256(utf8Encoder.encode(serializeEvent(event)))
|
||||
return secp256k1.utils.bytesToHex(eventHash)
|
||||
return bytesToHex(eventHash)
|
||||
}
|
||||
|
||||
const isRecord = (obj: unknown): obj is Record<string, unknown> => obj instanceof Object
|
||||
const isRecord = (obj: unknown): obj is Record<string, unknown> =>
|
||||
obj instanceof Object
|
||||
|
||||
export function validateEvent<T>(event: T): event is T & UnsignedEvent {
|
||||
export function validateEvent<T>(event: T): event is T & UnsignedEvent<number> {
|
||||
if (!isRecord(event)) return false
|
||||
if (typeof event.kind !== 'number') return false
|
||||
if (typeof event.content !== 'string') return false
|
||||
@@ -103,16 +112,26 @@ export function validateEvent<T>(event: T): event is T & UnsignedEvent {
|
||||
return true
|
||||
}
|
||||
|
||||
export function verifySignature(event: Event): boolean {
|
||||
return secp256k1.schnorr.verifySync(
|
||||
event.sig,
|
||||
getEventHash(event),
|
||||
event.pubkey
|
||||
)
|
||||
export function verifySignature(event: Event<number>): boolean {
|
||||
try {
|
||||
return schnorr.verify(event.sig, getEventHash(event), event.pubkey)
|
||||
} catch (err) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export function signEvent(event: UnsignedEvent, key: string): string {
|
||||
return secp256k1.utils.bytesToHex(
|
||||
secp256k1.schnorr.signSync(getEventHash(event), key)
|
||||
/** @deprecated Use `getSignature` instead. */
|
||||
export function signEvent(event: UnsignedEvent<number>, key: string): string {
|
||||
console.warn(
|
||||
'nostr-tools: `signEvent` is deprecated and will be removed or changed in the future. Please use `getSignature` instead.'
|
||||
)
|
||||
return getSignature(event, key)
|
||||
}
|
||||
|
||||
/** Calculate the signature for an event. */
|
||||
export function getSignature(
|
||||
event: UnsignedEvent<number>,
|
||||
key: string
|
||||
): string {
|
||||
return bytesToHex(schnorr.sign(getEventHash(event), key))
|
||||
}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
const {fj} = require('./lib/nostr.cjs')
|
||||
import {matchEventId, matchEventKind, getSubscriptionId} from './fakejson.ts'
|
||||
|
||||
test('match id', () => {
|
||||
expect(
|
||||
fj.matchEventId(
|
||||
matchEventId(
|
||||
`["EVENT","nostril-query",{"tags":[],"content":"so did we cut all corners and p2p stuff in order to make a decentralized social network that was fast and worked, but in the end what we got was a lot of very slow clients that can't handle the traffic of one jack dorsey tweet?","sig":"ca62629d189edebb8f0811cfa0ac53015013df5f305dcba3f411ba15cfc4074d8c2d517ee7d9e81c9eb72a7328bfbe31c9122156397565ac55e740404e2b1fe7","id":"fef2a50f7d9d3d5a5f38ee761bc087ec16198d3f0140df6d1e8193abf7c2b146","kind":1,"pubkey":"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d","created_at":1671150419}]`,
|
||||
'fef2a50f7d9d3d5a5f38ee761bc087ec16198d3f0140df6d1e8193abf7c2b146'
|
||||
)
|
||||
).toBeTruthy()
|
||||
|
||||
expect(
|
||||
fj.matchEventId(
|
||||
matchEventId(
|
||||
`["EVENT","nostril-query",{"content":"a bunch of mfs interacted with my post using what I assume were \"likes\": https://nostr.build/i/964.png","created_at":1672506879,"id":"f40bdd0905137ad60482537e260890ab50b0863bf16e67cf9383f203bd26c96f","kind":1,"pubkey":"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d","sig":"8b825d2d4096f0643b18ca39da59ec07a682cd8a3e717f119c845037573d98099f5bea94ec7ddedd5600c8020144a255ed52882a911f7f7ada6d6abb3c0a1eb4","tags":[]}]`,
|
||||
'fef2a50f7d9d3d5a5f38ee761bc087ec16198d3f0140df6d1e8193abf7c2b146'
|
||||
)
|
||||
@@ -20,14 +18,14 @@ test('match id', () => {
|
||||
|
||||
test('match kind', () => {
|
||||
expect(
|
||||
fj.matchEventKind(
|
||||
matchEventKind(
|
||||
`["EVENT","nostril-query",{"tags":[],"content":"so did we cut all corners and p2p stuff in order to make a decentralized social network that was fast and worked, but in the end what we got was a lot of very slow clients that can't handle the traffic of one jack dorsey tweet?","sig":"ca62629d189edebb8f0811cfa0ac53015013df5f305dcba3f411ba15cfc4074d8c2d517ee7d9e81c9eb72a7328bfbe31c9122156397565ac55e740404e2b1fe7","id":"fef2a50f7d9d3d5a5f38ee761bc087ec16198d3f0140df6d1e8193abf7c2b146","kind":1,"pubkey":"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d","created_at":1671150419}]`,
|
||||
1
|
||||
)
|
||||
).toBeTruthy()
|
||||
|
||||
expect(
|
||||
fj.matchEventKind(
|
||||
matchEventKind(
|
||||
`["EVENT","nostril-query",{"content":"{\"name\":\"fiatjaf\",\"about\":\"buy my merch at fiatjaf store\",\"picture\":\"https://fiatjaf.com/static/favicon.jpg\",\"nip05\":\"_@fiatjaf.com\"}","created_at":1671217411,"id":"b52f93f6dfecf9d81f59062827cd941412a0e8398dda60baf960b17499b88900","kind":12720,"pubkey":"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d","sig":"fc1ea5d45fa5ed0526faed06e8fc7a558e60d1b213e9714f440828584ee999b93407092f9b04deea7e504fa034fc0428f31f7f0f95417b3280ebe6004b80b470","tags":[]}]`,
|
||||
12720
|
||||
)
|
||||
@@ -35,14 +33,14 @@ test('match kind', () => {
|
||||
})
|
||||
|
||||
test('match subscription id', () => {
|
||||
expect(fj.getSubscriptionId('["EVENT","",{}]')).toEqual('')
|
||||
expect(fj.getSubscriptionId('["EVENT","_",{}]')).toEqual('_')
|
||||
expect(fj.getSubscriptionId('["EVENT","subname",{}]')).toEqual('subname')
|
||||
expect(fj.getSubscriptionId('["EVENT", "kasjbdjkav", {}]')).toEqual(
|
||||
expect(getSubscriptionId('["EVENT","",{}]')).toEqual('')
|
||||
expect(getSubscriptionId('["EVENT","_",{}]')).toEqual('_')
|
||||
expect(getSubscriptionId('["EVENT","subname",{}]')).toEqual('subname')
|
||||
expect(getSubscriptionId('["EVENT", "kasjbdjkav", {}]')).toEqual(
|
||||
'kasjbdjkav'
|
||||
)
|
||||
expect(
|
||||
fj.getSubscriptionId(
|
||||
getSubscriptionId(
|
||||
' [ \n\n "EVENT" , \n\n "y4d5ow45gfwoiudfÇA VSADLKAN KLDASB[12312535]SFMZSNJKLH" , {}]'
|
||||
)
|
||||
).toEqual('y4d5ow45gfwoiudfÇA VSADLKAN KLDASB[12312535]SFMZSNJKLH')
|
||||
@@ -1,6 +1,5 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
const {matchFilter, matchFilters} = require('./lib/nostr.cjs.js')
|
||||
import {matchFilter, matchFilters} from './filter.ts'
|
||||
import {buildEvent} from './test-helpers.ts'
|
||||
|
||||
describe('Filter', () => {
|
||||
describe('matchFilter', () => {
|
||||
@@ -14,13 +13,13 @@ describe('Filter', () => {
|
||||
'#tag': ['value']
|
||||
}
|
||||
|
||||
const event = {
|
||||
const event = buildEvent({
|
||||
id: '123',
|
||||
kind: 1,
|
||||
pubkey: 'abc',
|
||||
created_at: 150,
|
||||
tags: [['tag', 'value']]
|
||||
}
|
||||
tags: [['tag', 'value']],
|
||||
})
|
||||
|
||||
const result = matchFilter(filter, event)
|
||||
|
||||
@@ -30,7 +29,7 @@ describe('Filter', () => {
|
||||
it('should return false when the event id is not in the filter', () => {
|
||||
const filter = {ids: ['123', '456']}
|
||||
|
||||
const event = {id: '789'}
|
||||
const event = buildEvent({id: '789'})
|
||||
|
||||
const result = matchFilter(filter, event)
|
||||
|
||||
@@ -40,7 +39,7 @@ describe('Filter', () => {
|
||||
it('should return true when the event id starts with a prefix', () => {
|
||||
const filter = {ids: ['22', '00']}
|
||||
|
||||
const event = {id: '001'}
|
||||
const event = buildEvent({id: '001'})
|
||||
|
||||
const result = matchFilter(filter, event)
|
||||
|
||||
@@ -50,7 +49,7 @@ describe('Filter', () => {
|
||||
it('should return false when the event kind is not in the filter', () => {
|
||||
const filter = {kinds: [1, 2, 3]}
|
||||
|
||||
const event = {kind: 4}
|
||||
const event = buildEvent({kind: 4})
|
||||
|
||||
const result = matchFilter(filter, event)
|
||||
|
||||
@@ -60,7 +59,7 @@ describe('Filter', () => {
|
||||
it('should return false when the event author is not in the filter', () => {
|
||||
const filter = {authors: ['abc', 'def']}
|
||||
|
||||
const event = {pubkey: 'ghi'}
|
||||
const event = buildEvent({pubkey: 'ghi'})
|
||||
|
||||
const result = matchFilter(filter, event)
|
||||
|
||||
@@ -70,7 +69,7 @@ describe('Filter', () => {
|
||||
it('should return false when a tag is not present in the event', () => {
|
||||
const filter = {'#tag': ['value1', 'value2']}
|
||||
|
||||
const event = {tags: [['not_tag', 'value1']]}
|
||||
const event = buildEvent({tags: [['not_tag', 'value1']]})
|
||||
|
||||
const result = matchFilter(filter, event)
|
||||
|
||||
@@ -80,7 +79,7 @@ describe('Filter', () => {
|
||||
it('should return false when a tag value is not present in the event', () => {
|
||||
const filter = {'#tag': ['value1', 'value2']}
|
||||
|
||||
const event = {tags: [['tag', 'value3']]}
|
||||
const event = buildEvent({tags: [['tag', 'value3']]})
|
||||
|
||||
const result = matchFilter(filter, event)
|
||||
|
||||
@@ -90,7 +89,7 @@ describe('Filter', () => {
|
||||
it('should return true when filter has tags that is present in the event', () => {
|
||||
const filter = {'#tag1': ['foo']}
|
||||
|
||||
const event = {
|
||||
const event = buildEvent({
|
||||
id: '123',
|
||||
kind: 1,
|
||||
pubkey: 'abc',
|
||||
@@ -99,7 +98,7 @@ describe('Filter', () => {
|
||||
['tag1', 'foo'],
|
||||
['tag2', 'bar']
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
const result = matchFilter(filter, event)
|
||||
|
||||
@@ -109,7 +108,7 @@ describe('Filter', () => {
|
||||
it('should return false when the event is before the filter since value', () => {
|
||||
const filter = {since: 100}
|
||||
|
||||
const event = {created_at: 50}
|
||||
const event = buildEvent({created_at: 50})
|
||||
|
||||
const result = matchFilter(filter, event)
|
||||
|
||||
@@ -119,7 +118,7 @@ describe('Filter', () => {
|
||||
it('should return false when the event is after the filter until value', () => {
|
||||
const filter = {until: 100}
|
||||
|
||||
const event = {created_at: 150}
|
||||
const event = buildEvent({created_at: 150})
|
||||
|
||||
const result = matchFilter(filter, event)
|
||||
|
||||
@@ -135,7 +134,7 @@ describe('Filter', () => {
|
||||
{ids: ['789'], kinds: [3], authors: ['ghi']}
|
||||
]
|
||||
|
||||
const event = {id: '789', kind: 3, pubkey: 'ghi'}
|
||||
const event = buildEvent({id: '789', kind: 3, pubkey: 'ghi'})
|
||||
|
||||
const result = matchFilters(filters, event)
|
||||
|
||||
@@ -149,7 +148,7 @@ describe('Filter', () => {
|
||||
{ids: ['9'], kinds: [3], authors: ['g']}
|
||||
]
|
||||
|
||||
const event = {id: '987', kind: 3, pubkey: 'ghi'}
|
||||
const event = buildEvent({id: '987', kind: 3, pubkey: 'ghi'})
|
||||
|
||||
const result = matchFilters(filters, event)
|
||||
|
||||
@@ -163,7 +162,7 @@ describe('Filter', () => {
|
||||
{authors: ['abc'], limit: 3}
|
||||
]
|
||||
|
||||
const event = {id: '123', kind: 1, pubkey: 'abc', created_at: 150}
|
||||
const event = buildEvent({id: '123', kind: 1, pubkey: 'abc', created_at: 150})
|
||||
|
||||
const result = matchFilters(filters, event)
|
||||
|
||||
@@ -177,7 +176,7 @@ describe('Filter', () => {
|
||||
{ids: ['789'], kinds: [3], authors: ['ghi']}
|
||||
]
|
||||
|
||||
const event = {id: '100', kind: 4, pubkey: 'jkl'}
|
||||
const event = buildEvent({id: '100', kind: 4, pubkey: 'jkl'})
|
||||
|
||||
const result = matchFilters(filters, event)
|
||||
|
||||
@@ -190,7 +189,7 @@ describe('Filter', () => {
|
||||
{kinds: [1], limit: 2},
|
||||
{authors: ['abc'], limit: 3}
|
||||
]
|
||||
const event = {id: '456', kind: 2, pubkey: 'def', created_at: 200}
|
||||
const event = buildEvent({id: '456', kind: 2, pubkey: 'def', created_at: 200})
|
||||
|
||||
const result = matchFilters(filters, event)
|
||||
|
||||
14
filter.ts
14
filter.ts
@@ -1,8 +1,8 @@
|
||||
import {Event} from './event'
|
||||
import {Event, type Kind} from './event.ts'
|
||||
|
||||
export type Filter = {
|
||||
export type Filter<K extends number = Kind> = {
|
||||
ids?: string[]
|
||||
kinds?: number[]
|
||||
kinds?: K[]
|
||||
authors?: string[]
|
||||
since?: number
|
||||
until?: number
|
||||
@@ -12,8 +12,8 @@ export type Filter = {
|
||||
}
|
||||
|
||||
export function matchFilter(
|
||||
filter: Filter,
|
||||
event: Event
|
||||
filter: Filter<number>,
|
||||
event: Event<number>
|
||||
): boolean {
|
||||
if (filter.ids && filter.ids.indexOf(event.id) === -1) {
|
||||
if (!filter.ids.some(prefix => event.id.startsWith(prefix))) {
|
||||
@@ -48,8 +48,8 @@ export function matchFilter(
|
||||
}
|
||||
|
||||
export function matchFilters(
|
||||
filters: Filter[],
|
||||
event: Event
|
||||
filters: Filter<number>[],
|
||||
event: Event<number>
|
||||
): boolean {
|
||||
for (let i = 0; i < filters.length; i++) {
|
||||
if (matchFilter(filters[i], event)) return true
|
||||
|
||||
51
index.ts
51
index.ts
@@ -1,31 +1,24 @@
|
||||
export * from './keys'
|
||||
export * from './relay'
|
||||
export * from './event'
|
||||
export * from './filter'
|
||||
export * from './pool'
|
||||
export * from './references'
|
||||
export * from './keys.ts'
|
||||
export * from './relay.ts'
|
||||
export * from './event.ts'
|
||||
export * from './filter.ts'
|
||||
export * from './pool.ts'
|
||||
export * from './references.ts'
|
||||
|
||||
export * as nip04 from './nip04'
|
||||
export * as nip05 from './nip05'
|
||||
export * as nip06 from './nip06'
|
||||
export * as nip10 from './nip10'
|
||||
export * as nip13 from './nip13'
|
||||
export * as nip19 from './nip19'
|
||||
export * as nip21 from './nip21'
|
||||
export * as nip26 from './nip26'
|
||||
export * as nip27 from './nip27'
|
||||
export * as nip39 from './nip39'
|
||||
export * as nip42 from './nip42'
|
||||
export * as nip57 from './nip57'
|
||||
export * as nip04 from './nip04.ts'
|
||||
export * as nip05 from './nip05.ts'
|
||||
export * as nip06 from './nip06.ts'
|
||||
export * as nip10 from './nip10.ts'
|
||||
export * as nip13 from './nip13.ts'
|
||||
export * as nip18 from './nip18.ts'
|
||||
export * as nip19 from './nip19.ts'
|
||||
export * as nip21 from './nip21.ts'
|
||||
export * as nip25 from './nip25.ts'
|
||||
export * as nip26 from './nip26.ts'
|
||||
export * as nip27 from './nip27.ts'
|
||||
export * as nip39 from './nip39.ts'
|
||||
export * as nip42 from './nip42.ts'
|
||||
export * as nip57 from './nip57.ts'
|
||||
|
||||
export * as fj from './fakejson'
|
||||
export * as utils from './utils'
|
||||
|
||||
// monkey patch secp256k1
|
||||
import * as secp256k1 from '@noble/secp256k1'
|
||||
import {hmac} from '@noble/hashes/hmac'
|
||||
import {sha256} from '@noble/hashes/sha256'
|
||||
secp256k1.utils.hmacSha256Sync = (key, ...msgs) =>
|
||||
hmac(sha256, key, secp256k1.utils.concatBytes(...msgs))
|
||||
secp256k1.utils.sha256Sync = (...msgs) =>
|
||||
sha256(secp256k1.utils.concatBytes(...msgs))
|
||||
export * as fj from './fakejson.ts'
|
||||
export * as utils from './utils.ts'
|
||||
|
||||
5
jest.config.js
Normal file
5
jest.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
}
|
||||
4
justfile
4
justfile
@@ -7,10 +7,10 @@ build:
|
||||
rm -rf lib
|
||||
node build.js
|
||||
|
||||
test: build
|
||||
test:
|
||||
jest
|
||||
|
||||
test-only file: build
|
||||
test-only file:
|
||||
jest {{file}}
|
||||
|
||||
emit-types:
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
/* eslint-env jest */
|
||||
import {generatePrivateKey, getPublicKey} from './keys.ts'
|
||||
|
||||
const {generatePrivateKey, getPublicKey} = require('./lib/nostr.cjs')
|
||||
|
||||
test('test private key generation', () => {
|
||||
test('private key generation', () => {
|
||||
expect(generatePrivateKey()).toMatch(/[a-f0-9]{64}/)
|
||||
})
|
||||
|
||||
test('test public key generation', () => {
|
||||
test('public key generation', () => {
|
||||
expect(getPublicKey(generatePrivateKey())).toMatch(/[a-f0-9]{64}/)
|
||||
})
|
||||
|
||||
test('test public key from private key deterministic', () => {
|
||||
test('public key from private key deterministic', () => {
|
||||
let sk = generatePrivateKey()
|
||||
let pk = getPublicKey(sk)
|
||||
|
||||
7
keys.ts
7
keys.ts
@@ -1,9 +1,10 @@
|
||||
import * as secp256k1 from '@noble/secp256k1'
|
||||
import {schnorr} from '@noble/curves/secp256k1'
|
||||
import {bytesToHex} from '@noble/hashes/utils'
|
||||
|
||||
export function generatePrivateKey(): string {
|
||||
return secp256k1.utils.bytesToHex(secp256k1.utils.randomPrivateKey())
|
||||
return bytesToHex(schnorr.utils.randomPrivateKey())
|
||||
}
|
||||
|
||||
export function getPublicKey(privateKey: string): string {
|
||||
return secp256k1.utils.bytesToHex(secp256k1.schnorr.getPublicKey(privateKey))
|
||||
return bytesToHex(schnorr.getPublicKey(privateKey))
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
globalThis.crypto = require('crypto')
|
||||
const {nip04, getPublicKey, generatePrivateKey} = require('./lib/nostr.cjs')
|
||||
|
||||
test('encrypt and decrypt message', async () => {
|
||||
let sk1 = generatePrivateKey()
|
||||
let sk2 = generatePrivateKey()
|
||||
let pk1 = getPublicKey(sk1)
|
||||
let pk2 = getPublicKey(sk2)
|
||||
|
||||
expect(
|
||||
await nip04.decrypt(sk2, pk1, await nip04.encrypt(sk1, pk2, 'hello'))
|
||||
).toEqual('hello')
|
||||
})
|
||||
19
nip04.test.ts
Normal file
19
nip04.test.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import crypto from 'node:crypto'
|
||||
|
||||
import {encrypt, decrypt} from './nip04.ts'
|
||||
import {getPublicKey, generatePrivateKey} from './keys.ts'
|
||||
|
||||
// @ts-ignore
|
||||
// eslint-disable-next-line no-undef
|
||||
globalThis.crypto = crypto
|
||||
|
||||
test('encrypt and decrypt message', async () => {
|
||||
let sk1 = generatePrivateKey()
|
||||
let sk2 = generatePrivateKey()
|
||||
let pk1 = getPublicKey(sk1)
|
||||
let pk2 = getPublicKey(sk2)
|
||||
|
||||
expect(
|
||||
await decrypt(sk2, pk1, await encrypt(sk1, pk2, 'hello'))
|
||||
).toEqual('hello')
|
||||
})
|
||||
10
nip04.ts
10
nip04.ts
@@ -1,8 +1,14 @@
|
||||
import {randomBytes} from '@noble/hashes/utils'
|
||||
import * as secp256k1 from '@noble/secp256k1'
|
||||
import {secp256k1} from '@noble/curves/secp256k1'
|
||||
import {base64} from '@scure/base'
|
||||
|
||||
import {utf8Decoder, utf8Encoder} from './utils'
|
||||
import {utf8Decoder, utf8Encoder} from './utils.ts'
|
||||
|
||||
// @ts-ignore
|
||||
if (typeof crypto !== 'undefined' && !crypto.subtle && crypto.webcrypto) {
|
||||
// @ts-ignore
|
||||
crypto.subtle = crypto.webcrypto.subtle
|
||||
}
|
||||
|
||||
export async function encrypt(
|
||||
privkey: string,
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
const fetch = require('node-fetch')
|
||||
const {nip05} = require('./lib/nostr.cjs')
|
||||
|
||||
test('fetch nip05 profiles', async () => {
|
||||
nip05.useFetchImplementation(fetch)
|
||||
|
||||
let p1 = await nip05.queryProfile('jb55.com')
|
||||
expect(p1.pubkey).toEqual(
|
||||
'32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245'
|
||||
)
|
||||
expect(p1.relays).toEqual(['wss://relay.damus.io'])
|
||||
|
||||
let p2 = await nip05.queryProfile('jb55@jb55.com')
|
||||
expect(p2.pubkey).toEqual(
|
||||
'32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245'
|
||||
)
|
||||
expect(p2.relays).toEqual(['wss://relay.damus.io'])
|
||||
|
||||
let p3 = await nip05.queryProfile('channel.ninja@channel.ninja')
|
||||
expect(p3.pubkey).toEqual(
|
||||
'36e65b503eba8a6b698e724a59137603101166a1cddb45ddc704247fc8aa0fce'
|
||||
)
|
||||
})
|
||||
38
nip05.test.ts
Normal file
38
nip05.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import fetch from 'node-fetch'
|
||||
|
||||
import {useFetchImplementation, queryProfile} from './nip05.ts'
|
||||
|
||||
test('fetch nip05 profiles', async () => {
|
||||
useFetchImplementation(fetch)
|
||||
|
||||
let p1 = await queryProfile('jb55.com')
|
||||
expect(p1!.pubkey).toEqual(
|
||||
'32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245'
|
||||
)
|
||||
expect(p1!.relays).toEqual(['wss://relay.damus.io'])
|
||||
|
||||
let p2 = await queryProfile('jb55@jb55.com')
|
||||
expect(p2!.pubkey).toEqual(
|
||||
'32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245'
|
||||
)
|
||||
expect(p2!.relays).toEqual(['wss://relay.damus.io'])
|
||||
|
||||
let p3 = await queryProfile('channel.ninja@channel.ninja')
|
||||
expect(p3!.pubkey).toEqual(
|
||||
'36e65b503eba8a6b698e724a59137603101166a1cddb45ddc704247fc8aa0fce'
|
||||
)
|
||||
expect(p3!.relays).toEqual(undefined)
|
||||
|
||||
let p4 = await queryProfile('_@fiatjaf.com')
|
||||
expect(p4!.pubkey).toEqual(
|
||||
'3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d'
|
||||
)
|
||||
expect(p4!.relays).toEqual([
|
||||
'wss://relay.nostr.bg',
|
||||
'wss://nos.lol',
|
||||
'wss://nostr-verified.wellorder.net',
|
||||
'wss://nostr.zebedee.cloud',
|
||||
'wss://eden.nostr.land',
|
||||
'wss://nostr.milou.lol',
|
||||
])
|
||||
})
|
||||
78
nip05.ts
78
nip05.ts
@@ -1,4 +1,13 @@
|
||||
import {ProfilePointer} from './nip19'
|
||||
import {ProfilePointer} from './nip19.ts'
|
||||
|
||||
/**
|
||||
* NIP-05 regex. The localpart is optional, and should be assumed to be `_` otherwise.
|
||||
*
|
||||
* - 0: full match
|
||||
* - 1: name (optional)
|
||||
* - 2: domain
|
||||
*/
|
||||
export const NIP05_REGEX = /^(?:([\w.+-]+)@)?([\w.-]+)$/
|
||||
|
||||
var _fetch: any
|
||||
|
||||
@@ -25,36 +34,53 @@ export async function searchDomain(
|
||||
}
|
||||
}
|
||||
|
||||
export async function queryProfile(
|
||||
fullname: string
|
||||
): Promise<ProfilePointer | null> {
|
||||
let [name, domain] = fullname.split('@')
|
||||
export async function queryProfile(fullname: string): Promise<ProfilePointer | null> {
|
||||
const match = fullname.match(NIP05_REGEX)
|
||||
if (!match) return null
|
||||
|
||||
if (!domain) {
|
||||
// if there is no @, it is because it is just a domain, so assume the name is "_"
|
||||
domain = name
|
||||
name = '_'
|
||||
}
|
||||
const [_, name = '_', domain] = match
|
||||
|
||||
if (!name.match(/^[A-Za-z0-9-_.]+$/)) return null
|
||||
if (!domain.includes('.')) return null
|
||||
|
||||
let res
|
||||
try {
|
||||
res = await (
|
||||
await _fetch(`https://${domain}/.well-known/nostr.json?name=${name}`)
|
||||
).json()
|
||||
} catch (err) {
|
||||
const res = await _fetch(`https://${domain}/.well-known/nostr.json?name=${name}`)
|
||||
const { names, relays } = parseNIP05Result(await res.json())
|
||||
|
||||
const pubkey = names[name]
|
||||
return pubkey ? { pubkey, relays: relays?.[pubkey] } : null
|
||||
} catch (_e) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
if (!res?.names?.[name]) return null
|
||||
|
||||
let pubkey = res.names[name] as string
|
||||
let relays = (res.relays?.[pubkey] || []) as string[] // nip35
|
||||
|
||||
return {
|
||||
pubkey,
|
||||
relays
|
||||
/** nostr.json result. */
|
||||
export interface NIP05Result {
|
||||
names: {
|
||||
[name: string]: string
|
||||
}
|
||||
relays?: {
|
||||
[pubkey: string]: string[]
|
||||
}
|
||||
}
|
||||
|
||||
/** Parse the nostr.json and throw if it's not valid. */
|
||||
function parseNIP05Result(json: any): NIP05Result {
|
||||
const result: NIP05Result = {
|
||||
names: {},
|
||||
}
|
||||
|
||||
for (const [name, pubkey] of Object.entries(json.names)) {
|
||||
if (typeof name === 'string' && typeof pubkey === 'string') {
|
||||
result.names[name] = pubkey
|
||||
}
|
||||
}
|
||||
|
||||
if (json.relays) {
|
||||
result.relays = {}
|
||||
for (const [pubkey, relays] of Object.entries(json.relays)) {
|
||||
if (typeof pubkey === 'string' && Array.isArray(relays)) {
|
||||
result.relays[pubkey] = relays.filter((relay: unknown) => typeof relay === 'string')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/* eslint-env jest */
|
||||
const {nip06} = require('./lib/nostr.cjs')
|
||||
import {privateKeyFromSeedWords} from './nip06.ts'
|
||||
|
||||
test('generate private key from a mnemonic', async () => {
|
||||
const mnemonic = 'zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong'
|
||||
const privateKey = nip06.privateKeyFromSeedWords(mnemonic)
|
||||
const privateKey = privateKeyFromSeedWords(mnemonic)
|
||||
expect(privateKey).toEqual(
|
||||
'c26cf31d8ba425b555ca27d00ca71b5008004f2f662470f8c8131822ec129fe2'
|
||||
)
|
||||
@@ -12,7 +11,7 @@ test('generate private key from a mnemonic', async () => {
|
||||
test('generate private key from a mnemonic and passphrase', async () => {
|
||||
const mnemonic = 'zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong'
|
||||
const passphrase = '123'
|
||||
const privateKey = nip06.privateKeyFromSeedWords(mnemonic, passphrase)
|
||||
const privateKey = privateKeyFromSeedWords(mnemonic, passphrase)
|
||||
expect(privateKey).toEqual(
|
||||
'55a22b8203273d0aaf24c22c8fbe99608e70c524b17265641074281c8b978ae4'
|
||||
)
|
||||
4
nip06.ts
4
nip06.ts
@@ -1,4 +1,4 @@
|
||||
import * as secp256k1 from '@noble/secp256k1'
|
||||
import {bytesToHex} from '@noble/hashes/utils'
|
||||
import {wordlist} from '@scure/bip39/wordlists/english.js'
|
||||
import {
|
||||
generateMnemonic,
|
||||
@@ -14,7 +14,7 @@ export function privateKeyFromSeedWords(
|
||||
let root = HDKey.fromMasterSeed(mnemonicToSeedSync(mnemonic, passphrase))
|
||||
let privateKey = root.derive(`m/44'/1237'/0'/0/0`).privateKey
|
||||
if (!privateKey) throw new Error('could not derive private key')
|
||||
return secp256k1.utils.bytesToHex(privateKey)
|
||||
return bytesToHex(privateKey)
|
||||
}
|
||||
|
||||
export function generateSeedWords(): string {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
const {nip10} = require('./lib/nostr.cjs')
|
||||
import {parse} from './nip10.ts'
|
||||
|
||||
describe('parse NIP10-referenced events', () => {
|
||||
test('legacy + a lot of events', () => {
|
||||
@@ -49,7 +47,7 @@ describe('parse NIP10-referenced events', () => {
|
||||
]
|
||||
}
|
||||
|
||||
expect(nip10.parse(event)).toEqual({
|
||||
expect(parse(event)).toEqual({
|
||||
mentions: [
|
||||
{
|
||||
id: 'bbd72f0ae14374aa8fb166b483cfcf99b57d7f4cf1600ccbf17c350040834631',
|
||||
@@ -130,7 +128,7 @@ describe('parse NIP10-referenced events', () => {
|
||||
]
|
||||
}
|
||||
|
||||
expect(nip10.parse(event)).toEqual({
|
||||
expect(parse(event)).toEqual({
|
||||
mentions: [
|
||||
{
|
||||
id: 'bbd72f0ae14374aa8fb166b483cfcf99b57d7f4cf1600ccbf17c350040834631',
|
||||
@@ -191,7 +189,7 @@ describe('parse NIP10-referenced events', () => {
|
||||
]
|
||||
}
|
||||
|
||||
expect(nip10.parse(event)).toEqual({
|
||||
expect(parse(event)).toEqual({
|
||||
mentions: [],
|
||||
profiles: [
|
||||
{
|
||||
@@ -235,7 +233,7 @@ describe('parse NIP10-referenced events', () => {
|
||||
]
|
||||
}
|
||||
|
||||
expect(nip10.parse(event)).toEqual({
|
||||
expect(parse(event)).toEqual({
|
||||
mentions: [],
|
||||
profiles: [
|
||||
{
|
||||
@@ -304,7 +302,7 @@ describe('parse NIP10-referenced events', () => {
|
||||
]
|
||||
}
|
||||
|
||||
expect(nip10.parse(event)).toEqual({
|
||||
expect(parse(event)).toEqual({
|
||||
mentions: [],
|
||||
profiles: [
|
||||
{
|
||||
4
nip10.ts
4
nip10.ts
@@ -1,5 +1,5 @@
|
||||
import type {Event} from './event'
|
||||
import type {EventPointer, ProfilePointer} from './nip19'
|
||||
import type {Event} from './event.ts'
|
||||
import type {EventPointer, ProfilePointer} from './nip19.ts'
|
||||
|
||||
export type NIP10Result = {
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/* eslint-env jest */
|
||||
const {nip13} = require('./lib/nostr.cjs')
|
||||
import {getPow} from './nip13.ts'
|
||||
|
||||
test('identifies proof-of-work difficulty', async () => {
|
||||
const id = '000006d8c378af1779d2feebc7603a125d99eca0ccf1085959b307f64e5dd358'
|
||||
const difficulty = nip13.getPow(id)
|
||||
const difficulty = getPow(id)
|
||||
expect(difficulty).toEqual(21)
|
||||
})
|
||||
4
nip13.ts
4
nip13.ts
@@ -1,8 +1,8 @@
|
||||
import * as secp256k1 from '@noble/secp256k1'
|
||||
import {hexToBytes} from '@noble/hashes/utils'
|
||||
|
||||
/** Get POW difficulty from a Nostr hex ID. */
|
||||
export function getPow(id: string): number {
|
||||
return getLeadingZeroBits(secp256k1.utils.hexToBytes(id))
|
||||
return getLeadingZeroBits(hexToBytes(id))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
112
nip18.test.ts
Normal file
112
nip18.test.ts
Normal file
@@ -0,0 +1,112 @@
|
||||
import {finishEvent, Kind} from './event.ts'
|
||||
import {getPublicKey} from './keys.ts'
|
||||
import {finishRepostEvent, getRepostedEventPointer, getRepostedEvent} from './nip18.ts'
|
||||
import {buildEvent} from './test-helpers.ts'
|
||||
|
||||
const relayUrl = 'https://relay.example.com'
|
||||
|
||||
describe('finishRepostEvent + getRepostedEventPointer + getRepostedEvent', () => {
|
||||
const privateKey =
|
||||
'd217c1ff2f8a65c3e3a1740db3b9f58b8c848bb45e26d00ed4714e4a0f4ceecf'
|
||||
|
||||
const publicKey = getPublicKey(privateKey)
|
||||
|
||||
const repostedEvent = finishEvent(
|
||||
{
|
||||
kind: Kind.Text,
|
||||
tags: [
|
||||
['e', 'replied event id'],
|
||||
['p', 'replied event pubkey']
|
||||
],
|
||||
content: 'Replied to a post',
|
||||
created_at: 1617932115
|
||||
},
|
||||
privateKey
|
||||
)
|
||||
|
||||
it('should create a signed event from a minimal template', () => {
|
||||
const template = {
|
||||
created_at: 1617932115
|
||||
}
|
||||
|
||||
const event = finishRepostEvent(
|
||||
template,
|
||||
repostedEvent,
|
||||
relayUrl,
|
||||
privateKey
|
||||
)
|
||||
|
||||
expect(event.kind).toEqual(Kind.Repost)
|
||||
expect(event.tags).toEqual([
|
||||
['e', repostedEvent.id, relayUrl],
|
||||
['p', repostedEvent.pubkey]
|
||||
])
|
||||
expect(event.content).toEqual(JSON.stringify(repostedEvent))
|
||||
expect(event.created_at).toEqual(template.created_at)
|
||||
expect(event.pubkey).toEqual(publicKey)
|
||||
expect(typeof event.id).toEqual('string')
|
||||
expect(typeof event.sig).toEqual('string')
|
||||
|
||||
const repostedEventPointer = getRepostedEventPointer(event)
|
||||
|
||||
expect(repostedEventPointer!.id).toEqual(repostedEvent.id)
|
||||
expect(repostedEventPointer!.author).toEqual(repostedEvent.pubkey)
|
||||
expect(repostedEventPointer!.relays).toEqual([relayUrl])
|
||||
|
||||
const repostedEventFromContent = getRepostedEvent(event)
|
||||
|
||||
expect(repostedEventFromContent).toEqual(repostedEvent)
|
||||
})
|
||||
|
||||
it('should create a signed event from a filled template', () => {
|
||||
const template = {
|
||||
tags: [['nonstandard', 'tag']],
|
||||
content: '' as const,
|
||||
created_at: 1617932115
|
||||
}
|
||||
|
||||
const event = finishRepostEvent(
|
||||
template,
|
||||
repostedEvent,
|
||||
relayUrl,
|
||||
privateKey
|
||||
)
|
||||
|
||||
expect(event.kind).toEqual(Kind.Repost)
|
||||
expect(event.tags).toEqual([
|
||||
['nonstandard', 'tag'],
|
||||
['e', repostedEvent.id, relayUrl],
|
||||
['p', repostedEvent.pubkey]
|
||||
])
|
||||
expect(event.content).toEqual('')
|
||||
expect(event.created_at).toEqual(template.created_at)
|
||||
expect(event.pubkey).toEqual(publicKey)
|
||||
expect(typeof event.id).toEqual('string')
|
||||
expect(typeof event.sig).toEqual('string')
|
||||
|
||||
const repostedEventPointer = getRepostedEventPointer(event)
|
||||
|
||||
expect(repostedEventPointer!.id).toEqual(repostedEvent.id)
|
||||
expect(repostedEventPointer!.author).toEqual(repostedEvent.pubkey)
|
||||
expect(repostedEventPointer!.relays).toEqual([relayUrl])
|
||||
|
||||
const repostedEventFromContent = getRepostedEvent(event)
|
||||
|
||||
expect(repostedEventFromContent).toEqual(undefined)
|
||||
})
|
||||
})
|
||||
|
||||
describe('getRepostedEventPointer', () => {
|
||||
it('should parse an event with only an `e` tag', () => {
|
||||
const event = buildEvent({
|
||||
kind: Kind.Repost,
|
||||
tags: [['e', 'reposted event id', relayUrl]],
|
||||
})
|
||||
|
||||
const repostedEventPointer = getRepostedEventPointer(event)
|
||||
|
||||
expect(repostedEventPointer!.id).toEqual('reposted event id')
|
||||
expect(repostedEventPointer!.author).toEqual(undefined)
|
||||
expect(repostedEventPointer!.relays).toEqual([relayUrl])
|
||||
})
|
||||
})
|
||||
97
nip18.ts
Normal file
97
nip18.ts
Normal file
@@ -0,0 +1,97 @@
|
||||
import {Event, finishEvent, Kind, verifySignature} from './event.ts'
|
||||
import {EventPointer} from './nip19.ts'
|
||||
|
||||
export type RepostEventTemplate = {
|
||||
/**
|
||||
* Pass only non-nip18 tags if you have to.
|
||||
* Nip18 tags ('e' and 'p' tags pointing to the reposted event) will be added automatically.
|
||||
*/
|
||||
tags?: string[][]
|
||||
|
||||
/**
|
||||
* Pass an empty string to NOT include the stringified JSON of the reposted event.
|
||||
* Any other content will be ignored and replaced with the stringified JSON of the reposted event.
|
||||
* @default Stringified JSON of the reposted event
|
||||
*/
|
||||
content?: '';
|
||||
|
||||
created_at: number
|
||||
}
|
||||
|
||||
export function finishRepostEvent(
|
||||
t: RepostEventTemplate,
|
||||
reposted: Event<number>,
|
||||
relayUrl: string,
|
||||
privateKey: string,
|
||||
): Event<Kind.Repost> {
|
||||
return finishEvent({
|
||||
kind: Kind.Repost,
|
||||
tags: [
|
||||
...(t.tags ?? []),
|
||||
[ 'e', reposted.id, relayUrl ],
|
||||
[ 'p', reposted.pubkey ],
|
||||
],
|
||||
content: t.content === '' ? '' : JSON.stringify(reposted),
|
||||
created_at: t.created_at,
|
||||
}, privateKey)
|
||||
}
|
||||
|
||||
export function getRepostedEventPointer(event: Event<number>): undefined | EventPointer {
|
||||
if (event.kind !== Kind.Repost) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let lastETag: undefined | string[]
|
||||
let lastPTag: undefined | string[]
|
||||
|
||||
for (let i = event.tags.length - 1; i >= 0 && (lastETag === undefined || lastPTag === undefined); i--) {
|
||||
const tag = event.tags[i]
|
||||
if (tag.length >= 2) {
|
||||
if (tag[0] === 'e' && lastETag === undefined) {
|
||||
lastETag = tag
|
||||
} else if (tag[0] === 'p' && lastPTag === undefined) {
|
||||
lastPTag = tag
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lastETag === undefined) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
return {
|
||||
id: lastETag[1],
|
||||
relays: [ lastETag[2], lastPTag?.[2] ].filter((x): x is string => typeof x === 'string'),
|
||||
author: lastPTag?.[1],
|
||||
}
|
||||
}
|
||||
|
||||
export type GetRepostedEventOptions = {
|
||||
skipVerification?: boolean,
|
||||
};
|
||||
|
||||
export function getRepostedEvent(event: Event<number>, { skipVerification }: GetRepostedEventOptions = {}): undefined | Event<number> {
|
||||
const pointer = getRepostedEventPointer(event)
|
||||
|
||||
if (pointer === undefined || event.content === '') {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let repostedEvent: undefined | Event<number>
|
||||
|
||||
try {
|
||||
repostedEvent = JSON.parse(event.content) as Event<number>
|
||||
} catch (error) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
if (repostedEvent.id !== pointer.id) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
if (!skipVerification && !verifySignature(repostedEvent)) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
return repostedEvent
|
||||
}
|
||||
@@ -1,21 +1,29 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
const {nip19, generatePrivateKey, getPublicKey} = require('./lib/nostr.cjs')
|
||||
import {generatePrivateKey, getPublicKey} from './keys.ts'
|
||||
import {
|
||||
decode,
|
||||
naddrEncode,
|
||||
nprofileEncode,
|
||||
npubEncode,
|
||||
nrelayEncode,
|
||||
nsecEncode,
|
||||
type AddressPointer,
|
||||
type ProfilePointer,
|
||||
} from './nip19.ts'
|
||||
|
||||
test('encode and decode nsec', () => {
|
||||
let sk = generatePrivateKey()
|
||||
let nsec = nip19.nsecEncode(sk)
|
||||
let nsec = nsecEncode(sk)
|
||||
expect(nsec).toMatch(/nsec1\w+/)
|
||||
let {type, data} = nip19.decode(nsec)
|
||||
let {type, data} = decode(nsec)
|
||||
expect(type).toEqual('nsec')
|
||||
expect(data).toEqual(sk)
|
||||
})
|
||||
|
||||
test('encode and decode npub', () => {
|
||||
let pk = getPublicKey(generatePrivateKey())
|
||||
let npub = nip19.npubEncode(pk)
|
||||
let npub = npubEncode(pk)
|
||||
expect(npub).toMatch(/npub1\w+/)
|
||||
let {type, data} = nip19.decode(npub)
|
||||
let {type, data} = decode(npub)
|
||||
expect(type).toEqual('npub')
|
||||
expect(data).toEqual(pk)
|
||||
})
|
||||
@@ -26,19 +34,20 @@ test('encode and decode nprofile', () => {
|
||||
'wss://relay.nostr.example.mydomain.example.com',
|
||||
'wss://nostr.banana.com'
|
||||
]
|
||||
let nprofile = nip19.nprofileEncode({pubkey: pk, relays})
|
||||
let nprofile = nprofileEncode({pubkey: pk, relays})
|
||||
expect(nprofile).toMatch(/nprofile1\w+/)
|
||||
let {type, data} = nip19.decode(nprofile)
|
||||
let {type, data} = decode(nprofile)
|
||||
expect(type).toEqual('nprofile')
|
||||
expect(data.pubkey).toEqual(pk)
|
||||
expect(data.relays).toContain(relays[0])
|
||||
expect(data.relays).toContain(relays[1])
|
||||
const pointer = data as ProfilePointer
|
||||
expect(pointer.pubkey).toEqual(pk)
|
||||
expect(pointer.relays).toContain(relays[0])
|
||||
expect(pointer.relays).toContain(relays[1])
|
||||
})
|
||||
|
||||
test('decode nprofile without relays', () => {
|
||||
expect(
|
||||
nip19.decode(
|
||||
nip19.nprofileEncode({
|
||||
decode(
|
||||
nprofileEncode({
|
||||
pubkey:
|
||||
'97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322',
|
||||
relays: []
|
||||
@@ -56,56 +65,59 @@ test('encode and decode naddr', () => {
|
||||
'wss://relay.nostr.example.mydomain.example.com',
|
||||
'wss://nostr.banana.com'
|
||||
]
|
||||
let naddr = nip19.naddrEncode({
|
||||
let naddr = naddrEncode({
|
||||
pubkey: pk,
|
||||
relays,
|
||||
kind: 30023,
|
||||
identifier: 'banana'
|
||||
})
|
||||
expect(naddr).toMatch(/naddr1\w+/)
|
||||
let {type, data} = nip19.decode(naddr)
|
||||
let {type, data} = decode(naddr)
|
||||
expect(type).toEqual('naddr')
|
||||
expect(data.pubkey).toEqual(pk)
|
||||
expect(data.relays).toContain(relays[0])
|
||||
expect(data.relays).toContain(relays[1])
|
||||
expect(data.kind).toEqual(30023)
|
||||
expect(data.identifier).toEqual('banana')
|
||||
const pointer = data as AddressPointer
|
||||
expect(pointer.pubkey).toEqual(pk)
|
||||
expect(pointer.relays).toContain(relays[0])
|
||||
expect(pointer.relays).toContain(relays[1])
|
||||
expect(pointer.kind).toEqual(30023)
|
||||
expect(pointer.identifier).toEqual('banana')
|
||||
})
|
||||
|
||||
test('decode naddr from habla.news', () => {
|
||||
let {type, data} = nip19.decode(
|
||||
let {type, data} = decode(
|
||||
'naddr1qq98yetxv4ex2mnrv4esygrl54h466tz4v0re4pyuavvxqptsejl0vxcmnhfl60z3rth2xkpjspsgqqqw4rsf34vl5'
|
||||
)
|
||||
expect(type).toEqual('naddr')
|
||||
expect(data.pubkey).toEqual(
|
||||
const pointer = data as AddressPointer
|
||||
expect(pointer.pubkey).toEqual(
|
||||
'7fa56f5d6962ab1e3cd424e758c3002b8665f7b0d8dcee9fe9e288d7751ac194'
|
||||
)
|
||||
expect(data.kind).toEqual(30023)
|
||||
expect(data.identifier).toEqual('references')
|
||||
expect(pointer.kind).toEqual(30023)
|
||||
expect(pointer.identifier).toEqual('references')
|
||||
})
|
||||
|
||||
test('decode naddr from go-nostr with different TLV ordering', () => {
|
||||
let {type, data} = nip19.decode(
|
||||
let {type, data} = decode(
|
||||
'naddr1qqrxyctwv9hxzq3q80cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsxpqqqp65wqfwwaehxw309aex2mrp0yhxummnw3ezuetcv9khqmr99ekhjer0d4skjm3wv4uxzmtsd3jjucm0d5q3vamnwvaz7tmwdaehgu3wvfskuctwvyhxxmmd0zfmwx'
|
||||
)
|
||||
|
||||
expect(type).toEqual('naddr')
|
||||
expect(data.pubkey).toEqual(
|
||||
const pointer = data as AddressPointer
|
||||
expect(pointer.pubkey).toEqual(
|
||||
'3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d'
|
||||
)
|
||||
expect(data.relays).toContain(
|
||||
expect(pointer.relays).toContain(
|
||||
'wss://relay.nostr.example.mydomain.example.com'
|
||||
)
|
||||
expect(data.relays).toContain('wss://nostr.banana.com')
|
||||
expect(data.kind).toEqual(30023)
|
||||
expect(data.identifier).toEqual('banana')
|
||||
expect(pointer.relays).toContain('wss://nostr.banana.com')
|
||||
expect(pointer.kind).toEqual(30023)
|
||||
expect(pointer.identifier).toEqual('banana')
|
||||
})
|
||||
|
||||
test('encode and decode nrelay', () => {
|
||||
let url = "wss://relay.nostr.example"
|
||||
let nrelay = nip19.nrelayEncode(url)
|
||||
let url = 'wss://relay.nostr.example'
|
||||
let nrelay = nrelayEncode(url)
|
||||
expect(nrelay).toMatch(/nrelay1\w+/)
|
||||
let {type, data} = nip19.decode(nrelay)
|
||||
let {type, data} = decode(nrelay)
|
||||
expect(type).toEqual('nrelay')
|
||||
expect(data).toEqual(url)
|
||||
})
|
||||
35
nip19.ts
35
nip19.ts
@@ -1,10 +1,17 @@
|
||||
import * as secp256k1 from '@noble/secp256k1'
|
||||
import {bytesToHex, concatBytes, hexToBytes} from '@noble/hashes/utils'
|
||||
import {bech32} from '@scure/base'
|
||||
|
||||
import {utf8Decoder, utf8Encoder} from './utils'
|
||||
import {utf8Decoder, utf8Encoder} from './utils.ts'
|
||||
|
||||
const Bech32MaxSize = 5000
|
||||
|
||||
/**
|
||||
* Bech32 regex.
|
||||
* @see https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32
|
||||
*/
|
||||
export const BECH32_REGEX =
|
||||
/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/
|
||||
|
||||
export type ProfilePointer = {
|
||||
pubkey: string // hex
|
||||
relays?: string[]
|
||||
@@ -45,7 +52,7 @@ export function decode(nip19: string): DecodeResult {
|
||||
return {
|
||||
type: 'nprofile',
|
||||
data: {
|
||||
pubkey: secp256k1.utils.bytesToHex(tlv[0][0]),
|
||||
pubkey: bytesToHex(tlv[0][0]),
|
||||
relays: tlv[1] ? tlv[1].map(d => utf8Decoder.decode(d)) : []
|
||||
}
|
||||
}
|
||||
@@ -60,10 +67,10 @@ export function decode(nip19: string): DecodeResult {
|
||||
return {
|
||||
type: 'nevent',
|
||||
data: {
|
||||
id: secp256k1.utils.bytesToHex(tlv[0][0]),
|
||||
id: bytesToHex(tlv[0][0]),
|
||||
relays: tlv[1] ? tlv[1].map(d => utf8Decoder.decode(d)) : [],
|
||||
author: tlv[2]?.[0]
|
||||
? secp256k1.utils.bytesToHex(tlv[2][0])
|
||||
? bytesToHex(tlv[2][0])
|
||||
: undefined
|
||||
}
|
||||
}
|
||||
@@ -81,8 +88,8 @@ export function decode(nip19: string): DecodeResult {
|
||||
type: 'naddr',
|
||||
data: {
|
||||
identifier: utf8Decoder.decode(tlv[0][0]),
|
||||
pubkey: secp256k1.utils.bytesToHex(tlv[2][0]),
|
||||
kind: parseInt(secp256k1.utils.bytesToHex(tlv[3][0]), 16),
|
||||
pubkey: bytesToHex(tlv[2][0]),
|
||||
kind: parseInt(bytesToHex(tlv[3][0]), 16),
|
||||
relays: tlv[1] ? tlv[1].map(d => utf8Decoder.decode(d)) : []
|
||||
}
|
||||
}
|
||||
@@ -101,7 +108,7 @@ export function decode(nip19: string): DecodeResult {
|
||||
case 'nsec':
|
||||
case 'npub':
|
||||
case 'note':
|
||||
return {type: prefix, data: secp256k1.utils.bytesToHex(data)}
|
||||
return {type: prefix, data: bytesToHex(data)}
|
||||
|
||||
default:
|
||||
throw new Error(`unknown prefix ${prefix}`)
|
||||
@@ -138,14 +145,14 @@ export function noteEncode(hex: string): string {
|
||||
}
|
||||
|
||||
function encodeBytes(prefix: string, hex: string): string {
|
||||
let data = secp256k1.utils.hexToBytes(hex)
|
||||
let data = hexToBytes(hex)
|
||||
let words = bech32.toWords(data)
|
||||
return bech32.encode(prefix, words, Bech32MaxSize)
|
||||
}
|
||||
|
||||
export function nprofileEncode(profile: ProfilePointer): string {
|
||||
let data = encodeTLV({
|
||||
0: [secp256k1.utils.hexToBytes(profile.pubkey)],
|
||||
0: [hexToBytes(profile.pubkey)],
|
||||
1: (profile.relays || []).map(url => utf8Encoder.encode(url))
|
||||
})
|
||||
let words = bech32.toWords(data)
|
||||
@@ -154,9 +161,9 @@ export function nprofileEncode(profile: ProfilePointer): string {
|
||||
|
||||
export function neventEncode(event: EventPointer): string {
|
||||
let data = encodeTLV({
|
||||
0: [secp256k1.utils.hexToBytes(event.id)],
|
||||
0: [hexToBytes(event.id)],
|
||||
1: (event.relays || []).map(url => utf8Encoder.encode(url)),
|
||||
2: event.author ? [secp256k1.utils.hexToBytes(event.author)] : []
|
||||
2: event.author ? [hexToBytes(event.author)] : []
|
||||
})
|
||||
let words = bech32.toWords(data)
|
||||
return bech32.encode('nevent', words, Bech32MaxSize)
|
||||
@@ -169,7 +176,7 @@ export function naddrEncode(addr: AddressPointer): string {
|
||||
let data = encodeTLV({
|
||||
0: [utf8Encoder.encode(addr.identifier)],
|
||||
1: (addr.relays || []).map(url => utf8Encoder.encode(url)),
|
||||
2: [secp256k1.utils.hexToBytes(addr.pubkey)],
|
||||
2: [hexToBytes(addr.pubkey)],
|
||||
3: [new Uint8Array(kind)]
|
||||
})
|
||||
let words = bech32.toWords(data)
|
||||
@@ -197,5 +204,5 @@ function encodeTLV(tlv: TLV): Uint8Array {
|
||||
})
|
||||
})
|
||||
|
||||
return secp256k1.utils.concatBytes(...entries)
|
||||
return concatBytes(...entries)
|
||||
}
|
||||
|
||||
@@ -1,33 +1,32 @@
|
||||
/* eslint-env jest */
|
||||
const {nip21} = require('./lib/nostr.cjs')
|
||||
import {test as testRegex, parse} from './nip21.ts'
|
||||
|
||||
test('test', () => {
|
||||
test('test()', () => {
|
||||
expect(
|
||||
nip21.test(
|
||||
testRegex(
|
||||
'nostr:npub108pv4cg5ag52nq082kd5leu9ffrn2gdg6g4xdwatn73y36uzplmq9uyev6'
|
||||
)
|
||||
).toBe(true)
|
||||
expect(
|
||||
nip21.test(
|
||||
testRegex(
|
||||
'nostr:note1gmtnz6q2m55epmlpe3semjdcq987av3jvx4emmjsa8g3s9x7tg4sclreky'
|
||||
)
|
||||
).toBe(true)
|
||||
expect(
|
||||
nip21.test(
|
||||
testRegex(
|
||||
' nostr:npub108pv4cg5ag52nq082kd5leu9ffrn2gdg6g4xdwatn73y36uzplmq9uyev6'
|
||||
)
|
||||
).toBe(false)
|
||||
expect(nip21.test('nostr:')).toBe(false)
|
||||
expect(testRegex('nostr:')).toBe(false)
|
||||
expect(
|
||||
nip21.test(
|
||||
testRegex(
|
||||
'nostr:npub108pv4cg5ag52nQq082kd5leu9ffrn2gdg6g4xdwatn73y36uzplmq9uyev6'
|
||||
)
|
||||
).toBe(false)
|
||||
expect(nip21.test('gggggg')).toBe(false)
|
||||
expect(testRegex('gggggg')).toBe(false)
|
||||
})
|
||||
|
||||
test('parse', () => {
|
||||
const result = nip21.parse(
|
||||
const result = parse(
|
||||
'nostr:note1gmtnz6q2m55epmlpe3semjdcq987av3jvx4emmjsa8g3s9x7tg4sclreky'
|
||||
)
|
||||
|
||||
16
nip21.ts
16
nip21.ts
@@ -1,12 +1,4 @@
|
||||
import * as nip19 from './nip19'
|
||||
import * as nip21 from './nip21'
|
||||
|
||||
/**
|
||||
* Bech32 regex.
|
||||
* @see https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32
|
||||
*/
|
||||
export const BECH32_REGEX =
|
||||
/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/
|
||||
import {BECH32_REGEX, decode, type DecodeResult} from './nip19.ts'
|
||||
|
||||
/** Nostr URI regex, eg `nostr:npub1...` */
|
||||
export const NOSTR_URI_REGEX = new RegExp(`nostr:(${BECH32_REGEX.source})`)
|
||||
@@ -26,16 +18,16 @@ export interface NostrURI {
|
||||
/** The bech32-encoded data (eg `npub1...`). */
|
||||
value: string
|
||||
/** Decoded bech32 string, according to NIP-19. */
|
||||
decoded: nip19.DecodeResult
|
||||
decoded: DecodeResult
|
||||
}
|
||||
|
||||
/** Parse and decode a Nostr URI. */
|
||||
export function parse(uri: string): NostrURI {
|
||||
const match = uri.match(new RegExp(`^${nip21.NOSTR_URI_REGEX.source}$`))
|
||||
const match = uri.match(new RegExp(`^${NOSTR_URI_REGEX.source}$`))
|
||||
if (!match) throw new Error(`Invalid Nostr URI: ${uri}`)
|
||||
return {
|
||||
uri: match[0] as `nostr:${string}`,
|
||||
value: match[1],
|
||||
decoded: nip19.decode(match[1])
|
||||
decoded: decode(match[1])
|
||||
}
|
||||
}
|
||||
|
||||
78
nip25.test.ts
Normal file
78
nip25.test.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
import {finishEvent, Kind} from './event.ts'
|
||||
import {getPublicKey} from './keys.ts'
|
||||
import {finishReactionEvent, getReactedEventPointer} from './nip25.ts'
|
||||
|
||||
describe('finishReactionEvent + getReactedEventPointer', () => {
|
||||
const privateKey =
|
||||
'd217c1ff2f8a65c3e3a1740db3b9f58b8c848bb45e26d00ed4714e4a0f4ceecf'
|
||||
|
||||
const publicKey = getPublicKey(privateKey)
|
||||
|
||||
const reactedEvent = finishEvent(
|
||||
{
|
||||
kind: Kind.Text,
|
||||
tags: [
|
||||
['e', 'replied event id'],
|
||||
['p', 'replied event pubkey']
|
||||
],
|
||||
content: 'Replied to a post',
|
||||
created_at: 1617932115
|
||||
},
|
||||
privateKey
|
||||
)
|
||||
|
||||
it('should create a signed event from a minimal template', () => {
|
||||
const template = {
|
||||
created_at: 1617932115
|
||||
}
|
||||
|
||||
const event = finishReactionEvent(template, reactedEvent, privateKey)
|
||||
|
||||
expect(event.kind).toEqual(Kind.Reaction)
|
||||
expect(event.tags).toEqual([
|
||||
['e', 'replied event id'],
|
||||
['p', 'replied event pubkey'],
|
||||
['e', '0ecdbd4dba0652afb19e5f638257a41552a37995a4438ef63de658443f8d16b1'],
|
||||
['p', '6af0f9de588f2c53cedcba26c5e2402e0d0aa64ec7b47c9f8d97b5bc562bab5f']
|
||||
])
|
||||
expect(event.content).toEqual('+')
|
||||
expect(event.created_at).toEqual(template.created_at)
|
||||
expect(event.pubkey).toEqual(publicKey)
|
||||
expect(typeof event.id).toEqual('string')
|
||||
expect(typeof event.sig).toEqual('string')
|
||||
|
||||
const reactedEventPointer = getReactedEventPointer(event)
|
||||
|
||||
expect(reactedEventPointer!.id).toEqual(reactedEvent.id)
|
||||
expect(reactedEventPointer!.author).toEqual(reactedEvent.pubkey)
|
||||
})
|
||||
|
||||
it('should create a signed event from a filled template', () => {
|
||||
const template = {
|
||||
tags: [['nonstandard', 'tag']],
|
||||
content: '👍',
|
||||
created_at: 1617932115
|
||||
}
|
||||
|
||||
const event = finishReactionEvent(template, reactedEvent, privateKey)
|
||||
|
||||
expect(event.kind).toEqual(Kind.Reaction)
|
||||
expect(event.tags).toEqual([
|
||||
['nonstandard', 'tag'],
|
||||
['e', 'replied event id'],
|
||||
['p', 'replied event pubkey'],
|
||||
['e', '0ecdbd4dba0652afb19e5f638257a41552a37995a4438ef63de658443f8d16b1'],
|
||||
['p', '6af0f9de588f2c53cedcba26c5e2402e0d0aa64ec7b47c9f8d97b5bc562bab5f']
|
||||
])
|
||||
expect(event.content).toEqual('👍')
|
||||
expect(event.created_at).toEqual(template.created_at)
|
||||
expect(event.pubkey).toEqual(publicKey)
|
||||
expect(typeof event.id).toEqual('string')
|
||||
expect(typeof event.sig).toEqual('string')
|
||||
|
||||
const reactedEventPointer = getReactedEventPointer(event)
|
||||
|
||||
expect(reactedEventPointer!.id).toEqual(reactedEvent.id)
|
||||
expect(reactedEventPointer!.author).toEqual(reactedEvent.pubkey)
|
||||
})
|
||||
})
|
||||
69
nip25.ts
Normal file
69
nip25.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import {Event, finishEvent, Kind} from './event.ts'
|
||||
|
||||
import type {EventPointer} from './nip19.ts'
|
||||
|
||||
export type ReactionEventTemplate = {
|
||||
/**
|
||||
* Pass only non-nip25 tags if you have to. Nip25 tags ('e' and 'p' tags from reacted event) will be added automatically.
|
||||
*/
|
||||
tags?: string[][]
|
||||
|
||||
/**
|
||||
* @default '+'
|
||||
*/
|
||||
content?: string
|
||||
|
||||
created_at: number
|
||||
}
|
||||
|
||||
export function finishReactionEvent(
|
||||
t: ReactionEventTemplate,
|
||||
reacted: Event<number>,
|
||||
privateKey: string,
|
||||
): Event<Kind.Reaction> {
|
||||
const inheritedTags = reacted.tags.filter(
|
||||
(tag) => tag.length >= 2 && (tag[0] === 'e' || tag[0] === 'p'),
|
||||
)
|
||||
|
||||
return finishEvent({
|
||||
...t,
|
||||
kind: Kind.Reaction,
|
||||
tags: [
|
||||
...(t.tags ?? []),
|
||||
...inheritedTags,
|
||||
['e', reacted.id],
|
||||
['p', reacted.pubkey],
|
||||
],
|
||||
content: t.content ?? '+',
|
||||
}, privateKey)
|
||||
}
|
||||
|
||||
export function getReactedEventPointer(event: Event<number>): undefined | EventPointer {
|
||||
if (event.kind !== Kind.Reaction) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
let lastETag: undefined | string[]
|
||||
let lastPTag: undefined | string[]
|
||||
|
||||
for (let i = event.tags.length - 1; i >= 0 && (lastETag === undefined || lastPTag === undefined); i--) {
|
||||
const tag = event.tags[i]
|
||||
if (tag.length >= 2) {
|
||||
if (tag[0] === 'e' && lastETag === undefined) {
|
||||
lastETag = tag
|
||||
} else if (tag[0] === 'p' && lastPTag === undefined) {
|
||||
lastPTag = tag
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (lastETag === undefined || lastPTag === undefined) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
return {
|
||||
id: lastETag[1],
|
||||
relays: [ lastETag[2], lastPTag[2] ].filter((x) => x !== undefined),
|
||||
author: lastPTag[1],
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
const {nip26, getPublicKey, generatePrivateKey} = require('./lib/nostr.cjs')
|
||||
import {getPublicKey, generatePrivateKey} from './keys.ts'
|
||||
import {getDelegator, createDelegation} from './nip26.ts'
|
||||
import {buildEvent} from './test-helpers.ts'
|
||||
|
||||
test('parse good delegation from NIP', async () => {
|
||||
expect(
|
||||
nip26.getDelegator({
|
||||
getDelegator({
|
||||
id: 'a080fd288b60ac2225ff2e2d815291bd730911e583e177302cc949a15dc2b2dc',
|
||||
pubkey:
|
||||
'62903b1ff41559daf9ee98ef1ae67cc52f301bb5ce26d14baba3052f649c3f49',
|
||||
@@ -26,7 +26,7 @@ test('parse good delegation from NIP', async () => {
|
||||
|
||||
test('parse bad delegations', async () => {
|
||||
expect(
|
||||
nip26.getDelegator({
|
||||
getDelegator({
|
||||
id: 'a080fd288b60ac2225ff2e2d815291bd730911e583e177302cc949a15dc2b2dc',
|
||||
pubkey:
|
||||
'62903b1ff41559daf9ee98ef1ae67cc52f301bb5ce26d14baba3052f649c3f49',
|
||||
@@ -46,7 +46,7 @@ test('parse bad delegations', async () => {
|
||||
).toEqual(null)
|
||||
|
||||
expect(
|
||||
nip26.getDelegator({
|
||||
getDelegator({
|
||||
id: 'a080fd288b60ac2225ff2e2d815291bd730911e583e177302cc949a15dc2b2dc',
|
||||
pubkey:
|
||||
'62903b1ff41559daf9ee98ef1ae67cc52f301bb5ce26d14baba3052f649c3f49',
|
||||
@@ -66,7 +66,7 @@ test('parse bad delegations', async () => {
|
||||
).toEqual(null)
|
||||
|
||||
expect(
|
||||
nip26.getDelegator({
|
||||
getDelegator({
|
||||
id: 'a080fd288b60ac2225ff2e2d815291bd730911e583e177302cc949a15dc2b2dc',
|
||||
pubkey:
|
||||
'62903b1ff41559daf9ee98ef1ae67c152f301bb5ce26d14baba3052f649c3f49',
|
||||
@@ -91,15 +91,15 @@ test('create and verify delegation', async () => {
|
||||
let pk1 = getPublicKey(sk1)
|
||||
let sk2 = generatePrivateKey()
|
||||
let pk2 = getPublicKey(sk2)
|
||||
let delegation = nip26.createDelegation(sk1, {pubkey: pk2, kind: 1})
|
||||
let delegation = createDelegation(sk1, {pubkey: pk2, kind: 1})
|
||||
expect(delegation).toHaveProperty('from', pk1)
|
||||
expect(delegation).toHaveProperty('to', pk2)
|
||||
expect(delegation).toHaveProperty('cond', 'kind=1')
|
||||
|
||||
let event = {
|
||||
let event = buildEvent({
|
||||
kind: 1,
|
||||
tags: [['delegation', delegation.from, delegation.cond, delegation.sig]],
|
||||
pubkey: pk2
|
||||
}
|
||||
expect(nip26.getDelegator(event)).toEqual(pk1)
|
||||
pubkey: pk2,
|
||||
})
|
||||
expect(getDelegator(event)).toEqual(pk1)
|
||||
})
|
||||
24
nip26.ts
24
nip26.ts
@@ -1,15 +1,17 @@
|
||||
import * as secp256k1 from '@noble/secp256k1'
|
||||
import {schnorr} from '@noble/curves/secp256k1'
|
||||
import {bytesToHex} from '@noble/hashes/utils'
|
||||
import {sha256} from '@noble/hashes/sha256'
|
||||
|
||||
import {Event} from './event'
|
||||
import {utf8Encoder} from './utils'
|
||||
import {getPublicKey} from './keys'
|
||||
import {utf8Encoder} from './utils.ts'
|
||||
import {getPublicKey} from './keys.ts'
|
||||
|
||||
import type {Event} from './event.ts'
|
||||
|
||||
export type Parameters = {
|
||||
pubkey: string // the key to whom the delegation will be given
|
||||
kind: number | undefined
|
||||
until: number | undefined // delegation will only be valid until this date
|
||||
since: number | undefined // delegation will be valid from this date on
|
||||
kind?: number
|
||||
until?: number // delegation will only be valid until this date
|
||||
since?: number // delegation will be valid from this date on
|
||||
}
|
||||
|
||||
export type Delegation = {
|
||||
@@ -36,8 +38,8 @@ export function createDelegation(
|
||||
utf8Encoder.encode(`nostr:delegation:${parameters.pubkey}:${cond}`)
|
||||
)
|
||||
|
||||
let sig = secp256k1.utils.bytesToHex(
|
||||
secp256k1.schnorr.signSync(sighash, privateKey)
|
||||
let sig = bytesToHex(
|
||||
schnorr.sign(sighash, privateKey)
|
||||
)
|
||||
|
||||
return {
|
||||
@@ -48,7 +50,7 @@ export function createDelegation(
|
||||
}
|
||||
}
|
||||
|
||||
export function getDelegator(event: Event): string | null {
|
||||
export function getDelegator(event: Event<number>): string | null {
|
||||
// find delegation tag
|
||||
let tag = event.tags.find(tag => tag[0] === 'delegation' && tag.length >= 4)
|
||||
if (!tag) return null
|
||||
@@ -84,7 +86,7 @@ export function getDelegator(event: Event): string | null {
|
||||
let sighash = sha256(
|
||||
utf8Encoder.encode(`nostr:delegation:${event.pubkey}:${cond}`)
|
||||
)
|
||||
if (!secp256k1.schnorr.verifySync(sig, sighash, pubkey)) return null
|
||||
if (!schnorr.verify(sig, sighash, pubkey)) return null
|
||||
|
||||
return pubkey
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/* eslint-env jest */
|
||||
const {nip27} = require('./lib/nostr.cjs')
|
||||
import {matchAll, replaceAll} from './nip27.ts'
|
||||
|
||||
test('matchAll', () => {
|
||||
const result = nip27.matchAll(
|
||||
const result = matchAll(
|
||||
'Hello nostr:npub108pv4cg5ag52nq082kd5leu9ffrn2gdg6g4xdwatn73y36uzplmq9uyev6!\n\nnostr:note1gmtnz6q2m55epmlpe3semjdcq987av3jvx4emmjsa8g3s9x7tg4sclreky'
|
||||
)
|
||||
|
||||
@@ -34,7 +33,7 @@ test('replaceAll', () => {
|
||||
const content =
|
||||
'Hello nostr:npub108pv4cg5ag52nq082kd5leu9ffrn2gdg6g4xdwatn73y36uzplmq9uyev6!\n\nnostr:note1gmtnz6q2m55epmlpe3semjdcq987av3jvx4emmjsa8g3s9x7tg4sclreky'
|
||||
|
||||
const result = nip27.replaceAll(content, ({decoded, value}) => {
|
||||
const result = replaceAll(content, ({decoded, value}) => {
|
||||
switch (decoded.type) {
|
||||
case 'npub':
|
||||
return '@alex'
|
||||
14
nip27.ts
14
nip27.ts
@@ -1,12 +1,12 @@
|
||||
import * as nip19 from './nip19'
|
||||
import * as nip21 from './nip21'
|
||||
import {decode} from './nip19.ts'
|
||||
import {NOSTR_URI_REGEX, type NostrURI} from './nip21.ts'
|
||||
|
||||
/** Regex to find NIP-21 URIs inside event content. */
|
||||
export const regex = () =>
|
||||
new RegExp(`\\b${nip21.NOSTR_URI_REGEX.source}\\b`, 'g')
|
||||
new RegExp(`\\b${NOSTR_URI_REGEX.source}\\b`, 'g')
|
||||
|
||||
/** Match result for a Nostr URI in event content. */
|
||||
export interface NostrURIMatch extends nip21.NostrURI {
|
||||
export interface NostrURIMatch extends NostrURI {
|
||||
/** Index where the URI begins in the event content. */
|
||||
start: number
|
||||
/** Index where the URI ends in the event content. */
|
||||
@@ -23,7 +23,7 @@ export function * matchAll(content: string): Iterable<NostrURIMatch> {
|
||||
yield {
|
||||
uri: uri as `nostr:${string}`,
|
||||
value,
|
||||
decoded: nip19.decode(value),
|
||||
decoded: decode(value),
|
||||
start: match.index!,
|
||||
end: match.index! + uri.length
|
||||
}
|
||||
@@ -51,13 +51,13 @@ export function * matchAll(content: string): Iterable<NostrURIMatch> {
|
||||
*/
|
||||
export function replaceAll(
|
||||
content: string,
|
||||
replacer: (match: nip21.NostrURI) => string
|
||||
replacer: (match: NostrURI) => string
|
||||
): string {
|
||||
return content.replaceAll(regex(), (uri, value) => {
|
||||
return replacer({
|
||||
uri: uri as `nostr:${string}`,
|
||||
value,
|
||||
decoded: nip19.decode(value)
|
||||
decoded: decode(value)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
/* eslint-env jest */
|
||||
import fetch from 'node-fetch'
|
||||
|
||||
const fetch = require('node-fetch')
|
||||
const {nip39} = require('./lib/nostr.cjs.js')
|
||||
import {useFetchImplementation, validateGithub} from './nip39.ts'
|
||||
|
||||
test('validate github claim', async () => {
|
||||
nip39.useFetchImplementation(fetch)
|
||||
useFetchImplementation(fetch)
|
||||
|
||||
let result = await nip39.validateGithub(
|
||||
let result = await validateGithub(
|
||||
'npub1gcxzte5zlkncx26j68ez60fzkvtkm9e0vrwdcvsjakxf9mu9qewqlfnj5z',
|
||||
'vitorpamplona',
|
||||
'cf19e2d1d7f8dac6348ad37b35ec8421'
|
||||
@@ -1,27 +0,0 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
require('websocket-polyfill')
|
||||
const {
|
||||
relayInit,
|
||||
generatePrivateKey,
|
||||
finishEvent,
|
||||
nip42
|
||||
} = require('./lib/nostr.cjs')
|
||||
|
||||
test('auth flow', done => {
|
||||
const relay = relayInit('wss://nostr.kollider.xyz')
|
||||
relay.connect()
|
||||
const sk = generatePrivateKey()
|
||||
|
||||
relay.on('auth', async challenge => {
|
||||
await expect(
|
||||
nip42.authenticate({
|
||||
challenge,
|
||||
relay,
|
||||
sign: e => finishEvent(e, sk)
|
||||
})
|
||||
).rejects.toBeTruthy()
|
||||
relay.close()
|
||||
done()
|
||||
})
|
||||
})
|
||||
26
nip42.test.ts
Normal file
26
nip42.test.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'websocket-polyfill'
|
||||
|
||||
import {finishEvent} from './event.ts'
|
||||
import {generatePrivateKey} from './keys.ts'
|
||||
import {authenticate} from './nip42.ts'
|
||||
import {relayInit} from './relay.ts'
|
||||
|
||||
test('auth flow', () => {
|
||||
const relay = relayInit('wss://nostr.kollider.xyz')
|
||||
relay.connect()
|
||||
const sk = generatePrivateKey()
|
||||
|
||||
return new Promise<void>((resolve) => {
|
||||
relay.on('auth', async challenge => {
|
||||
await expect(
|
||||
authenticate({
|
||||
challenge,
|
||||
relay,
|
||||
sign: (e) => finishEvent(e, sk)
|
||||
})
|
||||
).rejects.toBeTruthy()
|
||||
relay.close()
|
||||
resolve()
|
||||
})
|
||||
})
|
||||
})
|
||||
6
nip42.ts
6
nip42.ts
@@ -1,5 +1,5 @@
|
||||
import {EventTemplate, Event, Kind} from './event'
|
||||
import {Relay} from './relay'
|
||||
import {Kind, type EventTemplate, type Event} from './event.ts'
|
||||
import {Relay} from './relay.ts'
|
||||
|
||||
/**
|
||||
* Authenticate via NIP-42 flow.
|
||||
@@ -17,7 +17,7 @@ export const authenticate = async ({
|
||||
}: {
|
||||
challenge: string
|
||||
relay: Relay
|
||||
sign: (e: EventTemplate) => Promise<Event>
|
||||
sign: <K extends number = number>(e: EventTemplate<K>) => Promise<Event<K>> | Event<K>
|
||||
}): Promise<void> => {
|
||||
const e: EventTemplate = {
|
||||
kind: Kind.ClientAuth,
|
||||
|
||||
@@ -1,25 +1,28 @@
|
||||
const {bech32} = require('@scure/base')
|
||||
const {
|
||||
nip57,
|
||||
generatePrivateKey,
|
||||
getPublicKey,
|
||||
finishEvent
|
||||
} = require('./lib/nostr.cjs')
|
||||
import {finishEvent} from './event.ts'
|
||||
import {getPublicKey, generatePrivateKey} from './keys.ts'
|
||||
import {
|
||||
getZapEndpoint,
|
||||
makeZapReceipt,
|
||||
makeZapRequest,
|
||||
useFetchImplementation,
|
||||
validateZapRequest,
|
||||
} from './nip57.ts'
|
||||
import {buildEvent} from './test-helpers.ts'
|
||||
|
||||
describe('getZapEndpoint', () => {
|
||||
test('returns null if neither lud06 nor lud16 is present', async () => {
|
||||
const metadata = {content: '{}'}
|
||||
const result = await nip57.getZapEndpoint(metadata)
|
||||
const metadata = buildEvent({kind: 0, content: '{}'})
|
||||
const result = await getZapEndpoint(metadata)
|
||||
|
||||
expect(result).toBeNull()
|
||||
})
|
||||
|
||||
test('returns null if fetch fails', async () => {
|
||||
const fetchImplementation = jest.fn(() => Promise.reject(new Error()))
|
||||
nip57.useFetchImplementation(fetchImplementation)
|
||||
useFetchImplementation(fetchImplementation)
|
||||
|
||||
const metadata = {content: '{"lud16": "name@domain"}'}
|
||||
const result = await nip57.getZapEndpoint(metadata)
|
||||
const metadata = buildEvent({kind: 0, content: '{"lud16": "name@domain"}'})
|
||||
const result = await getZapEndpoint(metadata)
|
||||
|
||||
expect(result).toBeNull()
|
||||
expect(fetchImplementation).toHaveBeenCalledWith(
|
||||
@@ -31,10 +34,10 @@ describe('getZapEndpoint', () => {
|
||||
const fetchImplementation = jest.fn(() =>
|
||||
Promise.resolve({json: () => ({allowsNostr: false})})
|
||||
)
|
||||
nip57.useFetchImplementation(fetchImplementation)
|
||||
useFetchImplementation(fetchImplementation)
|
||||
|
||||
const metadata = {content: '{"lud16": "name@domain"}'}
|
||||
const result = await nip57.getZapEndpoint(metadata)
|
||||
const metadata = buildEvent({kind: 0, content: '{"lud16": "name@domain"}'})
|
||||
const result = await getZapEndpoint(metadata)
|
||||
|
||||
expect(result).toBeNull()
|
||||
expect(fetchImplementation).toHaveBeenCalledWith(
|
||||
@@ -52,10 +55,10 @@ describe('getZapEndpoint', () => {
|
||||
})
|
||||
})
|
||||
)
|
||||
nip57.useFetchImplementation(fetchImplementation)
|
||||
useFetchImplementation(fetchImplementation)
|
||||
|
||||
const metadata = {content: '{"lud16": "name@domain"}'}
|
||||
const result = await nip57.getZapEndpoint(metadata)
|
||||
const metadata = buildEvent({kind: 0, content: '{"lud16": "name@domain"}'})
|
||||
const result = await getZapEndpoint(metadata)
|
||||
|
||||
expect(result).toBe('callback')
|
||||
expect(fetchImplementation).toHaveBeenCalledWith(
|
||||
@@ -67,7 +70,8 @@ describe('getZapEndpoint', () => {
|
||||
describe('makeZapRequest', () => {
|
||||
test('throws an error if amount is not given', () => {
|
||||
expect(() =>
|
||||
nip57.makeZapRequest({
|
||||
// @ts-expect-error
|
||||
makeZapRequest({
|
||||
profile: 'profile',
|
||||
event: null,
|
||||
relays: [],
|
||||
@@ -78,7 +82,8 @@ describe('makeZapRequest', () => {
|
||||
|
||||
test('throws an error if profile is not given', () => {
|
||||
expect(() =>
|
||||
nip57.makeZapRequest({
|
||||
// @ts-expect-error
|
||||
makeZapRequest({
|
||||
event: null,
|
||||
amount: 100,
|
||||
relays: [],
|
||||
@@ -88,7 +93,7 @@ describe('makeZapRequest', () => {
|
||||
})
|
||||
|
||||
test('returns a valid Zap request', () => {
|
||||
const result = nip57.makeZapRequest({
|
||||
const result = makeZapRequest({
|
||||
profile: 'profile',
|
||||
event: 'event',
|
||||
amount: 100,
|
||||
@@ -111,7 +116,7 @@ describe('makeZapRequest', () => {
|
||||
|
||||
describe('validateZapRequest', () => {
|
||||
test('returns an error message for invalid JSON', () => {
|
||||
expect(nip57.validateZapRequest('invalid JSON')).toBe(
|
||||
expect(validateZapRequest('invalid JSON')).toBe(
|
||||
'Invalid zap request JSON.'
|
||||
)
|
||||
})
|
||||
@@ -128,7 +133,7 @@ describe('validateZapRequest', () => {
|
||||
]
|
||||
}
|
||||
|
||||
expect(nip57.validateZapRequest(JSON.stringify(zapRequest))).toBe(
|
||||
expect(validateZapRequest(JSON.stringify(zapRequest))).toBe(
|
||||
'Zap request is not a valid Nostr event.'
|
||||
)
|
||||
})
|
||||
@@ -149,7 +154,7 @@ describe('validateZapRequest', () => {
|
||||
]
|
||||
}
|
||||
|
||||
expect(nip57.validateZapRequest(JSON.stringify(zapRequest))).toBe(
|
||||
expect(validateZapRequest(JSON.stringify(zapRequest))).toBe(
|
||||
'Invalid signature on zap request.'
|
||||
)
|
||||
})
|
||||
@@ -170,7 +175,7 @@ describe('validateZapRequest', () => {
|
||||
privateKey
|
||||
)
|
||||
|
||||
expect(nip57.validateZapRequest(JSON.stringify(zapRequest))).toBe(
|
||||
expect(validateZapRequest(JSON.stringify(zapRequest))).toBe(
|
||||
"Zap request doesn't have a 'p' tag."
|
||||
)
|
||||
})
|
||||
@@ -192,7 +197,7 @@ describe('validateZapRequest', () => {
|
||||
privateKey
|
||||
)
|
||||
|
||||
expect(nip57.validateZapRequest(JSON.stringify(zapRequest))).toBe(
|
||||
expect(validateZapRequest(JSON.stringify(zapRequest))).toBe(
|
||||
"Zap request 'p' tag is not valid hex."
|
||||
)
|
||||
})
|
||||
@@ -216,7 +221,7 @@ describe('validateZapRequest', () => {
|
||||
privateKey
|
||||
)
|
||||
|
||||
expect(nip57.validateZapRequest(JSON.stringify(zapRequest))).toBe(
|
||||
expect(validateZapRequest(JSON.stringify(zapRequest))).toBe(
|
||||
"Zap request 'e' tag is not valid hex."
|
||||
)
|
||||
})
|
||||
@@ -238,7 +243,7 @@ describe('validateZapRequest', () => {
|
||||
privateKey
|
||||
)
|
||||
|
||||
expect(nip57.validateZapRequest(JSON.stringify(zapRequest))).toBe(
|
||||
expect(validateZapRequest(JSON.stringify(zapRequest))).toBe(
|
||||
"Zap request doesn't have a 'relays' tag."
|
||||
)
|
||||
})
|
||||
@@ -261,7 +266,7 @@ describe('validateZapRequest', () => {
|
||||
privateKey
|
||||
)
|
||||
|
||||
expect(nip57.validateZapRequest(JSON.stringify(zapRequest))).toBeNull()
|
||||
expect(validateZapRequest(JSON.stringify(zapRequest))).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -289,7 +294,7 @@ describe('makeZapReceipt', () => {
|
||||
const bolt11 = 'bolt11'
|
||||
const paidAt = new Date()
|
||||
|
||||
const result = nip57.makeZapReceipt({zapRequest, preimage, bolt11, paidAt})
|
||||
const result = makeZapReceipt({zapRequest, preimage, bolt11, paidAt})
|
||||
|
||||
expect(result.kind).toBe(9735)
|
||||
expect(result.created_at).toBeCloseTo(paidAt.getTime() / 1000, 0)
|
||||
@@ -322,7 +327,7 @@ describe('makeZapReceipt', () => {
|
||||
const bolt11 = 'bolt11'
|
||||
const paidAt = new Date()
|
||||
|
||||
const result = nip57.makeZapReceipt({zapRequest, bolt11, paidAt})
|
||||
const result = makeZapReceipt({zapRequest, bolt11, paidAt})
|
||||
|
||||
expect(result.kind).toBe(9735)
|
||||
expect(result.created_at).toBeCloseTo(paidAt.getTime() / 1000, 0)
|
||||
27
nip57.ts
27
nip57.ts
@@ -1,7 +1,13 @@
|
||||
import {bech32} from '@scure/base'
|
||||
|
||||
import {Event, EventTemplate, validateEvent, verifySignature} from './event'
|
||||
import {utf8Decoder} from './utils'
|
||||
import {
|
||||
Kind,
|
||||
validateEvent,
|
||||
verifySignature,
|
||||
type Event,
|
||||
type EventTemplate,
|
||||
} from './event.ts'
|
||||
import {utf8Decoder} from './utils.ts'
|
||||
|
||||
var _fetch: any
|
||||
|
||||
@@ -13,7 +19,9 @@ export function useFetchImplementation(fetchImplementation: any) {
|
||||
_fetch = fetchImplementation
|
||||
}
|
||||
|
||||
export async function getZapEndpoint(metadata: Event): Promise<null | string> {
|
||||
export async function getZapEndpoint(
|
||||
metadata: Event<Kind.Metadata>
|
||||
): Promise<null | string> {
|
||||
try {
|
||||
let lnurl: string = ''
|
||||
let {lud06, lud16} = JSON.parse(metadata.content)
|
||||
@@ -53,11 +61,11 @@ export function makeZapRequest({
|
||||
amount: number
|
||||
comment: string
|
||||
relays: string[]
|
||||
}): EventTemplate {
|
||||
}): EventTemplate<Kind.ZapRequest> {
|
||||
if (!amount) throw new Error('amount not given')
|
||||
if (!profile) throw new Error('profile not given')
|
||||
|
||||
let zr = {
|
||||
let zr: EventTemplate<Kind.ZapRequest> = {
|
||||
kind: 9734,
|
||||
created_at: Math.round(Date.now() / 1000),
|
||||
content: comment,
|
||||
@@ -86,6 +94,7 @@ export function validateZapRequest(zapRequestString: string): string | null {
|
||||
|
||||
if (!validateEvent(zapRequest))
|
||||
return 'Zap request is not a valid Nostr event.'
|
||||
|
||||
if (!verifySignature(zapRequest)) return 'Invalid signature on zap request.'
|
||||
|
||||
let p = zapRequest.tags.find(([t, v]) => t === 'p' && v)
|
||||
@@ -110,16 +119,16 @@ export function makeZapReceipt({
|
||||
paidAt
|
||||
}: {
|
||||
zapRequest: string
|
||||
preimage: string | null
|
||||
preimage?: string
|
||||
bolt11: string
|
||||
paidAt: Date
|
||||
}): EventTemplate {
|
||||
let zr: Event = JSON.parse(zapRequest)
|
||||
}): EventTemplate<Kind.Zap> {
|
||||
let zr: Event<Kind.ZapRequest> = JSON.parse(zapRequest)
|
||||
let tagsFromZapRequest = zr.tags.filter(
|
||||
([t]) => t === 'e' || t === 'p' || t === 'a'
|
||||
)
|
||||
|
||||
let zap = {
|
||||
let zap: EventTemplate<Kind.Zap> = {
|
||||
kind: 9735,
|
||||
created_at: Math.round(paidAt.getTime() / 1000),
|
||||
content: '',
|
||||
|
||||
26
package.json
26
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nostr-tools",
|
||||
"version": "1.10.1",
|
||||
"version": "1.11.1",
|
||||
"description": "Tools for making a Nostr client.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -14,15 +14,16 @@
|
||||
"module": "lib/esm/nostr.mjs",
|
||||
"exports": {
|
||||
"import": "./lib/esm/nostr.mjs",
|
||||
"require": "./lib/nostr.cjs.js"
|
||||
"require": "./lib/nostr.cjs.js",
|
||||
"types": "./lib/index.d.ts"
|
||||
},
|
||||
"license": "Unlicense",
|
||||
"dependencies": {
|
||||
"@noble/hashes": "1.2.0",
|
||||
"@noble/secp256k1": "1.7.1",
|
||||
"@noble/curves": "1.0.0",
|
||||
"@noble/hashes": "1.3.0",
|
||||
"@scure/base": "1.1.1",
|
||||
"@scure/bip32": "1.1.4",
|
||||
"@scure/bip39": "1.1.1"
|
||||
"@scure/bip32": "1.3.0",
|
||||
"@scure/bip39": "1.2.0"
|
||||
},
|
||||
"keywords": [
|
||||
"decentralization",
|
||||
@@ -34,24 +35,27 @@
|
||||
"scripts": {
|
||||
"build": "node build",
|
||||
"format": "prettier --plugin-search-dir . --write .",
|
||||
"test": "node build && jest"
|
||||
"test": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.1",
|
||||
"@types/node": "^18.13.0",
|
||||
"@types/node-fetch": "^2.6.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.51.0",
|
||||
"@typescript-eslint/parser": "^5.51.0",
|
||||
"esbuild": "0.16.9",
|
||||
"esbuild-plugin-alias": "^0.2.1",
|
||||
"eslint": "^8.33.0",
|
||||
"eslint": "^8.40.0",
|
||||
"eslint-plugin-babel": "^5.3.1",
|
||||
"eslint-plugin-jest": "^27.2.1",
|
||||
"esm-loader-typescript": "^1.0.3",
|
||||
"events": "^3.3.0",
|
||||
"jest": "^29.4.2",
|
||||
"jest": "^29.5.0",
|
||||
"node-fetch": "^2.6.9",
|
||||
"prettier": "^2.8.4",
|
||||
"ts-jest": "^29.0.5",
|
||||
"ts-jest": "^29.1.0",
|
||||
"tsd": "^0.22.0",
|
||||
"typescript": "^4.9.5",
|
||||
"typescript": "^5.0.4",
|
||||
"websocket-polyfill": "^0.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
/* eslint-env jest */
|
||||
import 'websocket-polyfill'
|
||||
|
||||
require('websocket-polyfill')
|
||||
const {
|
||||
SimplePool,
|
||||
generatePrivateKey,
|
||||
getPublicKey,
|
||||
getEventHash,
|
||||
signEvent
|
||||
} = require('./lib/nostr.cjs')
|
||||
import {finishEvent, type Event} from './event.ts'
|
||||
import {generatePrivateKey, getPublicKey} from './keys.ts'
|
||||
import {SimplePool} from './pool.ts'
|
||||
|
||||
let pool = new SimplePool()
|
||||
|
||||
@@ -33,7 +28,7 @@ test('removing duplicates when querying', async () => {
|
||||
let pub = getPublicKey(priv)
|
||||
|
||||
let sub = pool.sub(relays, [{authors: [pub]}])
|
||||
let received = []
|
||||
let received: Event[] = []
|
||||
|
||||
sub.on('event', event => {
|
||||
// this should be called only once even though we're listening
|
||||
@@ -42,15 +37,12 @@ test('removing duplicates when querying', async () => {
|
||||
received.push(event)
|
||||
})
|
||||
|
||||
let event = {
|
||||
pubkey: pub,
|
||||
let event = finishEvent({
|
||||
created_at: Math.round(Date.now() / 1000),
|
||||
content: 'test',
|
||||
kind: 22345,
|
||||
tags: []
|
||||
}
|
||||
event.id = getEventHash(event)
|
||||
event.sig = signEvent(event, priv)
|
||||
}, priv)
|
||||
|
||||
pool.publish(relays, event)
|
||||
|
||||
@@ -66,7 +58,7 @@ test('same with double querying', async () => {
|
||||
let sub1 = pool.sub(relays, [{authors: [pub]}])
|
||||
let sub2 = pool.sub(relays, [{authors: [pub]}])
|
||||
|
||||
let received = []
|
||||
let received: Event[] = []
|
||||
|
||||
sub1.on('event', event => {
|
||||
received.push(event)
|
||||
@@ -76,15 +68,12 @@ test('same with double querying', async () => {
|
||||
received.push(event)
|
||||
})
|
||||
|
||||
let event = {
|
||||
pubkey: pub,
|
||||
let event = finishEvent({
|
||||
created_at: Math.round(Date.now() / 1000),
|
||||
content: 'test2',
|
||||
kind: 22346,
|
||||
tags: []
|
||||
}
|
||||
event.id = getEventHash(event)
|
||||
event.sig = signEvent(event, priv)
|
||||
}, priv)
|
||||
|
||||
pool.publish(relays, event)
|
||||
|
||||
@@ -122,6 +111,7 @@ test('list()', async () => {
|
||||
expect(events.length).toEqual(
|
||||
events
|
||||
.map(evt => evt.id)
|
||||
// @ts-ignore ???
|
||||
.reduce((acc, n) => (acc.indexOf(n) !== -1 ? acc : [...acc, n]), [])
|
||||
.length
|
||||
)
|
||||
39
pool.ts
39
pool.ts
@@ -1,9 +1,14 @@
|
||||
import {Relay, relayInit} from './relay'
|
||||
import {normalizeURL} from './utils'
|
||||
import {Filter} from './filter'
|
||||
import {Event} from './event'
|
||||
import {SubscriptionOptions, Sub, Pub, CountPayload} from './relay'
|
||||
import {
|
||||
relayInit,
|
||||
type Pub,
|
||||
type Relay,
|
||||
type Sub,
|
||||
type SubscriptionOptions,
|
||||
} from './relay.ts'
|
||||
import {normalizeURL} from './utils.ts'
|
||||
|
||||
import type {Event} from './event.ts'
|
||||
import type {Filter} from './filter.ts'
|
||||
export class SimplePool {
|
||||
private _conn: {[url: string]: Relay}
|
||||
private _seenOn: {[id: string]: Set<string>} = {} // a map of all events we've seen in each relay
|
||||
@@ -39,7 +44,7 @@ export class SimplePool {
|
||||
return relay
|
||||
}
|
||||
|
||||
sub(relays: string[], filters: Filter[], opts?: SubscriptionOptions): Sub {
|
||||
sub<K extends number = number>(relays: string[], filters: Filter<K>[], opts?: SubscriptionOptions): Sub<K> {
|
||||
let _knownIds: Set<string> = new Set()
|
||||
let modifiedOpts = {...(opts || {})}
|
||||
modifiedOpts.alreadyHaveEvent = (id, url) => {
|
||||
@@ -73,7 +78,7 @@ export class SimplePool {
|
||||
}
|
||||
if (!r) return
|
||||
let s = r.sub(filters, modifiedOpts)
|
||||
s.on('event', (event: Event) => {
|
||||
s.on('event', (event) => {
|
||||
_knownIds.add(event.id as string)
|
||||
for (let cb of eventListeners.values()) cb(event)
|
||||
})
|
||||
@@ -118,18 +123,18 @@ export class SimplePool {
|
||||
return greaterSub
|
||||
}
|
||||
|
||||
get(
|
||||
get<K extends number = number>(
|
||||
relays: string[],
|
||||
filter: Filter,
|
||||
filter: Filter<K>,
|
||||
opts?: SubscriptionOptions
|
||||
): Promise<Event | null> {
|
||||
): Promise<Event<K> | null> {
|
||||
return new Promise(resolve => {
|
||||
let sub = this.sub(relays, [filter], opts)
|
||||
let timeout = setTimeout(() => {
|
||||
sub.unsub()
|
||||
resolve(null)
|
||||
}, this.getTimeout)
|
||||
sub.on('event', (event: Event) => {
|
||||
sub.on('event', (event) => {
|
||||
resolve(event)
|
||||
clearTimeout(timeout)
|
||||
sub.unsub()
|
||||
@@ -137,16 +142,16 @@ export class SimplePool {
|
||||
})
|
||||
}
|
||||
|
||||
list(
|
||||
list<K extends number = number>(
|
||||
relays: string[],
|
||||
filters: Filter[],
|
||||
filters: Filter<K>[],
|
||||
opts?: SubscriptionOptions
|
||||
): Promise<Event[]> {
|
||||
): Promise<Event<K>[]> {
|
||||
return new Promise(resolve => {
|
||||
let events: Event[] = []
|
||||
let events: Event<K>[] = []
|
||||
let sub = this.sub(relays, filters, opts)
|
||||
|
||||
sub.on('event', (event: Event) => {
|
||||
sub.on('event', (event) => {
|
||||
events.push(event)
|
||||
})
|
||||
|
||||
@@ -158,7 +163,7 @@ export class SimplePool {
|
||||
})
|
||||
}
|
||||
|
||||
publish(relays: string[], event: Event): Pub {
|
||||
publish(relays: string[], event: Event<number>): Pub {
|
||||
const pubPromises: Promise<Pub>[] = relays.map(async relay => {
|
||||
let r
|
||||
try {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
const {parseReferences} = require('./lib/nostr.cjs')
|
||||
import {parseReferences} from './references.ts'
|
||||
import {buildEvent} from './test-helpers.ts'
|
||||
|
||||
test('parse mentions', () => {
|
||||
let evt = {
|
||||
let evt = buildEvent({
|
||||
tags: [
|
||||
[
|
||||
'p',
|
||||
@@ -23,8 +22,8 @@ test('parse mentions', () => {
|
||||
]
|
||||
],
|
||||
content:
|
||||
'hello #[0], have you seen #[2]? it was made by nostr:nprofile1qqsvc6ulagpn7kwrcwdqgp797xl7usumqa6s3kgcelwq6m75x8fe8yc5usxdg on nostr:nevent1qqsvc6ulagpn7kwrcwdqgp797xl7usumqa6s3kgcelwq6m75x8fe8ychxp5v4! broken #[3]'
|
||||
}
|
||||
'hello #[0], have you seen #[2]? it was made by nostr:nprofile1qqsvc6ulagpn7kwrcwdqgp797xl7usumqa6s3kgcelwq6m75x8fe8yc5usxdg on nostr:nevent1qqsvc6ulagpn7kwrcwdqgp797xl7usumqa6s3kgcelwq6m75x8fe8ychxp5v4! broken #[3]',
|
||||
})
|
||||
|
||||
expect(parseReferences(evt)).toEqual([
|
||||
{
|
||||
@@ -1,5 +1,11 @@
|
||||
import {Event} from './event'
|
||||
import {decode, AddressPointer, ProfilePointer, EventPointer} from './nip19'
|
||||
import {
|
||||
decode,
|
||||
type AddressPointer,
|
||||
type ProfilePointer,
|
||||
type EventPointer,
|
||||
} from './nip19.ts'
|
||||
|
||||
import type {Event} from './event.ts'
|
||||
|
||||
type Reference = {
|
||||
text: string
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
/* eslint-env jest */
|
||||
import 'websocket-polyfill'
|
||||
|
||||
require('websocket-polyfill')
|
||||
const {
|
||||
relayInit,
|
||||
generatePrivateKey,
|
||||
getPublicKey,
|
||||
getEventHash,
|
||||
signEvent
|
||||
} = require('./lib/nostr.cjs')
|
||||
import {finishEvent} from './event.ts'
|
||||
import {generatePrivateKey, getPublicKey} from './keys.ts'
|
||||
import {relayInit} from './relay.ts'
|
||||
|
||||
let relay = relayInit('wss://relay.damus.io/')
|
||||
|
||||
@@ -33,8 +28,8 @@ test('connectivity', () => {
|
||||
})
|
||||
|
||||
test('querying', async () => {
|
||||
var resolve1
|
||||
var resolve2
|
||||
var resolve1: (value: boolean) => void
|
||||
var resolve2: (value: boolean) => void
|
||||
|
||||
let sub = relay.sub([
|
||||
{
|
||||
@@ -53,10 +48,10 @@ test('querying', async () => {
|
||||
})
|
||||
|
||||
let [t1, t2] = await Promise.all([
|
||||
new Promise(resolve => {
|
||||
new Promise<boolean>(resolve => {
|
||||
resolve1 = resolve
|
||||
}),
|
||||
new Promise(resolve => {
|
||||
new Promise<boolean>(resolve => {
|
||||
resolve2 = resolve
|
||||
})
|
||||
])
|
||||
@@ -93,8 +88,8 @@ test('list()', async () => {
|
||||
test('listening (twice) and publishing', async () => {
|
||||
let sk = generatePrivateKey()
|
||||
let pk = getPublicKey(sk)
|
||||
var resolve1
|
||||
var resolve2
|
||||
var resolve1: (value: boolean) => void
|
||||
var resolve2: (value: boolean) => void
|
||||
|
||||
let sub = relay.sub([
|
||||
{
|
||||
@@ -116,15 +111,12 @@ test('listening (twice) and publishing', async () => {
|
||||
resolve2(true)
|
||||
})
|
||||
|
||||
let event = {
|
||||
let event = finishEvent({
|
||||
kind: 27572,
|
||||
pubkey: pk,
|
||||
created_at: Math.floor(Date.now() / 1000),
|
||||
tags: [],
|
||||
content: 'nostr-tools test suite'
|
||||
}
|
||||
event.id = getEventHash(event)
|
||||
event.sig = signEvent(event, sk)
|
||||
}, sk)
|
||||
|
||||
relay.publish(event)
|
||||
return expect(
|
||||
58
relay.ts
58
relay.ts
@@ -1,8 +1,8 @@
|
||||
/* global WebSocket */
|
||||
|
||||
import {Event, verifySignature, validateEvent} from './event'
|
||||
import {Filter, matchFilters} from './filter'
|
||||
import {getHex64, getSubscriptionId} from './fakejson'
|
||||
import {verifySignature, validateEvent, type Event} from './event.ts'
|
||||
import {matchFilters, type Filter} from './filter.ts'
|
||||
import {getHex64, getSubscriptionId} from './fakejson.ts'
|
||||
|
||||
type RelayEvent = {
|
||||
connect: () => void | Promise<void>
|
||||
@@ -14,8 +14,8 @@ type RelayEvent = {
|
||||
export type CountPayload = {
|
||||
count: number
|
||||
}
|
||||
type SubEvent = {
|
||||
event: (event: Event) => void | Promise<void>
|
||||
type SubEvent<K extends number> = {
|
||||
event: (event: Event<K>) => void | Promise<void>
|
||||
count: (payload: CountPayload) => void | Promise<void>
|
||||
eose: () => void | Promise<void>
|
||||
}
|
||||
@@ -24,15 +24,15 @@ export type Relay = {
|
||||
status: number
|
||||
connect: () => Promise<void>
|
||||
close: () => void
|
||||
sub: (filters: Filter[], opts?: SubscriptionOptions) => Sub
|
||||
list: (filters: Filter[], opts?: SubscriptionOptions) => Promise<Event[]>
|
||||
get: (filter: Filter, opts?: SubscriptionOptions) => Promise<Event | null>
|
||||
sub: <K extends number = number>(filters: Filter<K>[], opts?: SubscriptionOptions) => Sub<K>
|
||||
list: <K extends number = number>(filters: Filter<K>[], opts?: SubscriptionOptions) => Promise<Event<K>[]>
|
||||
get: <K extends number = number>(filter: Filter<K>, opts?: SubscriptionOptions) => Promise<Event<K> | null>
|
||||
count: (
|
||||
filters: Filter[],
|
||||
opts?: SubscriptionOptions
|
||||
) => Promise<CountPayload | null>
|
||||
publish: (event: Event) => Pub
|
||||
auth: (event: Event) => Pub
|
||||
publish: (event: Event<number>) => Pub
|
||||
auth: (event: Event<number>) => Pub
|
||||
off: <T extends keyof RelayEvent, U extends RelayEvent[T]>(
|
||||
event: T,
|
||||
listener: U
|
||||
@@ -46,14 +46,14 @@ export type Pub = {
|
||||
on: (type: 'ok' | 'failed', cb: any) => void
|
||||
off: (type: 'ok' | 'failed', cb: any) => void
|
||||
}
|
||||
export type Sub = {
|
||||
sub: (filters: Filter[], opts: SubscriptionOptions) => Sub
|
||||
export type Sub<K extends number = number> = {
|
||||
sub: <K extends number = number>(filters: Filter<K>[], opts: SubscriptionOptions) => Sub<K>
|
||||
unsub: () => void
|
||||
on: <T extends keyof SubEvent, U extends SubEvent[T]>(
|
||||
on: <T extends keyof SubEvent<K>, U extends SubEvent<K>[T]>(
|
||||
event: T,
|
||||
listener: U
|
||||
) => void
|
||||
off: <T extends keyof SubEvent, U extends SubEvent[T]>(
|
||||
off: <T extends keyof SubEvent<K>, U extends SubEvent<K>[T]>(
|
||||
event: T,
|
||||
listener: U
|
||||
) => void
|
||||
@@ -88,7 +88,7 @@ export function relayInit(
|
||||
var openSubs: {[id: string]: {filters: Filter[]} & SubscriptionOptions} = {}
|
||||
var listeners = newListeners()
|
||||
var subListeners: {
|
||||
[subid: string]: {[TK in keyof SubEvent]: SubEvent[TK][]}
|
||||
[subid: string]: {[TK in keyof SubEvent<any>]: SubEvent<any>[TK][]}
|
||||
} = {}
|
||||
var pubListeners: {
|
||||
[eventid: string]: {
|
||||
@@ -245,15 +245,15 @@ export function relayInit(
|
||||
}
|
||||
}
|
||||
|
||||
const sub = (
|
||||
filters: Filter[],
|
||||
const sub = <K extends number = number>(
|
||||
filters: Filter<K>[],
|
||||
{
|
||||
verb = 'REQ',
|
||||
skipVerification = false,
|
||||
alreadyHaveEvent = null,
|
||||
id = Math.random().toString().slice(2)
|
||||
}: SubscriptionOptions = {}
|
||||
): Sub => {
|
||||
): Sub<K> => {
|
||||
let subid = id
|
||||
|
||||
openSubs[subid] = {
|
||||
@@ -276,10 +276,7 @@ export function relayInit(
|
||||
delete subListeners[subid]
|
||||
trySend(['CLOSE', subid])
|
||||
},
|
||||
on: <T extends keyof SubEvent, U extends SubEvent[T]>(
|
||||
type: T,
|
||||
cb: U
|
||||
): void => {
|
||||
on: (type, cb) => {
|
||||
subListeners[subid] = subListeners[subid] || {
|
||||
event: [],
|
||||
count: [],
|
||||
@@ -287,10 +284,7 @@ export function relayInit(
|
||||
}
|
||||
subListeners[subid][type].push(cb)
|
||||
},
|
||||
off: <T extends keyof SubEvent, U extends SubEvent[T]>(
|
||||
type: T,
|
||||
cb: U
|
||||
): void => {
|
||||
off: (type, cb): void => {
|
||||
let listeners = subListeners[subid]
|
||||
let idx = listeners[type].indexOf(cb)
|
||||
if (idx >= 0) listeners[type].splice(idx, 1)
|
||||
@@ -298,7 +292,7 @@ export function relayInit(
|
||||
}
|
||||
}
|
||||
|
||||
function _publishEvent(event: Event, type: string) {
|
||||
function _publishEvent(event: Event<number>, type: string) {
|
||||
if (!event.id) throw new Error(`event ${event} has no id`)
|
||||
let id = event.id
|
||||
|
||||
@@ -341,10 +335,10 @@ export function relayInit(
|
||||
let index = listeners[type].indexOf(cb)
|
||||
if (index !== -1) listeners[type].splice(index, 1)
|
||||
},
|
||||
list: (filters: Filter[], opts?: SubscriptionOptions): Promise<Event[]> =>
|
||||
list: (filters, opts?: SubscriptionOptions) =>
|
||||
new Promise(resolve => {
|
||||
let s = sub(filters, opts)
|
||||
let events: Event[] = []
|
||||
let events: Event<any>[] = []
|
||||
let timeout = setTimeout(() => {
|
||||
s.unsub()
|
||||
resolve(events)
|
||||
@@ -354,18 +348,18 @@ export function relayInit(
|
||||
clearTimeout(timeout)
|
||||
resolve(events)
|
||||
})
|
||||
s.on('event', (event: Event) => {
|
||||
s.on('event', (event) => {
|
||||
events.push(event)
|
||||
})
|
||||
}),
|
||||
get: (filter: Filter, opts?: SubscriptionOptions): Promise<Event | null> =>
|
||||
get: (filter, opts?: SubscriptionOptions) =>
|
||||
new Promise(resolve => {
|
||||
let s = sub([filter], opts)
|
||||
let timeout = setTimeout(() => {
|
||||
s.unsub()
|
||||
resolve(null)
|
||||
}, getTimeout)
|
||||
s.on('event', (event: Event) => {
|
||||
s.on('event', (event) => {
|
||||
s.unsub()
|
||||
clearTimeout(timeout)
|
||||
resolve(event)
|
||||
|
||||
17
test-helpers.ts
Normal file
17
test-helpers.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type {Event} from './event.ts'
|
||||
|
||||
type EventParams<K extends number> = Partial<Event<K>>
|
||||
|
||||
/** Build an event for testing purposes. */
|
||||
export function buildEvent<K extends number = 1>(params: EventParams<K>): Event<K> {
|
||||
return {
|
||||
id: '',
|
||||
kind: 1 as K,
|
||||
pubkey: '',
|
||||
created_at: 0,
|
||||
content: '',
|
||||
tags: [],
|
||||
sig: '',
|
||||
...params
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
"esModuleInterop": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"outDir": "lib",
|
||||
"rootDir": "."
|
||||
"rootDir": ".",
|
||||
"allowImportingTsExtensions": true
|
||||
}
|
||||
}
|
||||
|
||||
183
utils.test.js
183
utils.test.js
@@ -1,183 +0,0 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
const {utils} = require('./lib/nostr.cjs')
|
||||
|
||||
const {insertEventIntoAscendingList, insertEventIntoDescendingList} = utils
|
||||
|
||||
describe('inserting into a desc sorted list of events', () => {
|
||||
test('insert into an empty list', async () => {
|
||||
const list0 = []
|
||||
expect(
|
||||
insertEventIntoDescendingList(list0, {id: 'abc', created_at: 10})
|
||||
).toHaveLength(1)
|
||||
})
|
||||
|
||||
test('insert in the beginning of a list', async () => {
|
||||
const list0 = [{created_at: 20}, {created_at: 10}]
|
||||
const list1 = insertEventIntoDescendingList(list0, {
|
||||
id: 'abc',
|
||||
created_at: 30
|
||||
})
|
||||
expect(list1).toHaveLength(3)
|
||||
expect(list1[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the beginning of a list with same created_at', async () => {
|
||||
const list0 = [{created_at: 30}, {created_at: 20}, {created_at: 10}]
|
||||
const list1 = insertEventIntoDescendingList(list0, {
|
||||
id: 'abc',
|
||||
created_at: 30
|
||||
})
|
||||
expect(list1).toHaveLength(4)
|
||||
expect(list1[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the middle of a list', async () => {
|
||||
const list0 = [
|
||||
{created_at: 30},
|
||||
{created_at: 20},
|
||||
{created_at: 10},
|
||||
{created_at: 1}
|
||||
]
|
||||
const list1 = insertEventIntoDescendingList(list0, {
|
||||
id: 'abc',
|
||||
created_at: 15
|
||||
})
|
||||
expect(list1).toHaveLength(5)
|
||||
expect(list1[2].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the end of a list', async () => {
|
||||
const list0 = [
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 10}
|
||||
]
|
||||
const list1 = insertEventIntoDescendingList(list0, {
|
||||
id: 'abc',
|
||||
created_at: 5
|
||||
})
|
||||
expect(list1).toHaveLength(6)
|
||||
expect(list1.slice(-1)[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the last-to-end of a list with same created_at', async () => {
|
||||
const list0 = [
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 10}
|
||||
]
|
||||
const list1 = insertEventIntoDescendingList(list0, {
|
||||
id: 'abc',
|
||||
created_at: 10
|
||||
})
|
||||
expect(list1).toHaveLength(6)
|
||||
expect(list1.slice(-2)[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('do not insert duplicates', async () => {
|
||||
const list0 = [
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 10, id: 'abc'}
|
||||
]
|
||||
const list1 = insertEventIntoDescendingList(list0, {
|
||||
id: 'abc',
|
||||
created_at: 10
|
||||
})
|
||||
expect(list1).toHaveLength(3)
|
||||
})
|
||||
})
|
||||
|
||||
describe('inserting into a asc sorted list of events', () => {
|
||||
test('insert into an empty list', async () => {
|
||||
const list0 = []
|
||||
expect(
|
||||
insertEventIntoAscendingList(list0, {id: 'abc', created_at: 10})
|
||||
).toHaveLength(1)
|
||||
})
|
||||
|
||||
test('insert in the beginning of a list', async () => {
|
||||
const list0 = [{created_at: 10}, {created_at: 20}]
|
||||
const list1 = insertEventIntoAscendingList(list0, {
|
||||
id: 'abc',
|
||||
created_at: 1
|
||||
})
|
||||
expect(list1).toHaveLength(3)
|
||||
expect(list1[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the beginning of a list with same created_at', async () => {
|
||||
const list0 = [{created_at: 10}, {created_at: 20}, {created_at: 30}]
|
||||
const list1 = insertEventIntoAscendingList(list0, {
|
||||
id: 'abc',
|
||||
created_at: 10
|
||||
})
|
||||
expect(list1).toHaveLength(4)
|
||||
expect(list1[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the middle of a list', async () => {
|
||||
const list0 = [
|
||||
{created_at: 10},
|
||||
{created_at: 20},
|
||||
{created_at: 30},
|
||||
{created_at: 40}
|
||||
]
|
||||
const list1 = insertEventIntoAscendingList(list0, {
|
||||
id: 'abc',
|
||||
created_at: 25
|
||||
})
|
||||
expect(list1).toHaveLength(5)
|
||||
expect(list1[2].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the end of a list', async () => {
|
||||
const list0 = [
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 40}
|
||||
]
|
||||
const list1 = insertEventIntoAscendingList(list0, {
|
||||
id: 'abc',
|
||||
created_at: 50
|
||||
})
|
||||
expect(list1).toHaveLength(6)
|
||||
expect(list1.slice(-1)[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the last-to-end of a list with same created_at', async () => {
|
||||
const list0 = [
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 30}
|
||||
]
|
||||
const list1 = insertEventIntoAscendingList(list0, {
|
||||
id: 'abc',
|
||||
created_at: 30
|
||||
})
|
||||
expect(list1).toHaveLength(6)
|
||||
expect(list1.slice(-2)[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('do not insert duplicates', async () => {
|
||||
const list0 = [
|
||||
{created_at: 20},
|
||||
{created_at: 20},
|
||||
{created_at: 30, id: 'abc'}
|
||||
]
|
||||
const list1 = insertEventIntoAscendingList(list0, {
|
||||
id: 'abc',
|
||||
created_at: 30
|
||||
})
|
||||
expect(list1).toHaveLength(3)
|
||||
})
|
||||
})
|
||||
193
utils.test.ts
Normal file
193
utils.test.ts
Normal file
@@ -0,0 +1,193 @@
|
||||
import {buildEvent} from './test-helpers.ts'
|
||||
import {
|
||||
insertEventIntoAscendingList,
|
||||
insertEventIntoDescendingList,
|
||||
} from './utils.ts'
|
||||
|
||||
import type {Event} from './event.ts'
|
||||
|
||||
describe('inserting into a desc sorted list of events', () => {
|
||||
test('insert into an empty list', async () => {
|
||||
const list0: Event[] = []
|
||||
expect(
|
||||
insertEventIntoDescendingList(list0, buildEvent({id: 'abc', created_at: 10}))
|
||||
).toHaveLength(1)
|
||||
})
|
||||
|
||||
test('insert in the beginning of a list', async () => {
|
||||
const list0 = [buildEvent({created_at: 20}), buildEvent({created_at: 10})]
|
||||
const list1 = insertEventIntoDescendingList(list0, buildEvent({
|
||||
id: 'abc',
|
||||
created_at: 30
|
||||
}))
|
||||
expect(list1).toHaveLength(3)
|
||||
expect(list1[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the beginning of a list with same created_at', async () => {
|
||||
const list0 = [
|
||||
buildEvent({created_at: 30}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 10}),
|
||||
]
|
||||
const list1 = insertEventIntoDescendingList(list0, buildEvent({
|
||||
id: 'abc',
|
||||
created_at: 30
|
||||
}))
|
||||
expect(list1).toHaveLength(4)
|
||||
expect(list1[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the middle of a list', async () => {
|
||||
const list0 = [
|
||||
buildEvent({created_at: 30}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 10}),
|
||||
buildEvent({created_at: 1}),
|
||||
]
|
||||
const list1 = insertEventIntoDescendingList(list0, buildEvent({
|
||||
id: 'abc',
|
||||
created_at: 15
|
||||
}))
|
||||
expect(list1).toHaveLength(5)
|
||||
expect(list1[2].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the end of a list', async () => {
|
||||
const list0 = [
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 10}),
|
||||
]
|
||||
const list1 = insertEventIntoDescendingList(list0, buildEvent({
|
||||
id: 'abc',
|
||||
created_at: 5
|
||||
}))
|
||||
expect(list1).toHaveLength(6)
|
||||
expect(list1.slice(-1)[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the last-to-end of a list with same created_at', async () => {
|
||||
const list0: Event[] = [
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 10}),
|
||||
]
|
||||
const list1 = insertEventIntoDescendingList(list0, buildEvent({
|
||||
id: 'abc',
|
||||
created_at: 10
|
||||
}))
|
||||
expect(list1).toHaveLength(6)
|
||||
expect(list1.slice(-2)[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('do not insert duplicates', async () => {
|
||||
const list0 = [
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 10, id: 'abc'}),
|
||||
]
|
||||
const list1 = insertEventIntoDescendingList(list0, buildEvent({
|
||||
id: 'abc',
|
||||
created_at: 10
|
||||
}))
|
||||
expect(list1).toHaveLength(3)
|
||||
})
|
||||
})
|
||||
|
||||
describe('inserting into a asc sorted list of events', () => {
|
||||
test('insert into an empty list', async () => {
|
||||
const list0: Event[] = []
|
||||
expect(
|
||||
insertEventIntoAscendingList(list0, buildEvent({id: 'abc', created_at: 10}))
|
||||
).toHaveLength(1)
|
||||
})
|
||||
|
||||
test('insert in the beginning of a list', async () => {
|
||||
const list0 = [buildEvent({created_at: 10}), buildEvent({created_at: 20})]
|
||||
const list1 = insertEventIntoAscendingList(list0, buildEvent({
|
||||
id: 'abc',
|
||||
created_at: 1
|
||||
}))
|
||||
expect(list1).toHaveLength(3)
|
||||
expect(list1[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the beginning of a list with same created_at', async () => {
|
||||
const list0 = [
|
||||
buildEvent({created_at: 10}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 30}),
|
||||
]
|
||||
const list1 = insertEventIntoAscendingList(list0, buildEvent({
|
||||
id: 'abc',
|
||||
created_at: 10
|
||||
}))
|
||||
expect(list1).toHaveLength(4)
|
||||
expect(list1[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the middle of a list', async () => {
|
||||
const list0 = [
|
||||
buildEvent({created_at: 10}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 30}),
|
||||
buildEvent({created_at: 40}),
|
||||
]
|
||||
const list1 = insertEventIntoAscendingList(list0, buildEvent({
|
||||
id: 'abc',
|
||||
created_at: 25
|
||||
}))
|
||||
expect(list1).toHaveLength(5)
|
||||
expect(list1[2].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the end of a list', async () => {
|
||||
const list0 = [
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 40}),
|
||||
]
|
||||
const list1 = insertEventIntoAscendingList(list0, buildEvent({
|
||||
id: 'abc',
|
||||
created_at: 50
|
||||
}))
|
||||
expect(list1).toHaveLength(6)
|
||||
expect(list1.slice(-1)[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('insert in the last-to-end of a list with same created_at', async () => {
|
||||
const list0 = [
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 30}),
|
||||
]
|
||||
const list1 = insertEventIntoAscendingList(list0, buildEvent({
|
||||
id: 'abc',
|
||||
created_at: 30
|
||||
}))
|
||||
expect(list1).toHaveLength(6)
|
||||
expect(list1.slice(-2)[0].id).toBe('abc')
|
||||
})
|
||||
|
||||
test('do not insert duplicates', async () => {
|
||||
const list0 = [
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 20}),
|
||||
buildEvent({created_at: 30, id: 'abc'}),
|
||||
]
|
||||
const list1 = insertEventIntoAscendingList(list0, buildEvent({
|
||||
id: 'abc',
|
||||
created_at: 30
|
||||
}))
|
||||
expect(list1).toHaveLength(3)
|
||||
})
|
||||
})
|
||||
10
utils.ts
10
utils.ts
@@ -1,4 +1,4 @@
|
||||
import {Event} from './event'
|
||||
import type {Event} from './event.ts'
|
||||
|
||||
export const utf8Decoder = new TextDecoder('utf-8')
|
||||
export const utf8Encoder = new TextEncoder()
|
||||
@@ -21,8 +21,8 @@ export function normalizeURL(url: string): string {
|
||||
// fast insert-into-sorted-array functions adapted from https://github.com/terrymorse58/fast-sorted-array
|
||||
//
|
||||
export function insertEventIntoDescendingList(
|
||||
sortedArray: Event[],
|
||||
event: Event
|
||||
sortedArray: Event<number>[],
|
||||
event: Event<number>
|
||||
) {
|
||||
let start = 0
|
||||
let end = sortedArray.length - 1
|
||||
@@ -66,8 +66,8 @@ export function insertEventIntoDescendingList(
|
||||
}
|
||||
|
||||
export function insertEventIntoAscendingList(
|
||||
sortedArray: Event[],
|
||||
event: Event
|
||||
sortedArray: Event<number>[],
|
||||
event: Event<number>
|
||||
) {
|
||||
let start = 0
|
||||
let end = sortedArray.length - 1
|
||||
|
||||
533
yarn.lock
533
yarn.lock
@@ -17,57 +17,57 @@
|
||||
dependencies:
|
||||
"@babel/highlight" "^7.18.6"
|
||||
|
||||
"@babel/compat-data@^7.21.4":
|
||||
version "7.21.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.21.4.tgz#457ffe647c480dff59c2be092fc3acf71195c87f"
|
||||
integrity sha512-/DYyDpeCfaVinT40FPGdkkb+lYSKvsVuMjDAG7jPOWWiM1ibOaB9CXJAlc4d1QpP/U2q2P9jbrSlClKSErd55g==
|
||||
"@babel/compat-data@^7.21.5":
|
||||
version "7.21.7"
|
||||
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.21.7.tgz#61caffb60776e49a57ba61a88f02bedd8714f6bc"
|
||||
integrity sha512-KYMqFYTaenzMK4yUtf4EW9wc4N9ef80FsbMtkwool5zpwl4YrT1SdWYSTRcT94KO4hannogdS+LxY7L+arP3gA==
|
||||
|
||||
"@babel/core@^7.11.6", "@babel/core@^7.12.3":
|
||||
version "7.21.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.21.4.tgz#c6dc73242507b8e2a27fd13a9c1814f9fa34a659"
|
||||
integrity sha512-qt/YV149Jman/6AfmlxJ04LMIu8bMoyl3RB91yTFrxQmgbrSvQMy7cI8Q62FHx1t8wJ8B5fu0UDoLwHAhUo1QA==
|
||||
version "7.21.8"
|
||||
resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.21.8.tgz#2a8c7f0f53d60100ba4c32470ba0281c92aa9aa4"
|
||||
integrity sha512-YeM22Sondbo523Sz0+CirSPnbj9bG3P0CdHcBZdqUuaeOaYEFbOLoGU7lebvGP6P5J/WE9wOn7u7C4J9HvS1xQ==
|
||||
dependencies:
|
||||
"@ampproject/remapping" "^2.2.0"
|
||||
"@babel/code-frame" "^7.21.4"
|
||||
"@babel/generator" "^7.21.4"
|
||||
"@babel/helper-compilation-targets" "^7.21.4"
|
||||
"@babel/helper-module-transforms" "^7.21.2"
|
||||
"@babel/helpers" "^7.21.0"
|
||||
"@babel/parser" "^7.21.4"
|
||||
"@babel/generator" "^7.21.5"
|
||||
"@babel/helper-compilation-targets" "^7.21.5"
|
||||
"@babel/helper-module-transforms" "^7.21.5"
|
||||
"@babel/helpers" "^7.21.5"
|
||||
"@babel/parser" "^7.21.8"
|
||||
"@babel/template" "^7.20.7"
|
||||
"@babel/traverse" "^7.21.4"
|
||||
"@babel/types" "^7.21.4"
|
||||
"@babel/traverse" "^7.21.5"
|
||||
"@babel/types" "^7.21.5"
|
||||
convert-source-map "^1.7.0"
|
||||
debug "^4.1.0"
|
||||
gensync "^1.0.0-beta.2"
|
||||
json5 "^2.2.2"
|
||||
semver "^6.3.0"
|
||||
|
||||
"@babel/generator@^7.21.4", "@babel/generator@^7.7.2":
|
||||
version "7.21.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.21.4.tgz#64a94b7448989f421f919d5239ef553b37bb26bc"
|
||||
integrity sha512-NieM3pVIYW2SwGzKoqfPrQsf4xGs9M9AIG3ThppsSRmO+m7eQhmI6amajKMUeIO37wFfsvnvcxQFx6x6iqxDnA==
|
||||
"@babel/generator@^7.21.5", "@babel/generator@^7.7.2":
|
||||
version "7.21.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.21.5.tgz#c0c0e5449504c7b7de8236d99338c3e2a340745f"
|
||||
integrity sha512-SrKK/sRv8GesIW1bDagf9cCG38IOMYZusoe1dfg0D8aiUe3Amvoj1QtjTPAWcfrZFvIwlleLb0gxzQidL9w14w==
|
||||
dependencies:
|
||||
"@babel/types" "^7.21.4"
|
||||
"@babel/types" "^7.21.5"
|
||||
"@jridgewell/gen-mapping" "^0.3.2"
|
||||
"@jridgewell/trace-mapping" "^0.3.17"
|
||||
jsesc "^2.5.1"
|
||||
|
||||
"@babel/helper-compilation-targets@^7.21.4":
|
||||
version "7.21.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.21.4.tgz#770cd1ce0889097ceacb99418ee6934ef0572656"
|
||||
integrity sha512-Fa0tTuOXZ1iL8IeDFUWCzjZcn+sJGd9RZdH9esYVjEejGmzf+FFYQpMi/kZUk2kPy/q1H3/GPw7np8qar/stfg==
|
||||
"@babel/helper-compilation-targets@^7.21.5":
|
||||
version "7.21.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.21.5.tgz#631e6cc784c7b660417421349aac304c94115366"
|
||||
integrity sha512-1RkbFGUKex4lvsB9yhIfWltJM5cZKUftB2eNajaDv3dCMEp49iBG0K14uH8NnX9IPux2+mK7JGEOB0jn48/J6w==
|
||||
dependencies:
|
||||
"@babel/compat-data" "^7.21.4"
|
||||
"@babel/compat-data" "^7.21.5"
|
||||
"@babel/helper-validator-option" "^7.21.0"
|
||||
browserslist "^4.21.3"
|
||||
lru-cache "^5.1.1"
|
||||
semver "^6.3.0"
|
||||
|
||||
"@babel/helper-environment-visitor@^7.18.9":
|
||||
version "7.18.9"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz#0c0cee9b35d2ca190478756865bb3528422f51be"
|
||||
integrity sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==
|
||||
"@babel/helper-environment-visitor@^7.21.5":
|
||||
version "7.21.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-environment-visitor/-/helper-environment-visitor-7.21.5.tgz#c769afefd41d171836f7cb63e295bedf689d48ba"
|
||||
integrity sha512-IYl4gZ3ETsWocUWgsFZLM5i1BYx9SoemminVEXadgLBa9TdeorzgLKm8wWLA6J1N/kT3Kch8XIk1laNzYoHKvQ==
|
||||
|
||||
"@babel/helper-function-name@^7.21.0":
|
||||
version "7.21.0"
|
||||
@@ -84,38 +84,38 @@
|
||||
dependencies:
|
||||
"@babel/types" "^7.18.6"
|
||||
|
||||
"@babel/helper-module-imports@^7.18.6":
|
||||
"@babel/helper-module-imports@^7.21.4":
|
||||
version "7.21.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.21.4.tgz#ac88b2f76093637489e718a90cec6cf8a9b029af"
|
||||
integrity sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg==
|
||||
dependencies:
|
||||
"@babel/types" "^7.21.4"
|
||||
|
||||
"@babel/helper-module-transforms@^7.21.2":
|
||||
version "7.21.2"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz#160caafa4978ac8c00ac66636cb0fa37b024e2d2"
|
||||
integrity sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ==
|
||||
"@babel/helper-module-transforms@^7.21.5":
|
||||
version "7.21.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.21.5.tgz#d937c82e9af68d31ab49039136a222b17ac0b420"
|
||||
integrity sha512-bI2Z9zBGY2q5yMHoBvJ2a9iX3ZOAzJPm7Q8Yz6YeoUjU/Cvhmi2G4QyTNyPBqqXSgTjUxRg3L0xV45HvkNWWBw==
|
||||
dependencies:
|
||||
"@babel/helper-environment-visitor" "^7.18.9"
|
||||
"@babel/helper-module-imports" "^7.18.6"
|
||||
"@babel/helper-simple-access" "^7.20.2"
|
||||
"@babel/helper-environment-visitor" "^7.21.5"
|
||||
"@babel/helper-module-imports" "^7.21.4"
|
||||
"@babel/helper-simple-access" "^7.21.5"
|
||||
"@babel/helper-split-export-declaration" "^7.18.6"
|
||||
"@babel/helper-validator-identifier" "^7.19.1"
|
||||
"@babel/template" "^7.20.7"
|
||||
"@babel/traverse" "^7.21.2"
|
||||
"@babel/types" "^7.21.2"
|
||||
"@babel/traverse" "^7.21.5"
|
||||
"@babel/types" "^7.21.5"
|
||||
|
||||
"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.12.13", "@babel/helper-plugin-utils@^7.14.5", "@babel/helper-plugin-utils@^7.20.2", "@babel/helper-plugin-utils@^7.8.0":
|
||||
version "7.20.2"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz#d1b9000752b18d0877cff85a5c376ce5c3121629"
|
||||
integrity sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==
|
||||
version "7.21.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.21.5.tgz#345f2377d05a720a4e5ecfa39cbf4474a4daed56"
|
||||
integrity sha512-0WDaIlXKOX/3KfBK/dwP1oQGiPh6rjMkT7HIRv7i5RR2VUMwrx5ZL0dwBkKx7+SW1zwNdgjHd34IMk5ZjTeHVg==
|
||||
|
||||
"@babel/helper-simple-access@^7.20.2":
|
||||
version "7.20.2"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz#0ab452687fe0c2cfb1e2b9e0015de07fc2d62dd9"
|
||||
integrity sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==
|
||||
"@babel/helper-simple-access@^7.21.5":
|
||||
version "7.21.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.21.5.tgz#d697a7971a5c39eac32c7e63c0921c06c8a249ee"
|
||||
integrity sha512-ENPDAMC1wAjR0uaCUwliBdiSl1KBJAVnMTzXqi64c2MG8MPR6ii4qf7bSXDqSFbr4W6W028/rf5ivoHop5/mkg==
|
||||
dependencies:
|
||||
"@babel/types" "^7.20.2"
|
||||
"@babel/types" "^7.21.5"
|
||||
|
||||
"@babel/helper-split-export-declaration@^7.18.6":
|
||||
version "7.18.6"
|
||||
@@ -124,10 +124,10 @@
|
||||
dependencies:
|
||||
"@babel/types" "^7.18.6"
|
||||
|
||||
"@babel/helper-string-parser@^7.19.4":
|
||||
version "7.19.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz#38d3acb654b4701a9b77fb0615a96f775c3a9e63"
|
||||
integrity sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==
|
||||
"@babel/helper-string-parser@^7.21.5":
|
||||
version "7.21.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.21.5.tgz#2b3eea65443c6bdc31c22d037c65f6d323b6b2bd"
|
||||
integrity sha512-5pTUx3hAJaZIdW99sJ6ZUUgWq/Y+Hja7TowEnLNMm1VivRgZQL3vpBY3qUACVsvw+yQU6+YgfBVmcbLaZtrA1w==
|
||||
|
||||
"@babel/helper-validator-identifier@^7.18.6", "@babel/helper-validator-identifier@^7.19.1":
|
||||
version "7.19.1"
|
||||
@@ -139,14 +139,14 @@
|
||||
resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.21.0.tgz#8224c7e13ace4bafdc4004da2cf064ef42673180"
|
||||
integrity sha512-rmL/B8/f0mKS2baE9ZpyTcTavvEuWhTTW8amjzXNvYG4AwBsqTLikfXsEofsJEfKHf+HQVQbFOHy6o+4cnC/fQ==
|
||||
|
||||
"@babel/helpers@^7.21.0":
|
||||
version "7.21.0"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.21.0.tgz#9dd184fb5599862037917cdc9eecb84577dc4e7e"
|
||||
integrity sha512-XXve0CBtOW0pd7MRzzmoyuSj0e3SEzj8pgyFxnTT1NJZL38BD1MK7yYrm8yefRPIDvNNe14xR4FdbHwpInD4rA==
|
||||
"@babel/helpers@^7.21.5":
|
||||
version "7.21.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.21.5.tgz#5bac66e084d7a4d2d9696bdf0175a93f7fb63c08"
|
||||
integrity sha512-BSY+JSlHxOmGsPTydUkPf1MdMQ3M81x5xGCOVgWM3G8XH77sJ292Y2oqcp0CbbgxhqBuI46iUz1tT7hqP7EfgA==
|
||||
dependencies:
|
||||
"@babel/template" "^7.20.7"
|
||||
"@babel/traverse" "^7.21.0"
|
||||
"@babel/types" "^7.21.0"
|
||||
"@babel/traverse" "^7.21.5"
|
||||
"@babel/types" "^7.21.5"
|
||||
|
||||
"@babel/highlight@^7.18.6":
|
||||
version "7.18.6"
|
||||
@@ -157,10 +157,10 @@
|
||||
chalk "^2.0.0"
|
||||
js-tokens "^4.0.0"
|
||||
|
||||
"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.21.4":
|
||||
version "7.21.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.4.tgz#94003fdfc520bbe2875d4ae557b43ddb6d880f17"
|
||||
integrity sha512-alVJj7k7zIxqBZ7BTRhz0IqJFxW1VJbm6N8JbcYhQ186df9ZBPbZBmWSqAMXwHGsCJdYks7z/voa3ibiS5bCIw==
|
||||
"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.21.5", "@babel/parser@^7.21.8":
|
||||
version "7.21.8"
|
||||
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.21.8.tgz#642af7d0333eab9c0ad70b14ac5e76dbde7bfdf8"
|
||||
integrity sha512-6zavDGdzG3gUqAdWvlLFfk+36RilI+Pwyuuh7HItyeScCWP3k6i8vKclAQ0bM/0y/Kz/xiwvxhMv9MgTJP5gmA==
|
||||
|
||||
"@babel/plugin-syntax-async-generators@^7.8.4":
|
||||
version "7.8.4"
|
||||
@@ -269,28 +269,28 @@
|
||||
"@babel/parser" "^7.20.7"
|
||||
"@babel/types" "^7.20.7"
|
||||
|
||||
"@babel/traverse@^7.21.0", "@babel/traverse@^7.21.2", "@babel/traverse@^7.21.4", "@babel/traverse@^7.7.2":
|
||||
version "7.21.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.21.4.tgz#a836aca7b116634e97a6ed99976236b3282c9d36"
|
||||
integrity sha512-eyKrRHKdyZxqDm+fV1iqL9UAHMoIg0nDaGqfIOd8rKH17m5snv7Gn4qgjBoFfLz9APvjFU/ICT00NVCv1Epp8Q==
|
||||
"@babel/traverse@^7.21.5", "@babel/traverse@^7.7.2":
|
||||
version "7.21.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.21.5.tgz#ad22361d352a5154b498299d523cf72998a4b133"
|
||||
integrity sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw==
|
||||
dependencies:
|
||||
"@babel/code-frame" "^7.21.4"
|
||||
"@babel/generator" "^7.21.4"
|
||||
"@babel/helper-environment-visitor" "^7.18.9"
|
||||
"@babel/generator" "^7.21.5"
|
||||
"@babel/helper-environment-visitor" "^7.21.5"
|
||||
"@babel/helper-function-name" "^7.21.0"
|
||||
"@babel/helper-hoist-variables" "^7.18.6"
|
||||
"@babel/helper-split-export-declaration" "^7.18.6"
|
||||
"@babel/parser" "^7.21.4"
|
||||
"@babel/types" "^7.21.4"
|
||||
"@babel/parser" "^7.21.5"
|
||||
"@babel/types" "^7.21.5"
|
||||
debug "^4.1.0"
|
||||
globals "^11.1.0"
|
||||
|
||||
"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.20.2", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.2", "@babel/types@^7.21.4", "@babel/types@^7.3.0", "@babel/types@^7.3.3":
|
||||
version "7.21.4"
|
||||
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.21.4.tgz#2d5d6bb7908699b3b416409ffd3b5daa25b030d4"
|
||||
integrity sha512-rU2oY501qDxE8Pyo7i/Orqma4ziCOrby0/9mvbDUGEfvZjb279Nk9k19e2fiCxHbRRpY2ZyrgW1eq22mvmOIzA==
|
||||
"@babel/types@^7.0.0", "@babel/types@^7.18.6", "@babel/types@^7.20.7", "@babel/types@^7.21.0", "@babel/types@^7.21.4", "@babel/types@^7.21.5", "@babel/types@^7.3.0", "@babel/types@^7.3.3":
|
||||
version "7.21.5"
|
||||
resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.21.5.tgz#18dfbd47c39d3904d5db3d3dc2cc80bedb60e5b6"
|
||||
integrity sha512-m4AfNvVF2mVC/F7fDEdH2El3HzUg9It/XsCxZiOTTA3m3qYfcSVSbTfM6Q9xG+hYDniZssYhlXKKUMD5m8tF4Q==
|
||||
dependencies:
|
||||
"@babel/helper-string-parser" "^7.19.4"
|
||||
"@babel/helper-string-parser" "^7.21.5"
|
||||
"@babel/helper-validator-identifier" "^7.19.1"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
@@ -417,18 +417,18 @@
|
||||
eslint-visitor-keys "^3.3.0"
|
||||
|
||||
"@eslint-community/regexpp@^4.4.0":
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.0.tgz#f6f729b02feee2c749f57e334b7a1b5f40a81724"
|
||||
integrity sha512-vITaYzIcNmjn5tF5uxcZ/ft7/RXGrMUIS9HalWckEOF6ESiwXKoMzAQf2UW0aVd6rnOeExTJVd5hmWXucBKGXQ==
|
||||
version "4.5.1"
|
||||
resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.5.1.tgz#cdd35dce4fa1a89a4fd42b1599eb35b3af408884"
|
||||
integrity sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==
|
||||
|
||||
"@eslint/eslintrc@^2.0.2":
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.2.tgz#01575e38707add677cf73ca1589abba8da899a02"
|
||||
integrity sha512-3W4f5tDUra+pA+FzgugqL2pRimUTDJWKr7BINqOpkZrC0uYI0NIc0/JFgBROCU07HR6GieA5m3/rsPIhDmCXTQ==
|
||||
"@eslint/eslintrc@^2.0.3":
|
||||
version "2.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.0.3.tgz#4910db5505f4d503f27774bf356e3704818a0331"
|
||||
integrity sha512-+5gy6OQfk+xx3q0d6jGZZC3f3KzAkXc/IanVxd1is/VIIziRqqt3ongQz0FiTUXqTk0c7aDB3OaFuKnuSoJicQ==
|
||||
dependencies:
|
||||
ajv "^6.12.4"
|
||||
debug "^4.3.2"
|
||||
espree "^9.5.1"
|
||||
espree "^9.5.2"
|
||||
globals "^13.19.0"
|
||||
ignore "^5.2.0"
|
||||
import-fresh "^3.2.1"
|
||||
@@ -436,10 +436,10 @@
|
||||
minimatch "^3.1.2"
|
||||
strip-json-comments "^3.1.1"
|
||||
|
||||
"@eslint/js@8.38.0":
|
||||
version "8.38.0"
|
||||
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.38.0.tgz#73a8a0d8aa8a8e6fe270431c5e72ae91b5337892"
|
||||
integrity sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g==
|
||||
"@eslint/js@8.40.0":
|
||||
version "8.40.0"
|
||||
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.40.0.tgz#3ba73359e11f5a7bd3e407f70b3528abfae69cec"
|
||||
integrity sha512-ElyB54bJIhXQYVKjDSvCkPO1iU1tSAeVQJbllWJq1XQSmmA4dgFk8CbiBGpiOPxleE48vDogxCtmMYku4HSVLA==
|
||||
|
||||
"@humanwhocodes/config-array@^0.11.8":
|
||||
version "0.11.8"
|
||||
@@ -705,15 +705,17 @@
|
||||
"@jridgewell/resolve-uri" "3.1.0"
|
||||
"@jridgewell/sourcemap-codec" "1.4.14"
|
||||
|
||||
"@noble/hashes@1.2.0", "@noble/hashes@~1.2.0":
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.2.0.tgz#a3150eeb09cc7ab207ebf6d7b9ad311a9bdbed12"
|
||||
integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==
|
||||
"@noble/curves@1.0.0", "@noble/curves@~1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.0.0.tgz#e40be8c7daf088aaf291887cbc73f43464a92932"
|
||||
integrity sha512-2upgEu0iLiDVDZkNLeFV2+ht0BAVgQnEmCk6JsOch9Rp8xfkMCbvbAZlA2pBHQc73dbl+vFOXfqkf4uemdn0bw==
|
||||
dependencies:
|
||||
"@noble/hashes" "1.3.0"
|
||||
|
||||
"@noble/secp256k1@1.7.1", "@noble/secp256k1@~1.7.0":
|
||||
version "1.7.1"
|
||||
resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c"
|
||||
integrity sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==
|
||||
"@noble/hashes@1.3.0", "@noble/hashes@~1.3.0":
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1"
|
||||
integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==
|
||||
|
||||
"@nodelib/fs.scandir@2.1.5":
|
||||
version "2.1.5"
|
||||
@@ -741,21 +743,21 @@
|
||||
resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.1.tgz#ebb651ee52ff84f420097055f4bf46cfba403938"
|
||||
integrity sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==
|
||||
|
||||
"@scure/bip32@1.1.4":
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.1.4.tgz#2c91a7be0156b15f26dd0c843a06a1917f129efd"
|
||||
integrity sha512-m925ACYK0wPELsF7Z/VdLGmKj1StIeHraPMYB9xiAFiq/PnvqWd/99I0TQ2OZhjjlMDsDJeZlyXMWi0beaA7NA==
|
||||
"@scure/bip32@1.3.0":
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.0.tgz#6c8d980ef3f290987736acd0ee2e0f0d50068d87"
|
||||
integrity sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q==
|
||||
dependencies:
|
||||
"@noble/hashes" "~1.2.0"
|
||||
"@noble/secp256k1" "~1.7.0"
|
||||
"@noble/curves" "~1.0.0"
|
||||
"@noble/hashes" "~1.3.0"
|
||||
"@scure/base" "~1.1.0"
|
||||
|
||||
"@scure/bip39@1.1.1":
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.1.1.tgz#b54557b2e86214319405db819c4b6a370cf340c5"
|
||||
integrity sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg==
|
||||
"@scure/bip39@1.2.0":
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.0.tgz#a207e2ef96de354de7d0002292ba1503538fc77b"
|
||||
integrity sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg==
|
||||
dependencies:
|
||||
"@noble/hashes" "~1.2.0"
|
||||
"@noble/hashes" "~1.3.0"
|
||||
"@scure/base" "~1.1.0"
|
||||
|
||||
"@sinclair/typebox@^0.25.16":
|
||||
@@ -809,9 +811,9 @@
|
||||
"@babel/types" "^7.0.0"
|
||||
|
||||
"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6":
|
||||
version "7.18.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.18.3.tgz#dfc508a85781e5698d5b33443416b6268c4b3e8d"
|
||||
integrity sha512-1kbcJ40lLB7MHsj39U4Sh1uTd2E7rLEa79kmDpI6cy+XiXsteB3POdQomoq4FxszMrO3ZYchkhYJw7A2862b3w==
|
||||
version "7.18.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.18.5.tgz#c107216842905afafd3b6e774f6f935da6f5db80"
|
||||
integrity sha512-enCvTL8m/EHS/zIvJno9nE+ndYPh1/oNFzRYRmtUqJICG2VnCSBzMLW5VN2KCQU91f23tsNKR8v7VJJQMatl7Q==
|
||||
dependencies:
|
||||
"@babel/types" "^7.3.0"
|
||||
|
||||
@@ -824,9 +826,9 @@
|
||||
"@types/json-schema" "*"
|
||||
|
||||
"@types/estree@*":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2"
|
||||
integrity sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.1.tgz#aa22750962f3bf0e79d753d3cc067f010c95f194"
|
||||
integrity sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==
|
||||
|
||||
"@types/graceful-fs@^4.1.3":
|
||||
version "4.1.6"
|
||||
@@ -854,6 +856,14 @@
|
||||
dependencies:
|
||||
"@types/istanbul-lib-report" "*"
|
||||
|
||||
"@types/jest@^29.5.1":
|
||||
version "29.5.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.1.tgz#83c818aa9a87da27d6da85d3378e5a34d2f31a47"
|
||||
integrity sha512-tEuVcHrpaixS36w7hpsfLBLpjtMRJUE09/MHXn923LOVojDwyC14cWcfc0rDs0VEfUyYmt/+iX1kxxp+gZMcaQ==
|
||||
dependencies:
|
||||
expect "^29.0.0"
|
||||
pretty-format "^29.0.0"
|
||||
|
||||
"@types/json-schema@*", "@types/json-schema@^7.0.9":
|
||||
version "7.0.11"
|
||||
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3"
|
||||
@@ -864,10 +874,23 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c"
|
||||
integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==
|
||||
|
||||
"@types/node@*", "@types/node@^18.13.0":
|
||||
version "18.15.11"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.11.tgz#b3b790f09cb1696cffcec605de025b088fa4225f"
|
||||
integrity sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q==
|
||||
"@types/node-fetch@^2.6.3":
|
||||
version "2.6.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.3.tgz#175d977f5e24d93ad0f57602693c435c57ad7e80"
|
||||
integrity sha512-ETTL1mOEdq/sxUtgtOhKjyB2Irra4cjxksvcMUR5Zr4n+PxVhsCD9WS46oPbHL3et9Zde7CNRr+WUNlcHvsX+w==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
form-data "^3.0.0"
|
||||
|
||||
"@types/node@*":
|
||||
version "20.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.1.0.tgz#258805edc37c327cf706e64c6957f241ca4c4c20"
|
||||
integrity sha512-O+z53uwx64xY7D6roOi4+jApDGFg0qn6WHcxe5QeqjMaTezBO/mxdfFXIVAVVyNWKx84OmPB3L8kbVYOTeN34A==
|
||||
|
||||
"@types/node@^18.13.0":
|
||||
version "18.16.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.5.tgz#bf64e42719dc2e74da24709a2e1c0b50a966120a"
|
||||
integrity sha512-seOA34WMo9KB+UA78qaJoCO20RJzZGVXQ5Sh6FWu0g/hfT44nKXnej3/tCQl7FL97idFpBhisLYCTB50S0EirA==
|
||||
|
||||
"@types/normalize-package-data@^2.4.0":
|
||||
version "2.4.1"
|
||||
@@ -902,14 +925,14 @@
|
||||
"@types/yargs-parser" "*"
|
||||
|
||||
"@typescript-eslint/eslint-plugin@^5.51.0":
|
||||
version "5.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.0.tgz#c0e10eeb936debe5d1c3433cf36206a95befefd0"
|
||||
integrity sha512-p0QgrEyrxAWBecR56gyn3wkG15TJdI//eetInP3zYRewDh0XS+DhB3VUAd3QqvziFsfaQIoIuZMxZRB7vXYaYw==
|
||||
version "5.59.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.2.tgz#684a2ce7182f3b4dac342eef7caa1c2bae476abd"
|
||||
integrity sha512-yVrXupeHjRxLDcPKL10sGQ/QlVrA8J5IYOEWVqk0lJaSZP7X5DfnP7Ns3cc74/blmbipQ1htFNVGsHX6wsYm0A==
|
||||
dependencies:
|
||||
"@eslint-community/regexpp" "^4.4.0"
|
||||
"@typescript-eslint/scope-manager" "5.59.0"
|
||||
"@typescript-eslint/type-utils" "5.59.0"
|
||||
"@typescript-eslint/utils" "5.59.0"
|
||||
"@typescript-eslint/scope-manager" "5.59.2"
|
||||
"@typescript-eslint/type-utils" "5.59.2"
|
||||
"@typescript-eslint/utils" "5.59.2"
|
||||
debug "^4.3.4"
|
||||
grapheme-splitter "^1.0.4"
|
||||
ignore "^5.2.0"
|
||||
@@ -918,71 +941,119 @@
|
||||
tsutils "^3.21.0"
|
||||
|
||||
"@typescript-eslint/parser@^5.51.0":
|
||||
version "5.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.0.tgz#0ad7cd019346cc5d150363f64869eca10ca9977c"
|
||||
integrity sha512-qK9TZ70eJtjojSUMrrEwA9ZDQ4N0e/AuoOIgXuNBorXYcBDk397D2r5MIe1B3cok/oCtdNC5j+lUUpVB+Dpb+w==
|
||||
version "5.59.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.2.tgz#c2c443247901d95865b9f77332d9eee7c55655e8"
|
||||
integrity sha512-uq0sKyw6ao1iFOZZGk9F8Nro/8+gfB5ezl1cA06SrqbgJAt0SRoFhb9pXaHvkrxUpZaoLxt8KlovHNk8Gp6/HQ==
|
||||
dependencies:
|
||||
"@typescript-eslint/scope-manager" "5.59.0"
|
||||
"@typescript-eslint/types" "5.59.0"
|
||||
"@typescript-eslint/typescript-estree" "5.59.0"
|
||||
"@typescript-eslint/scope-manager" "5.59.2"
|
||||
"@typescript-eslint/types" "5.59.2"
|
||||
"@typescript-eslint/typescript-estree" "5.59.2"
|
||||
debug "^4.3.4"
|
||||
|
||||
"@typescript-eslint/scope-manager@5.59.0":
|
||||
version "5.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.0.tgz#86501d7a17885710b6716a23be2e93fc54a4fe8c"
|
||||
integrity sha512-tsoldKaMh7izN6BvkK6zRMINj4Z2d6gGhO2UsI8zGZY3XhLq1DndP3Ycjhi1JwdwPRwtLMW4EFPgpuKhbCGOvQ==
|
||||
"@typescript-eslint/scope-manager@5.59.2":
|
||||
version "5.59.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.2.tgz#f699fe936ee4e2c996d14f0fdd3a7da5ba7b9a4c"
|
||||
integrity sha512-dB1v7ROySwQWKqQ8rEWcdbTsFjh2G0vn8KUyvTXdPoyzSL6lLGkiXEV5CvpJsEe9xIdKV+8Zqb7wif2issoOFA==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "5.59.0"
|
||||
"@typescript-eslint/visitor-keys" "5.59.0"
|
||||
"@typescript-eslint/types" "5.59.2"
|
||||
"@typescript-eslint/visitor-keys" "5.59.2"
|
||||
|
||||
"@typescript-eslint/type-utils@5.59.0":
|
||||
version "5.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.0.tgz#8e8d1420fc2265989fa3a0d897bde37f3851e8c9"
|
||||
integrity sha512-d/B6VSWnZwu70kcKQSCqjcXpVH+7ABKH8P1KNn4K7j5PXXuycZTPXF44Nui0TEm6rbWGi8kc78xRgOC4n7xFgA==
|
||||
"@typescript-eslint/scope-manager@5.59.5":
|
||||
version "5.59.5"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.5.tgz#33ffc7e8663f42cfaac873de65ebf65d2bce674d"
|
||||
integrity sha512-jVecWwnkX6ZgutF+DovbBJirZcAxgxC0EOHYt/niMROf8p4PwxxG32Qdhj/iIQQIuOflLjNkxoXyArkcIP7C3A==
|
||||
dependencies:
|
||||
"@typescript-eslint/typescript-estree" "5.59.0"
|
||||
"@typescript-eslint/utils" "5.59.0"
|
||||
"@typescript-eslint/types" "5.59.5"
|
||||
"@typescript-eslint/visitor-keys" "5.59.5"
|
||||
|
||||
"@typescript-eslint/type-utils@5.59.2":
|
||||
version "5.59.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.59.2.tgz#0729c237503604cd9a7084b5af04c496c9a4cdcf"
|
||||
integrity sha512-b1LS2phBOsEy/T381bxkkywfQXkV1dWda/z0PhnIy3bC5+rQWQDS7fk9CSpcXBccPY27Z6vBEuaPBCKCgYezyQ==
|
||||
dependencies:
|
||||
"@typescript-eslint/typescript-estree" "5.59.2"
|
||||
"@typescript-eslint/utils" "5.59.2"
|
||||
debug "^4.3.4"
|
||||
tsutils "^3.21.0"
|
||||
|
||||
"@typescript-eslint/types@5.59.0":
|
||||
version "5.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.0.tgz#3fcdac7dbf923ec5251545acdd9f1d42d7c4fe32"
|
||||
integrity sha512-yR2h1NotF23xFFYKHZs17QJnB51J/s+ud4PYU4MqdZbzeNxpgUr05+dNeCN/bb6raslHvGdd6BFCkVhpPk/ZeA==
|
||||
"@typescript-eslint/types@5.59.2":
|
||||
version "5.59.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.2.tgz#b511d2b9847fe277c5cb002a2318bd329ef4f655"
|
||||
integrity sha512-LbJ/HqoVs2XTGq5shkiKaNTuVv5tTejdHgfdjqRUGdYhjW1crm/M7og2jhVskMt8/4wS3T1+PfFvL1K3wqYj4w==
|
||||
|
||||
"@typescript-eslint/typescript-estree@5.59.0":
|
||||
version "5.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.0.tgz#8869156ee1dcfc5a95be3ed0e2809969ea28e965"
|
||||
integrity sha512-sUNnktjmI8DyGzPdZ8dRwW741zopGxltGs/SAPgGL/AAgDpiLsCFLcMNSpbfXfmnNeHmK9h3wGmCkGRGAoUZAg==
|
||||
"@typescript-eslint/types@5.59.5":
|
||||
version "5.59.5"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.5.tgz#e63c5952532306d97c6ea432cee0981f6d2258c7"
|
||||
integrity sha512-xkfRPHbqSH4Ggx4eHRIO/eGL8XL4Ysb4woL8c87YuAo8Md7AUjyWKa9YMwTL519SyDPrfEgKdewjkxNCVeJW7w==
|
||||
|
||||
"@typescript-eslint/typescript-estree@5.59.2":
|
||||
version "5.59.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.2.tgz#6e2fabd3ba01db5d69df44e0b654c0b051fe9936"
|
||||
integrity sha512-+j4SmbwVmZsQ9jEyBMgpuBD0rKwi9RxRpjX71Brr73RsYnEr3Lt5QZ624Bxphp8HUkSKfqGnPJp1kA5nl0Sh7Q==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "5.59.0"
|
||||
"@typescript-eslint/visitor-keys" "5.59.0"
|
||||
"@typescript-eslint/types" "5.59.2"
|
||||
"@typescript-eslint/visitor-keys" "5.59.2"
|
||||
debug "^4.3.4"
|
||||
globby "^11.1.0"
|
||||
is-glob "^4.0.3"
|
||||
semver "^7.3.7"
|
||||
tsutils "^3.21.0"
|
||||
|
||||
"@typescript-eslint/utils@5.59.0":
|
||||
version "5.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.0.tgz#063d066b3bc4850c18872649ed0da9ee72d833d5"
|
||||
integrity sha512-GGLFd+86drlHSvPgN/el6dRQNYYGOvRSDVydsUaQluwIW3HvbXuxyuD5JETvBt/9qGYe+lOrDk6gRrWOHb/FvA==
|
||||
"@typescript-eslint/typescript-estree@5.59.5":
|
||||
version "5.59.5"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.5.tgz#9b252ce55dd765e972a7a2f99233c439c5101e42"
|
||||
integrity sha512-+XXdLN2CZLZcD/mO7mQtJMvCkzRfmODbeSKuMY/yXbGkzvA9rJyDY5qDYNoiz2kP/dmyAxXquL2BvLQLJFPQIg==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "5.59.5"
|
||||
"@typescript-eslint/visitor-keys" "5.59.5"
|
||||
debug "^4.3.4"
|
||||
globby "^11.1.0"
|
||||
is-glob "^4.0.3"
|
||||
semver "^7.3.7"
|
||||
tsutils "^3.21.0"
|
||||
|
||||
"@typescript-eslint/utils@5.59.2":
|
||||
version "5.59.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.2.tgz#0c45178124d10cc986115885688db6abc37939f4"
|
||||
integrity sha512-kSuF6/77TZzyGPhGO4uVp+f0SBoYxCDf+lW3GKhtKru/L8k/Hd7NFQxyWUeY7Z/KGB2C6Fe3yf2vVi4V9TsCSQ==
|
||||
dependencies:
|
||||
"@eslint-community/eslint-utils" "^4.2.0"
|
||||
"@types/json-schema" "^7.0.9"
|
||||
"@types/semver" "^7.3.12"
|
||||
"@typescript-eslint/scope-manager" "5.59.0"
|
||||
"@typescript-eslint/types" "5.59.0"
|
||||
"@typescript-eslint/typescript-estree" "5.59.0"
|
||||
"@typescript-eslint/scope-manager" "5.59.2"
|
||||
"@typescript-eslint/types" "5.59.2"
|
||||
"@typescript-eslint/typescript-estree" "5.59.2"
|
||||
eslint-scope "^5.1.1"
|
||||
semver "^7.3.7"
|
||||
|
||||
"@typescript-eslint/visitor-keys@5.59.0":
|
||||
version "5.59.0"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.0.tgz#a59913f2bf0baeb61b5cfcb6135d3926c3854365"
|
||||
integrity sha512-qZ3iXxQhanchCeaExlKPV3gDQFxMUmU35xfd5eCXB6+kUw1TUAbIy2n7QIrwz9s98DQLzNWyHp61fY0da4ZcbA==
|
||||
"@typescript-eslint/utils@^5.10.0":
|
||||
version "5.59.5"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.59.5.tgz#15b3eb619bb223302e60413adb0accd29c32bcae"
|
||||
integrity sha512-sCEHOiw+RbyTii9c3/qN74hYDPNORb8yWCoPLmB7BIflhplJ65u2PBpdRla12e3SSTJ2erRkPjz7ngLHhUegxA==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "5.59.0"
|
||||
"@eslint-community/eslint-utils" "^4.2.0"
|
||||
"@types/json-schema" "^7.0.9"
|
||||
"@types/semver" "^7.3.12"
|
||||
"@typescript-eslint/scope-manager" "5.59.5"
|
||||
"@typescript-eslint/types" "5.59.5"
|
||||
"@typescript-eslint/typescript-estree" "5.59.5"
|
||||
eslint-scope "^5.1.1"
|
||||
semver "^7.3.7"
|
||||
|
||||
"@typescript-eslint/visitor-keys@5.59.2":
|
||||
version "5.59.2"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.2.tgz#37a419dc2723a3eacbf722512b86d6caf7d3b750"
|
||||
integrity sha512-EEpsO8m3RASrKAHI9jpavNv9NlEUebV4qmF1OWxSTtKSFBpC1NCmWazDQHFivRf0O1DV11BA645yrLEVQ0/Lig==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "5.59.2"
|
||||
eslint-visitor-keys "^3.3.0"
|
||||
|
||||
"@typescript-eslint/visitor-keys@5.59.5":
|
||||
version "5.59.5"
|
||||
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.5.tgz#ba5b8d6791a13cf9fea6716af1e7626434b29b9b"
|
||||
integrity sha512-qL+Oz+dbeBRTeyJTIy0eniD3uvqU7x+y1QceBismZ41hd4aBSRh8UAw4pZP0+XzLuPZmx4raNMq/I+59W2lXKA==
|
||||
dependencies:
|
||||
"@typescript-eslint/types" "5.59.5"
|
||||
eslint-visitor-keys "^3.3.0"
|
||||
|
||||
acorn-jsx@^5.3.2:
|
||||
@@ -1074,6 +1145,11 @@ arrify@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
|
||||
integrity sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==
|
||||
|
||||
asynckit@^0.4.0:
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
|
||||
integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==
|
||||
|
||||
available-typed-arrays@^1.0.5:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7"
|
||||
@@ -1228,9 +1304,9 @@ camelcase@^6.2.0:
|
||||
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==
|
||||
|
||||
caniuse-lite@^1.0.30001449:
|
||||
version "1.0.30001480"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001480.tgz#9bbd35ee44c2480a1e3a3b9f4496f5066817164a"
|
||||
integrity sha512-q7cpoPPvZYgtyC4VaBSN0Bt+PJ4c4EYRf0DrduInOz2SkFpHD5p3LnvEpqBp7UnJn+8x1Ogl1s38saUxe+ihQQ==
|
||||
version "1.0.30001486"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001486.tgz#56a08885228edf62cbe1ac8980f2b5dae159997e"
|
||||
integrity sha512-uv7/gXuHi10Whlj0pp5q/tsK/32J2QSqVRKQhs2j8VsDCjgyruAh/eEXHF822VqO9yT6iZKw3nRwZRSPBE9OQg==
|
||||
|
||||
chalk@^2.0.0, chalk@^2.4.1:
|
||||
version "2.4.2"
|
||||
@@ -1307,6 +1383,13 @@ color-name@~1.1.4:
|
||||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||
|
||||
combined-stream@^1.0.8:
|
||||
version "1.0.8"
|
||||
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
|
||||
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
|
||||
dependencies:
|
||||
delayed-stream "~1.0.0"
|
||||
|
||||
concat-map@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
|
||||
@@ -1399,7 +1482,7 @@ deepmerge@^4.2.2:
|
||||
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a"
|
||||
integrity sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==
|
||||
|
||||
define-properties@^1.1.3, define-properties@^1.1.4:
|
||||
define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.0.tgz#52988570670c9eacedd8064f4a990f2405849bd5"
|
||||
integrity sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==
|
||||
@@ -1407,6 +1490,11 @@ define-properties@^1.1.3, define-properties@^1.1.4:
|
||||
has-property-descriptors "^1.0.0"
|
||||
object-keys "^1.1.1"
|
||||
|
||||
delayed-stream@~1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
|
||||
integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==
|
||||
|
||||
detect-newline@^3.0.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651"
|
||||
@@ -1432,9 +1520,9 @@ doctrine@^3.0.0:
|
||||
esutils "^2.0.2"
|
||||
|
||||
electron-to-chromium@^1.4.284:
|
||||
version "1.4.367"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.367.tgz#d9ddc529ba2315fc852b722c359e4a40e86aa742"
|
||||
integrity sha512-mNuDxb+HpLhPGUKrg0hSxbTjHWw8EziwkwlJNkFUj3W60ypigLDRVz04vU+VRsJPi8Gub+FDhYUpuTm9xiEwRQ==
|
||||
version "1.4.385"
|
||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.385.tgz#1afd8d6280d510145148777b899ff481c65531ff"
|
||||
integrity sha512-L9zlje9bIw0h+CwPQumiuVlfMcV4boxRjFIWDcLfFqTZNbkwOExBzfmswytHawObQX4OUhtNv8gIiB21kOurIg==
|
||||
|
||||
emittery@^0.13.1:
|
||||
version "0.13.1"
|
||||
@@ -1611,6 +1699,13 @@ eslint-plugin-babel@^5.3.1:
|
||||
dependencies:
|
||||
eslint-rule-composer "^0.3.0"
|
||||
|
||||
eslint-plugin-jest@^27.2.1:
|
||||
version "27.2.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-27.2.1.tgz#b85b4adf41c682ea29f1f01c8b11ccc39b5c672c"
|
||||
integrity sha512-l067Uxx7ZT8cO9NJuf+eJHvt6bqJyz2Z29wykyEdz/OtmcELQl2MQGQLX8J94O1cSJWAwUSEvCjwjA7KEK3Hmg==
|
||||
dependencies:
|
||||
"@typescript-eslint/utils" "^5.10.0"
|
||||
|
||||
eslint-rule-composer@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz#79320c927b0c5c0d3d3d2b76c8b4a488f25bbaf9"
|
||||
@@ -1629,7 +1724,7 @@ eslint-scope@^5.1.1:
|
||||
esrecurse "^4.3.0"
|
||||
estraverse "^4.1.1"
|
||||
|
||||
eslint-scope@^7.1.1:
|
||||
eslint-scope@^7.2.0:
|
||||
version "7.2.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.0.tgz#f21ebdafda02352f103634b96dd47d9f81ca117b"
|
||||
integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==
|
||||
@@ -1637,20 +1732,20 @@ eslint-scope@^7.1.1:
|
||||
esrecurse "^4.3.0"
|
||||
estraverse "^5.2.0"
|
||||
|
||||
eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.0:
|
||||
version "3.4.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz#c7f0f956124ce677047ddbc192a68f999454dedc"
|
||||
integrity sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ==
|
||||
eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1:
|
||||
version "3.4.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz#c22c48f48942d08ca824cc526211ae400478a994"
|
||||
integrity sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==
|
||||
|
||||
eslint@^8.33.0:
|
||||
version "8.38.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.38.0.tgz#a62c6f36e548a5574dd35728ac3c6209bd1e2f1a"
|
||||
integrity sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg==
|
||||
eslint@^8.40.0:
|
||||
version "8.40.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.40.0.tgz#a564cd0099f38542c4e9a2f630fa45bf33bc42a4"
|
||||
integrity sha512-bvR+TsP9EHL3TqNtj9sCNJVAFK3fBN8Q7g5waghxyRsPLIMwL73XSKnZFK0hk/O2ANC+iAoq6PWMQ+IfBAJIiQ==
|
||||
dependencies:
|
||||
"@eslint-community/eslint-utils" "^4.2.0"
|
||||
"@eslint-community/regexpp" "^4.4.0"
|
||||
"@eslint/eslintrc" "^2.0.2"
|
||||
"@eslint/js" "8.38.0"
|
||||
"@eslint/eslintrc" "^2.0.3"
|
||||
"@eslint/js" "8.40.0"
|
||||
"@humanwhocodes/config-array" "^0.11.8"
|
||||
"@humanwhocodes/module-importer" "^1.0.1"
|
||||
"@nodelib/fs.walk" "^1.2.8"
|
||||
@@ -1660,9 +1755,9 @@ eslint@^8.33.0:
|
||||
debug "^4.3.2"
|
||||
doctrine "^3.0.0"
|
||||
escape-string-regexp "^4.0.0"
|
||||
eslint-scope "^7.1.1"
|
||||
eslint-visitor-keys "^3.4.0"
|
||||
espree "^9.5.1"
|
||||
eslint-scope "^7.2.0"
|
||||
eslint-visitor-keys "^3.4.1"
|
||||
espree "^9.5.2"
|
||||
esquery "^1.4.2"
|
||||
esutils "^2.0.2"
|
||||
fast-deep-equal "^3.1.3"
|
||||
@@ -1698,14 +1793,14 @@ esm-loader-typescript@^1.0.3:
|
||||
semver "^7.3.8"
|
||||
typescript "^5.0.2"
|
||||
|
||||
espree@^9.5.1:
|
||||
version "9.5.1"
|
||||
resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.1.tgz#4f26a4d5f18905bf4f2e0bd99002aab807e96dd4"
|
||||
integrity sha512-5yxtHSZXRSW5pvv3hAlXM5+/Oswi1AUFqBmbibKb5s6bp3rGIDkyXU6xCoyuuLhijr4SFwPrXRoZjz0AZDN9tg==
|
||||
espree@^9.5.2:
|
||||
version "9.5.2"
|
||||
resolved "https://registry.yarnpkg.com/espree/-/espree-9.5.2.tgz#e994e7dc33a082a7a82dceaf12883a829353215b"
|
||||
integrity sha512-7OASN1Wma5fum5SrNhFMAMJxOUAbhyfQ8dQ//PJaJbNw0URTPWqIghHWt1MmAANKhHZIYOHruW4Kw4ruUWOdGw==
|
||||
dependencies:
|
||||
acorn "^8.8.0"
|
||||
acorn-jsx "^5.3.2"
|
||||
eslint-visitor-keys "^3.4.0"
|
||||
eslint-visitor-keys "^3.4.1"
|
||||
|
||||
esprima@^4.0.0:
|
||||
version "4.0.1"
|
||||
@@ -1766,7 +1861,7 @@ exit@^0.1.2:
|
||||
resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c"
|
||||
integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==
|
||||
|
||||
expect@^29.5.0:
|
||||
expect@^29.0.0, expect@^29.5.0:
|
||||
version "29.5.0"
|
||||
resolved "https://registry.yarnpkg.com/expect/-/expect-29.5.0.tgz#68c0509156cb2a0adb8865d413b137eeaae682f7"
|
||||
integrity sha512-yM7xqUrCO2JdpFo4XpM82t+PJBFybdqoQuJLDGeDX2ij8NZzqRHyu3Hp188/JX7SWqud+7t4MUdvcgGBICMHZg==
|
||||
@@ -1874,6 +1969,15 @@ for-each@^0.3.3:
|
||||
dependencies:
|
||||
is-callable "^1.1.3"
|
||||
|
||||
form-data@^3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"
|
||||
integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==
|
||||
dependencies:
|
||||
asynckit "^0.4.0"
|
||||
combined-stream "^1.0.8"
|
||||
mime-types "^2.1.12"
|
||||
|
||||
fs.realpath@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
|
||||
@@ -1899,7 +2003,7 @@ function.prototype.name@^1.1.5:
|
||||
es-abstract "^1.19.0"
|
||||
functions-have-names "^1.2.2"
|
||||
|
||||
functions-have-names@^1.2.2:
|
||||
functions-have-names@^1.2.2, functions-have-names@^1.2.3:
|
||||
version "1.2.3"
|
||||
resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834"
|
||||
integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==
|
||||
@@ -2703,7 +2807,7 @@ jest-worker@^29.5.0:
|
||||
merge-stream "^2.0.0"
|
||||
supports-color "^8.0.0"
|
||||
|
||||
jest@^29.4.2:
|
||||
jest@^29.5.0:
|
||||
version "29.5.0"
|
||||
resolved "https://registry.yarnpkg.com/jest/-/jest-29.5.0.tgz#f75157622f5ce7ad53028f2f8888ab53e1f1f24e"
|
||||
integrity sha512-juMg3he2uru1QoXX078zTa7pO85QyB9xajZc6bU+d9yEGwrKX6+vGmJQ3UdVZsvTEUARIdObzH68QItim6OSSQ==
|
||||
@@ -2922,6 +3026,18 @@ micromatch@^4.0.4:
|
||||
braces "^3.0.2"
|
||||
picomatch "^2.3.1"
|
||||
|
||||
mime-db@1.52.0:
|
||||
version "1.52.0"
|
||||
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70"
|
||||
integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==
|
||||
|
||||
mime-types@^2.1.12:
|
||||
version "2.1.35"
|
||||
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a"
|
||||
integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==
|
||||
dependencies:
|
||||
mime-db "1.52.0"
|
||||
|
||||
mimic-fn@^2.1.0:
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
|
||||
@@ -3233,11 +3349,11 @@ prelude-ls@^1.2.1:
|
||||
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
|
||||
|
||||
prettier@^2.8.4:
|
||||
version "2.8.7"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.7.tgz#bb79fc8729308549d28fe3a98fce73d2c0656450"
|
||||
integrity sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw==
|
||||
version "2.8.8"
|
||||
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da"
|
||||
integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==
|
||||
|
||||
pretty-format@^29.5.0:
|
||||
pretty-format@^29.0.0, pretty-format@^29.5.0:
|
||||
version "29.5.0"
|
||||
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.5.0.tgz#283134e74f70e2e3e7229336de0e4fce94ccde5a"
|
||||
integrity sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw==
|
||||
@@ -3260,9 +3376,9 @@ punycode@^2.1.0:
|
||||
integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==
|
||||
|
||||
pure-rand@^6.0.0:
|
||||
version "6.0.1"
|
||||
resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.1.tgz#31207dddd15d43f299fdcdb2f572df65030c19af"
|
||||
integrity sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg==
|
||||
version "6.0.2"
|
||||
resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.2.tgz#a9c2ddcae9b68d736a8163036f088a2781c8b306"
|
||||
integrity sha512-6Yg0ekpKICSjPswYOuC5sku/TSWaRYlA0qsXqJgM/d/4pLPHPuTxK7Nbf7jFKzAeedUhR8C7K9Uv63FBsSo8xQ==
|
||||
|
||||
queue-microtask@^1.2.2:
|
||||
version "1.2.3"
|
||||
@@ -3316,13 +3432,13 @@ redent@^3.0.0:
|
||||
strip-indent "^3.0.0"
|
||||
|
||||
regexp.prototype.flags@^1.4.3:
|
||||
version "1.4.3"
|
||||
resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz#87cab30f80f66660181a3bb7bf5981a872b367ac"
|
||||
integrity sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==
|
||||
version "1.5.0"
|
||||
resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz#fe7ce25e7e4cca8db37b6634c8a2c7009199b9cb"
|
||||
integrity sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA==
|
||||
dependencies:
|
||||
call-bind "^1.0.2"
|
||||
define-properties "^1.1.3"
|
||||
functions-have-names "^1.2.2"
|
||||
define-properties "^1.2.0"
|
||||
functions-have-names "^1.2.3"
|
||||
|
||||
require-directory@^2.1.1:
|
||||
version "2.1.1"
|
||||
@@ -3671,7 +3787,7 @@ trim-newlines@^3.0.0:
|
||||
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-3.0.1.tgz#260a5d962d8b752425b32f3a7db0dcacd176c144"
|
||||
integrity sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==
|
||||
|
||||
ts-jest@^29.0.5:
|
||||
ts-jest@^29.1.0:
|
||||
version "29.1.0"
|
||||
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.0.tgz#4a9db4104a49b76d2b368ea775b6c9535c603891"
|
||||
integrity sha512-ZhNr7Z4PcYa+JjMl62ir+zPiNJfXJN6E8hSLnaUKhOgqcn8vb3e537cpkd0FuAfRK3sR1LSqM1MOhliXNgOFPA==
|
||||
@@ -3777,12 +3893,7 @@ typedarray-to-buffer@^3.1.5:
|
||||
dependencies:
|
||||
is-typedarray "^1.0.0"
|
||||
|
||||
typescript@^4.9.5:
|
||||
version "4.9.5"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
|
||||
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==
|
||||
|
||||
typescript@^5.0.2:
|
||||
typescript@^5.0.2, typescript@^5.0.4:
|
||||
version "5.0.4"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
|
||||
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==
|
||||
@@ -3971,9 +4082,9 @@ yargs-parser@^21.0.1, yargs-parser@^21.1.1:
|
||||
integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==
|
||||
|
||||
yargs@^17.3.1:
|
||||
version "17.7.1"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.1.tgz#34a77645201d1a8fc5213ace787c220eabbd0967"
|
||||
integrity sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==
|
||||
version "17.7.2"
|
||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269"
|
||||
integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==
|
||||
dependencies:
|
||||
cliui "^8.0.1"
|
||||
escalade "^3.1.1"
|
||||
|
||||
Reference in New Issue
Block a user