@mblaney/holster 1.0.23 → 1.0.24
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/build/holster.js +3 -3
- package/build/holster.js.map +2 -2
- package/package.json +1 -1
- package/src/user.js +28 -41
package/package.json
CHANGED
package/src/user.js
CHANGED
|
@@ -72,49 +72,36 @@ const User = (opt, wire) => {
|
|
|
72
72
|
return
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
// Copy all properties from existing data, excluding metadata
|
|
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
|
-
}
|
|
75
|
+
// TODO: Remove this migration once all peers have updated to the new
|
|
76
|
+
// version and have received per-property signatures. This temporarily
|
|
77
|
+
// broadcasts signed data on every login to ensure new peers can
|
|
78
|
+
// persist it.
|
|
79
|
+
const migrationData = {}
|
|
80
|
+
for (const key of Object.keys(data)) {
|
|
81
|
+
if (key !== "_" && key !== userPublicKey && key !== userSignature) {
|
|
82
|
+
migrationData[key] = data[key]
|
|
93
83
|
}
|
|
94
|
-
// Sign each property individually
|
|
95
|
-
const propertySignatures = await SEA.signProperties(
|
|
96
|
-
migrationData,
|
|
97
|
-
user.is,
|
|
98
|
-
)
|
|
99
|
-
const graph = utils.graph(
|
|
100
|
-
pub,
|
|
101
|
-
migrationData,
|
|
102
|
-
propertySignatures,
|
|
103
|
-
data.pub,
|
|
104
|
-
)
|
|
105
|
-
wire.put(graph, err => {
|
|
106
|
-
if (err) {
|
|
107
|
-
// Log migration error but don't fail authentication
|
|
108
|
-
console.log(
|
|
109
|
-
`warning: failed to migrate signatures on login: ${err}`,
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
done(null)
|
|
113
|
-
})
|
|
114
|
-
return
|
|
115
84
|
}
|
|
116
|
-
|
|
117
|
-
|
|
85
|
+
// Sign each property individually
|
|
86
|
+
const propertySignatures = await SEA.signProperties(
|
|
87
|
+
migrationData,
|
|
88
|
+
user.is,
|
|
89
|
+
)
|
|
90
|
+
const graph = utils.graph(
|
|
91
|
+
pub,
|
|
92
|
+
migrationData,
|
|
93
|
+
propertySignatures,
|
|
94
|
+
data.pub,
|
|
95
|
+
)
|
|
96
|
+
wire.put(graph, err => {
|
|
97
|
+
if (err) {
|
|
98
|
+
// Log migration error but don't fail authentication
|
|
99
|
+
console.log(
|
|
100
|
+
`warning: failed to migrate signatures on login: ${err}`,
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
done(null)
|
|
104
|
+
})
|
|
118
105
|
},
|
|
119
106
|
{wait: 5000},
|
|
120
107
|
)
|