libp2r2p 0.11.20 → 0.11.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -692,6 +692,13 @@ Blossom server normalization accepts root `http:` origins for local
692
692
  development. Public Blossom validation additionally requires `https:` and a
693
693
  public host, and rejects credentials, paths, query strings and fragments.
694
694
 
695
+ Starting with 0.11.21, import `CONTENT_KEY_ANNOUNCEMENT` (18716) from
696
+ `libp2r2p/kind`. It is also included in `eventKinds` and used by content-key
697
+ builders, proof validation and relay discovery. The announcement publishes a
698
+ public content key for private communication and can be shared across apps.
699
+ The former `CONTENT_KEY_KIND` export from `libp2r2p/content-key/event` has been
700
+ removed; consumers must update that import.
701
+
695
702
  `classifyEvent()` from `libp2r2p/event` combines the exact NIP-01 kind
696
703
  ranges with tag-defined behavior. The first `d` tag may add `replaceable` or
697
704
  `addressable`, while an `expiration` tag equal to `created_at` adds
@@ -1,7 +1,6 @@
1
1
  import { ValidationError } from '../../error/index.js'
2
2
  import { getEventHash, isValidEvent } from '../../event/index.js'
3
-
4
- export const CONTENT_KEY_KIND = 18716
3
+ import { CONTENT_KEY_ANNOUNCEMENT } from '../../kind/index.js'
5
4
 
6
5
  const HEX_PUBKEY = /^[0-9a-f]{64}$/
7
6
  const HEX_SIG = /^[0-9a-f]{128}$/i
@@ -15,7 +14,7 @@ export async function makeContentKeyEventForPubkey ({ userSigner, contentPubkey,
15
14
  if (!HEX_PUBKEY.test(contentPubkey || '')) throw new ValidationError('CONTENT_PUBKEY_REQUIRED')
16
15
 
17
16
  return userSigner.signEvent({
18
- kind: CONTENT_KEY_KIND,
17
+ kind: CONTENT_KEY_ANNOUNCEMENT,
19
18
  created_at: createdAt,
20
19
  tags: [['cp', contentPubkey]],
21
20
  content: ''
@@ -32,7 +31,7 @@ export async function makeContentKeyEvent ({ userSigner, contentKeySigner, creat
32
31
  }
33
32
 
34
33
  export function parseContentKeyEvent (event) {
35
- if (!event || event.kind !== CONTENT_KEY_KIND || event.content !== '') return null
34
+ if (!event || event.kind !== CONTENT_KEY_ANNOUNCEMENT || event.content !== '') return null
36
35
  if (!HEX_PUBKEY.test(event.pubkey) || !Number.isSafeInteger(event.created_at)) return null
37
36
  if (!Array.isArray(event.tags) || event.tags.length !== 1) return null
38
37
  if (!isValidEvent(event)) return null
@@ -67,7 +66,7 @@ function contentKeyProofError ({ ownerPubkey, contentPubkey, proof }) {
67
66
  if (!parsed) return 'INVALID_CONTENT_KEY_PROOF'
68
67
 
69
68
  const event = {
70
- kind: CONTENT_KEY_KIND,
69
+ kind: CONTENT_KEY_ANNOUNCEMENT,
71
70
  pubkey: ownerPubkey,
72
71
  created_at: parsed.created_at,
73
72
  tags: [['cp', contentPubkey]],
@@ -1,4 +1,5 @@
1
- import { CONTENT_KEY_KIND, parseContentKeyEvent } from '../event/index.js'
1
+ import { parseContentKeyEvent } from '../event/index.js'
2
+ import { CONTENT_KEY_ANNOUNCEMENT } from '../../kind/index.js'
2
3
  import { pickRelaysForPubkeys, getRelaysByPubkey, relayPool } from '../../relay/index.js'
3
4
 
4
5
  const QUERY_CACHE_MS = 40 * 60 * 1000
@@ -81,7 +82,7 @@ async function queryContentKeyProofs (pubkeyList, { _getEvents, _getRelaysByPubk
81
82
  .map(async ([relay, authors]) => {
82
83
  try {
83
84
  const { result } = await _getEvents({
84
- kinds: [CONTENT_KEY_KIND],
85
+ kinds: [CONTENT_KEY_ANNOUNCEMENT],
85
86
  authors,
86
87
  limit: authors.length
87
88
  }, [relay], {
package/kind/index.js CHANGED
@@ -58,6 +58,7 @@ export const FILE_SERVER_PREFERENCE = 10096
58
58
  export const GOOD_WIKI_AUTHORS = 10101
59
59
  export const GOOD_WIKI_RELAYS = 10102
60
60
  export const NWC_WALLET_INFO = 13194
61
+ export const CONTENT_KEY_ANNOUNCEMENT = 18716
61
62
  export const LIGHTNING_PUB_RPC = 21000
62
63
  export const AUTH = 22242
63
64
  export const NWC_WALLET_REQUEST = 23194
@@ -198,6 +199,7 @@ export const eventKinds = /* @__PURE__ */ Object.freeze({
198
199
  GOOD_WIKI_AUTHORS,
199
200
  GOOD_WIKI_RELAYS,
200
201
  NWC_WALLET_INFO,
202
+ CONTENT_KEY_ANNOUNCEMENT,
201
203
  LIGHTNING_PUB_RPC,
202
204
  AUTH,
203
205
  NWC_WALLET_REQUEST,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libp2r2p",
3
- "version": "0.11.20",
3
+ "version": "0.11.21",
4
4
  "description": "Peer-to-relay-to-peer",
5
5
  "keywords": [
6
6
  "p2r2p",