@droponair/sdk-js 0.30.0 → 0.31.0
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/CHANGELOG.md +18 -0
- package/dist/core/bytes.d.ts +8 -0
- package/dist/core/bytes.js +14 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.31.0
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **People on different platforms could not send to each other.** Public keys are
|
|
8
|
+
published to a shared directory, and the SDKs disagreed on how to write them:
|
|
9
|
+
one used the standard base64 alphabet and another the URL-safe one. Each could
|
|
10
|
+
read what it had written and none could read the others, so encrypting for a
|
|
11
|
+
member on another platform failed outright with a decoding error, and the send
|
|
12
|
+
failed for the sender rather than for that member.
|
|
13
|
+
- Keys are now decoded in either alphabet, with or without padding, so a
|
|
14
|
+
directory shared between platforms works whatever wrote the entry.
|
|
15
|
+
|
|
16
|
+
### Notes
|
|
17
|
+
|
|
18
|
+
- Nothing needs republishing: existing entries in either form are readable.
|
|
19
|
+
- This affects any app whose users are on more than one platform.
|
|
20
|
+
|
|
3
21
|
## 0.30.0
|
|
4
22
|
|
|
5
23
|
### Added
|
package/dist/core/bytes.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
export declare function utf8Encode(value: string): Uint8Array;
|
|
2
2
|
export declare function utf8Decode(value: Uint8Array): string;
|
|
3
3
|
export declare function toBase64(value: Uint8Array): string;
|
|
4
|
+
/**
|
|
5
|
+
* Decodes base64 in either alphabet, with or without padding.
|
|
6
|
+
*
|
|
7
|
+
* Values reaching an SDK are written by whatever device produced them, and the
|
|
8
|
+
* SDKs did not agree on which alphabet to use: each could read its own and none
|
|
9
|
+
* could read the others, so two people on different platforms could not send to
|
|
10
|
+
* each other at all. `atob` is strict, so the input is normalised first.
|
|
11
|
+
*/
|
|
4
12
|
export declare function fromBase64(value: string): Uint8Array;
|
|
5
13
|
export declare function randomBytes(length: number): Uint8Array;
|
|
6
14
|
export declare function concatBytes(...parts: Uint8Array[]): Uint8Array;
|
package/dist/core/bytes.js
CHANGED
|
@@ -24,11 +24,23 @@ function toBase64(value) {
|
|
|
24
24
|
}
|
|
25
25
|
return btoa(binary);
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Decodes base64 in either alphabet, with or without padding.
|
|
29
|
+
*
|
|
30
|
+
* Values reaching an SDK are written by whatever device produced them, and the
|
|
31
|
+
* SDKs did not agree on which alphabet to use: each could read its own and none
|
|
32
|
+
* could read the others, so two people on different platforms could not send to
|
|
33
|
+
* each other at all. `atob` is strict, so the input is normalised first.
|
|
34
|
+
*/
|
|
27
35
|
function fromBase64(value) {
|
|
36
|
+
const normalised = value.replace(/-/g, '+').replace(/_/g, '/');
|
|
37
|
+
const padded = normalised.length % 4 === 0
|
|
38
|
+
? normalised
|
|
39
|
+
: normalised + '='.repeat(4 - (normalised.length % 4));
|
|
28
40
|
if (typeof Buffer !== 'undefined') {
|
|
29
|
-
return new Uint8Array(Buffer.from(
|
|
41
|
+
return new Uint8Array(Buffer.from(padded, 'base64'));
|
|
30
42
|
}
|
|
31
|
-
const binary = atob(
|
|
43
|
+
const binary = atob(padded);
|
|
32
44
|
const out = new Uint8Array(binary.length);
|
|
33
45
|
for (let i = 0; i < binary.length; i += 1) {
|
|
34
46
|
out[i] = binary.charCodeAt(i);
|
package/dist/version.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* MINOR, additive feature (e.g. multi-device payloads, new call event type)
|
|
8
8
|
* PATCH, bug-fix / perf improvement with no wire or API change
|
|
9
9
|
*/
|
|
10
|
-
export declare const SDK_VERSION = "0.
|
|
10
|
+
export declare const SDK_VERSION = "0.31.0";
|
|
11
11
|
/**
|
|
12
12
|
* Binary encrypted-payload format version.
|
|
13
13
|
* Included as the first byte of every encrypted payload so receivers can
|
package/dist/version.js
CHANGED
|
@@ -10,7 +10,7 @@ exports.PROTOCOL_VERSION = exports.PAYLOAD_FORMAT_VERSION = exports.SDK_VERSION
|
|
|
10
10
|
* MINOR, additive feature (e.g. multi-device payloads, new call event type)
|
|
11
11
|
* PATCH, bug-fix / perf improvement with no wire or API change
|
|
12
12
|
*/
|
|
13
|
-
exports.SDK_VERSION = '0.
|
|
13
|
+
exports.SDK_VERSION = '0.31.0';
|
|
14
14
|
/**
|
|
15
15
|
* Binary encrypted-payload format version.
|
|
16
16
|
* Included as the first byte of every encrypted payload so receivers can
|
package/package.json
CHANGED