@peers-app/peers-sdk 0.7.27 → 0.7.35
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/dist/utils.js +2 -3
- package/package.json +1 -1
package/dist/utils.js
CHANGED
|
@@ -59,10 +59,9 @@ function newid() {
|
|
|
59
59
|
// Allocating one more character to the time and one less to the random number to avoid hitting max time in any conceivable future
|
|
60
60
|
// now our max time is new Date(Number.parseInt('f55n5nmuua',36)) == +050705-08-09T23:40:06.178Z. 50k years from now.
|
|
61
61
|
// We still have 15 chars for our random number. 36 ** 15 ~= 2e23
|
|
62
|
-
// That is still a very large number and the chance of a collision should be so small as to be effectively unique
|
|
63
|
-
//
|
|
62
|
+
// That is still a very large number and the chance of a collision should be so small as to be effectively globally unique
|
|
63
|
+
// and certainly unique in any group's database.
|
|
64
64
|
const time = Date.now().toString(36).padStart(10, '0'); // e.g: "00kq6xh45f", length == 10
|
|
65
|
-
//use nacl.randomBytes to be cryptographically secure
|
|
66
65
|
return time + cryptoRandomString(15);
|
|
67
66
|
}
|
|
68
67
|
exports.MIN_ID = '0'.repeat(25);
|