@atlastodo/client-core 0.1.11-rc.9 → 0.1.11
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/index.d.ts +1 -0
- package/dist/index.js +14 -1
- package/dist/text.d.ts +7 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1172,6 +1172,18 @@ function unwrapAppPrivateKey(wrap, appKey, userId, app) {
|
|
|
1172
1172
|
// src/crypto/passkey.ts
|
|
1173
1173
|
import { sha256 as sha2567 } from "@noble/hashes/sha2.js";
|
|
1174
1174
|
import { hkdf as hkdf6 } from "@noble/hashes/hkdf.js";
|
|
1175
|
+
|
|
1176
|
+
// src/text.ts
|
|
1177
|
+
function trimTrailing(text, char) {
|
|
1178
|
+
if (char.length !== 1)
|
|
1179
|
+
throw new Error("trimTrailing takes one character");
|
|
1180
|
+
let end = text.length;
|
|
1181
|
+
while (end > 0 && text[end - 1] === char)
|
|
1182
|
+
end--;
|
|
1183
|
+
return end === text.length ? text : text.slice(0, end);
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
// src/crypto/passkey.ts
|
|
1175
1187
|
var PASSKEY_PRF_LABEL = "atlas-passkey-prf-v1";
|
|
1176
1188
|
var SLOT_INFO = "atlas-passkey-slot-v1";
|
|
1177
1189
|
function passkeyPrfInput() {
|
|
@@ -1181,7 +1193,7 @@ function passkeyPrfInputBase64Url() {
|
|
|
1181
1193
|
return bytesToBase64Url(passkeyPrfInput());
|
|
1182
1194
|
}
|
|
1183
1195
|
function decodeBase64Url(text) {
|
|
1184
|
-
const bytes = base64UrlToBytes(text
|
|
1196
|
+
const bytes = base64UrlToBytes(trimTrailing(text, "="));
|
|
1185
1197
|
if (!bytes)
|
|
1186
1198
|
throw new Error("not base64url");
|
|
1187
1199
|
return bytes;
|
|
@@ -6995,6 +7007,7 @@ export {
|
|
|
6995
7007
|
toWireReport,
|
|
6996
7008
|
todoAppKeyRow,
|
|
6997
7009
|
tokenPolicyFor,
|
|
7010
|
+
trimTrailing,
|
|
6998
7011
|
unpadPlaintext,
|
|
6999
7012
|
unpinMemberKey,
|
|
7000
7013
|
unsealKey,
|
package/dist/text.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `text` without its trailing run of `char` (one character), in linear time. A regex such as
|
|
3
|
+
* `/=+$/` backtracks at every `char` that is not at the end, which is quadratic on a long run of
|
|
4
|
+
* them followed by anything else, and these strings come from outside (a server, a config, a
|
|
5
|
+
* pasted secret).
|
|
6
|
+
*/
|
|
7
|
+
export declare function trimTrailing(text: string, char: string): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlastodo/client-core",
|
|
3
|
-
"version": "0.1.11
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Atlas core client: hybrid logical clocks, the op log and per-field LWW merge, end-to-end encryption, the local store and the sync client",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"homepage": "https://github.com/atlastodo/atlas/tree/main/packages/client-core",
|