py-auth-client 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/dist/crypto.js +5 -7
  2. package/package.json +1 -1
package/dist/crypto.js CHANGED
@@ -4,14 +4,11 @@ exports.encryptData = encryptData;
4
4
  exports.decryptData = decryptData;
5
5
  const node_crypto_1 = require("node:crypto");
6
6
  function b64UrlEncode(buf) {
7
- return buf
8
- .toString("base64")
9
- .replace(/\+/g, "-")
10
- .replace(/\//g, "_")
11
- .replace(/=+$/g, "");
7
+ return buf.toString("base64").replace(/\+/g, "-").replace(/\//g, "_");
12
8
  }
13
9
  function b64UrlDecode(s) {
14
- const padded = s.replace(/-/g, "+").replace(/_/g, "/") + "===".slice((s.length + 3) % 4);
10
+ const normalized = s.replace(/-/g, "+").replace(/_/g, "/");
11
+ const padded = normalized + "===".slice((normalized.length + 3) % 4);
15
12
  return Buffer.from(padded, "base64");
16
13
  }
17
14
  function timingSafeEqual(a, b) {
@@ -27,7 +24,8 @@ function deriveFernetKey(clientSecret) {
27
24
  return digest.subarray(0, 32);
28
25
  }
29
26
  function pkcs7Pad(data, blockSize = 16) {
30
- const padLen = blockSize - (data.length % blockSize || blockSize);
27
+ const rem = data.length % blockSize;
28
+ const padLen = rem === 0 ? blockSize : blockSize - rem;
31
29
  return Buffer.concat([data, Buffer.alloc(padLen, padLen)]);
32
30
  }
33
31
  function pkcs7Unpad(data, blockSize = 16) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "py-auth-client",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "TypeScript/Node.js client for py-auth (compatible with Python/Go clients)",
5
5
  "keywords": [
6
6
  "auth",