@mblaney/holster 1.0.30 → 1.0.31

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": "@mblaney/holster",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "Holster is a service that allows synchronising data between devices using Node, Deno, Bun or the browser.",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/src/buffer.js CHANGED
@@ -161,6 +161,14 @@ const processArrayLikeInput = input => {
161
161
  }
162
162
  }
163
163
 
164
+ bytes = new Uint8Array(input)
165
+ } else if (
166
+ typeof input === "object" &&
167
+ input !== null &&
168
+ typeof input.byteLength === "number"
169
+ ) {
170
+ // Handle ArrayBuffer from different contexts (e.g. jsdom)
171
+ validateBufferSize(input.byteLength, "ArrayBuffer-like processing")
164
172
  bytes = new Uint8Array(input)
165
173
  } else if (
166
174
  typeof input === "object" &&
@@ -184,7 +192,6 @@ const processArrayLikeInput = input => {
184
192
  )
185
193
  }
186
194
  }
187
-
188
195
  bytes = new Uint8Array(arr)
189
196
  } else {
190
197
  throw new TypeError("Unsupported input type: " + typeof input)
package/src/user.js CHANGED
@@ -73,46 +73,7 @@ const User = (opt, wire) => {
73
73
  return
74
74
  }
75
75
 
76
- // Migration: broadcast signed data on login if enabled
77
- // Can be enabled by setting localStorage.setItem("holster_migrate_signatures", "true")
78
- const migrationEnabled =
79
- typeof globalThis.localStorage !== "undefined" &&
80
- globalThis.localStorage.getItem("holster_migrate_signatures") ===
81
- "true"
82
-
83
- if (migrationEnabled) {
84
- const migrationData = {}
85
- for (const key of Object.keys(data)) {
86
- if (
87
- key !== "_" &&
88
- key !== userPublicKey &&
89
- key !== userSignature
90
- ) {
91
- migrationData[key] = data[key]
92
- }
93
- }
94
- // Sign the timestamp for migration
95
- const timestamp = Date.now()
96
- const sig = await SEA.signTimestamp(timestamp, user.is)
97
- const graph = utils.graph(
98
- pub,
99
- migrationData,
100
- sig,
101
- data.pub,
102
- timestamp,
103
- )
104
- wire.put(graph, err => {
105
- if (err) {
106
- // Log migration error but don't fail authentication
107
- console.log(
108
- `warning: failed to migrate signatures on login: ${err}`,
109
- )
110
- }
111
- done(null)
112
- })
113
- } else {
114
- done(null)
115
- }
76
+ done(null)
116
77
  },
117
78
  {wait: 5000},
118
79
  )
package/src/wire.js CHANGED
@@ -732,7 +732,7 @@ const Wire = opt => {
732
732
  queueProcessor = setTimeout(processQueue, 50)
733
733
  }
734
734
  }
735
- if (!(opt.peers instanceof Array)) {
735
+ if (!(opt.peers instanceof Array) || opt.peers.length === 0) {
736
736
  opt.peers = [`ws://localhost:${opt.port || 8765}`]
737
737
  }
738
738
  opt.peers.forEach(peer => {