nip19: completely remove nrelay.
This commit is contained in:
parent
b18510b460
commit
d7dcc75ebe
|
@ -172,26 +172,6 @@ describe('NostrTypeGuard', () => {
|
||||||
expect(is).toBeFalse()
|
expect(is).toBeFalse()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('isNRelay', () => {
|
|
||||||
const is = NostrTypeGuard.isNRelay('nrelay1qqt8wumn8ghj7un9d3shjtnwdaehgu3wvfskueq4r295t')
|
|
||||||
|
|
||||||
expect(is).toBeTrue()
|
|
||||||
})
|
|
||||||
|
|
||||||
test('isNRelay with invalid nrelay', () => {
|
|
||||||
const is = NostrTypeGuard.isNRelay('nrelay1qqt8wumn8ghj7un9d3shjtnwdaehgu3wvfskueã4r295t')
|
|
||||||
|
|
||||||
expect(is).toBeFalse()
|
|
||||||
})
|
|
||||||
|
|
||||||
test('isNRelay with invalid nrelay', () => {
|
|
||||||
const is = NostrTypeGuard.isNRelay(
|
|
||||||
'nevent1qqst8cujky046negxgwwm5ynqwn53t8aqjr6afd8g59nfqwxpdhylpcpzamhxue69uhhyetvv9ujuetcv9khqmr99e3k7mg8arnc9',
|
|
||||||
)
|
|
||||||
|
|
||||||
expect(is).toBeFalse()
|
|
||||||
})
|
|
||||||
|
|
||||||
test('isNEvent', () => {
|
test('isNEvent', () => {
|
||||||
const is = NostrTypeGuard.isNEvent(
|
const is = NostrTypeGuard.isNEvent(
|
||||||
'nevent1qqst8cujky046negxgwwm5ynqwn53t8aqjr6afd8g59nfqwxpdhylpcpzamhxue69uhhyetvv9ujuetcv9khqmr99e3k7mg8arnc9',
|
'nevent1qqst8cujky046negxgwwm5ynqwn53t8aqjr6afd8g59nfqwxpdhylpcpzamhxue69uhhyetvv9ujuetcv9khqmr99e3k7mg8arnc9',
|
||||||
|
|
2
nip19.ts
2
nip19.ts
|
@ -4,7 +4,6 @@ import { bech32 } from '@scure/base'
|
||||||
import { utf8Decoder, utf8Encoder } from './utils.ts'
|
import { utf8Decoder, utf8Encoder } from './utils.ts'
|
||||||
|
|
||||||
export type NProfile = `nprofile1${string}`
|
export type NProfile = `nprofile1${string}`
|
||||||
export type NRelay = `nrelay1${string}`
|
|
||||||
export type NEvent = `nevent1${string}`
|
export type NEvent = `nevent1${string}`
|
||||||
export type NAddr = `naddr1${string}`
|
export type NAddr = `naddr1${string}`
|
||||||
export type NSec = `nsec1${string}`
|
export type NSec = `nsec1${string}`
|
||||||
|
@ -14,7 +13,6 @@ export type Ncryptsec = `ncryptsec1${string}`
|
||||||
|
|
||||||
export const NostrTypeGuard = {
|
export const NostrTypeGuard = {
|
||||||
isNProfile: (value?: string | null): value is NProfile => /^nprofile1[a-z\d]+$/.test(value || ''),
|
isNProfile: (value?: string | null): value is NProfile => /^nprofile1[a-z\d]+$/.test(value || ''),
|
||||||
isNRelay: (value?: string | null): value is NRelay => /^nrelay1[a-z\d]+$/.test(value || ''),
|
|
||||||
isNEvent: (value?: string | null): value is NEvent => /^nevent1[a-z\d]+$/.test(value || ''),
|
isNEvent: (value?: string | null): value is NEvent => /^nevent1[a-z\d]+$/.test(value || ''),
|
||||||
isNAddr: (value?: string | null): value is NAddr => /^naddr1[a-z\d]+$/.test(value || ''),
|
isNAddr: (value?: string | null): value is NAddr => /^naddr1[a-z\d]+$/.test(value || ''),
|
||||||
isNSec: (value?: string | null): value is NSec => /^nsec1[a-z\d]{58}$/.test(value || ''),
|
isNSec: (value?: string | null): value is NSec => /^nsec1[a-z\d]{58}$/.test(value || ''),
|
||||||
|
|
Loading…
Reference in New Issue