buzz-me-in 3.0.0 → 3.0.1

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": "buzz-me-in",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "HomeKit-compatible apartment intercom via Twilio media streams",
5
5
  "keywords": [
6
6
  "homekit",
@@ -10,14 +10,14 @@ const STREAM_TOKEN_VERSION = 1;
10
10
  const STREAM_PATH = '/media';
11
11
  const pendingStreamNonces = new Map();
12
12
 
13
+ // Node's native base64url is unpadded RFC 4648 §5, the same format the old
14
+ // replace() chain produced, so tokens issued before this change still verify.
13
15
  function toBase64Url(buffer) {
14
- return buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, '');
16
+ return buffer.toString('base64url');
15
17
  }
16
18
 
17
19
  function fromBase64Url(value) {
18
- const normalized = value.replace(/-/g, '+').replace(/_/g, '/');
19
- const padded = normalized + '='.repeat((4 - (normalized.length % 4)) % 4);
20
- return Buffer.from(padded, 'base64');
20
+ return Buffer.from(value, 'base64url');
21
21
  }
22
22
 
23
23
  function pruneExpiredNonces() {