@cero-base/core 0.4.1 → 0.4.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cero-base/core",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "cero p2p primitives — identity, storage, network, database, blobs, rpc, pairing.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -102,6 +102,22 @@ export class Pairing extends ReadyResource {
102
102
  this._invites.clear()
103
103
  }
104
104
 
105
+ /**
106
+ * Resolve the resource discovery key an invite targets — without pairing.
107
+ * Lets callers detect "already joined" before any handshake. Returns `null`
108
+ * for an unparseable invite.
109
+ *
110
+ * @param {string} inviteStr
111
+ * @returns {Uint8Array | null}
112
+ */
113
+ static inviteTopic(inviteStr) {
114
+ try {
115
+ return Invite.parse(inviteStr).blind.discoveryKey
116
+ } catch {
117
+ return null
118
+ }
119
+ }
120
+
105
121
  /**
106
122
  * Mint a new pairing invite. Returns its canonical wire form (z32 string).
107
123
  *
@@ -37,6 +37,15 @@
37
37
  * the supplied network.
38
38
  */
39
39
  export class Pairing extends ReadyResource {
40
+ /**
41
+ * Resolve the resource discovery key an invite targets — without pairing.
42
+ * Lets callers detect "already joined" before any handshake. Returns `null`
43
+ * for an unparseable invite.
44
+ *
45
+ * @param {string} inviteStr
46
+ * @returns {Uint8Array | null}
47
+ */
48
+ static inviteTopic(inviteStr: string): Uint8Array | null;
40
49
  /**
41
50
  * Cheap structural test for a candidate invite string.
42
51
  *