@matter/react-native 0.15.0-alpha.0-20250613-a55f991d4 → 0.15.0-alpha.0-20250616-4b3754906
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/cjs/crypto/ReactNativeCrypto.d.ts +4 -4
- package/dist/cjs/crypto/ReactNativeCrypto.d.ts.map +1 -1
- package/dist/cjs/crypto/ReactNativeCrypto.js +8 -2
- package/dist/cjs/crypto/ReactNativeCrypto.js.map +1 -1
- package/dist/esm/crypto/ReactNativeCrypto.d.ts +4 -4
- package/dist/esm/crypto/ReactNativeCrypto.d.ts.map +1 -1
- package/dist/esm/crypto/ReactNativeCrypto.js +15 -3
- package/dist/esm/crypto/ReactNativeCrypto.js.map +1 -1
- package/package.json +5 -5
- package/src/crypto/ReactNativeCrypto.ts +18 -6
|
@@ -7,12 +7,12 @@ import { CryptoDsaEncoding } from "#general";
|
|
|
7
7
|
import { NodeJsCrypto } from "#nodejs";
|
|
8
8
|
/**
|
|
9
9
|
* Crypto implementation for React Native
|
|
10
|
-
*
|
|
11
|
-
* We do not install this implementation by default because it is not fully functional. The Node.js crypto
|
|
12
|
-
* compatibility interface in React Native does not implement all features (AES-CCM, at least, is missing).
|
|
13
10
|
*/
|
|
14
|
-
export declare class
|
|
11
|
+
export declare class ReactNativeCrypto extends NodeJsCrypto {
|
|
12
|
+
implementationName: string;
|
|
15
13
|
signEcdsa(privateKey: JsonWebKey, data: Uint8Array | Uint8Array[], dsaEncoding?: CryptoDsaEncoding): Uint8Array;
|
|
16
14
|
verifyEcdsa(publicKey: JsonWebKey, data: Uint8Array, signature: Uint8Array, dsaEncoding?: CryptoDsaEncoding): void;
|
|
15
|
+
encrypt: (key: Uint8Array, data: Uint8Array, nonce: Uint8Array, associatedData?: Uint8Array) => Uint8Array<ArrayBufferLike>;
|
|
16
|
+
decrypt: (key: Uint8Array, data: Uint8Array, nonce: Uint8Array, associatedData?: Uint8Array) => Uint8Array<ArrayBufferLike>;
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=ReactNativeCrypto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeCrypto.d.ts","sourceRoot":"","sources":["../../../src/crypto/ReactNativeCrypto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,
|
|
1
|
+
{"version":3,"file":"ReactNativeCrypto.d.ts","sourceRoot":"","sources":["../../../src/crypto/ReactNativeCrypto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAGH,iBAAiB,EAIpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAsDvC;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;IACtC,kBAAkB,SAAkB;IAEpC,SAAS,CACd,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,UAAU,GAAG,UAAU,EAAE,EAC/B,WAAW,GAAE,iBAAgC,GAC9C,UAAU;IAkBJ,WAAW,CAChB,SAAS,EAAE,UAAU,EACrB,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,UAAU,EACrB,WAAW,GAAE,iBAAgC;IAmBxC,OAAO,qHAAoC;IAC3C,OAAO,qHAAoC;CACvD"}
|
|
@@ -28,7 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var ReactNativeCrypto_exports = {};
|
|
30
30
|
__export(ReactNativeCrypto_exports, {
|
|
31
|
-
|
|
31
|
+
ReactNativeCrypto: () => ReactNativeCrypto
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(ReactNativeCrypto_exports);
|
|
34
34
|
var import_react_native_quick_crypto = require("react-native-quick-crypto");
|
|
@@ -60,7 +60,8 @@ crypto.hkdf = (digest, ikm, salt, info, keylen) => {
|
|
|
60
60
|
}
|
|
61
61
|
return T.slice(0, keylen);
|
|
62
62
|
};
|
|
63
|
-
class
|
|
63
|
+
class ReactNativeCrypto extends import_nodejs.NodeJsCrypto {
|
|
64
|
+
implementationName = "React Native";
|
|
64
65
|
signEcdsa(privateKey, data, dsaEncoding = "ieee-p1363") {
|
|
65
66
|
const signer = crypto.createSign(import_general.CRYPTO_HASH_ALGORITHM);
|
|
66
67
|
if (Array.isArray(data)) {
|
|
@@ -91,5 +92,10 @@ class CryptoReactNative extends import_nodejs.NodeJsCrypto {
|
|
|
91
92
|
);
|
|
92
93
|
if (!success) throw new import_general.CryptoVerifyError("Signature verification failed");
|
|
93
94
|
}
|
|
95
|
+
// Quick crypto does not support AES-CCM. Install the JS version to compensate
|
|
96
|
+
// TODO - remove this once we have proper feature detection to configure crypto
|
|
97
|
+
encrypt = import_general.StandardCrypto.prototype.encrypt;
|
|
98
|
+
decrypt = import_general.StandardCrypto.prototype.decrypt;
|
|
94
99
|
}
|
|
100
|
+
import_general.Environment.default.set(import_general.Crypto, new ReactNativeCrypto());
|
|
95
101
|
//# sourceMappingURL=ReactNativeCrypto.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/crypto/ReactNativeCrypto.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,uCAAwB;AAIxB,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,uCAAwB;AAIxB,qBAOO;AACP,oBAA6B;AAE7B,wBAAoB;AApBpB;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,0CAAQ;AAeR,OAAO,OAAO,CACV,QACA,KACA,MACA,MACA,WACC;AACD,QAAM,UAAU,SAAS,OAAO,OAAO,CAAC,GAAG,EAAE,KAAK,KAAK;AACvD,QAAM,MAAM,OAEP,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AM;AAAA,QACN;AAAA,MACJ;AAAA,MACA;AAAA,IACJ;AACA,QAAI,CAAC,QAAS,OAAM,IAAI,iCAAkB,+BAA+B;AAAA,EAC7E;AAAA;AAAA;AAAA,EAIS,UAAU,8BAAe,UAAU;AAAA,EACnC,UAAU,8BAAe,UAAU;AAChD;AAEA,2BAAY,QAAQ,IAAI,uBAAQ,IAAI,kBAAkB,CAAC;",
|
|
5
5
|
"names": ["jwk2pem"]
|
|
6
6
|
}
|
|
@@ -7,12 +7,12 @@ import { CryptoDsaEncoding } from "#general";
|
|
|
7
7
|
import { NodeJsCrypto } from "#nodejs";
|
|
8
8
|
/**
|
|
9
9
|
* Crypto implementation for React Native
|
|
10
|
-
*
|
|
11
|
-
* We do not install this implementation by default because it is not fully functional. The Node.js crypto
|
|
12
|
-
* compatibility interface in React Native does not implement all features (AES-CCM, at least, is missing).
|
|
13
10
|
*/
|
|
14
|
-
export declare class
|
|
11
|
+
export declare class ReactNativeCrypto extends NodeJsCrypto {
|
|
12
|
+
implementationName: string;
|
|
15
13
|
signEcdsa(privateKey: JsonWebKey, data: Uint8Array | Uint8Array[], dsaEncoding?: CryptoDsaEncoding): Uint8Array;
|
|
16
14
|
verifyEcdsa(publicKey: JsonWebKey, data: Uint8Array, signature: Uint8Array, dsaEncoding?: CryptoDsaEncoding): void;
|
|
15
|
+
encrypt: (key: Uint8Array, data: Uint8Array, nonce: Uint8Array, associatedData?: Uint8Array) => Uint8Array<ArrayBufferLike>;
|
|
16
|
+
decrypt: (key: Uint8Array, data: Uint8Array, nonce: Uint8Array, associatedData?: Uint8Array) => Uint8Array<ArrayBufferLike>;
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=ReactNativeCrypto.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNativeCrypto.d.ts","sourceRoot":"","sources":["../../../src/crypto/ReactNativeCrypto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,
|
|
1
|
+
{"version":3,"file":"ReactNativeCrypto.d.ts","sourceRoot":"","sources":["../../../src/crypto/ReactNativeCrypto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAGH,iBAAiB,EAIpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAsDvC;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;IACtC,kBAAkB,SAAkB;IAEpC,SAAS,CACd,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,UAAU,GAAG,UAAU,EAAE,EAC/B,WAAW,GAAE,iBAAgC,GAC9C,UAAU;IAkBJ,WAAW,CAChB,SAAS,EAAE,UAAU,EACrB,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,UAAU,EACrB,WAAW,GAAE,iBAAgC;IAmBxC,OAAO,qHAAoC;IAC3C,OAAO,qHAAoC;CACvD"}
|
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { install } from "react-native-quick-crypto";
|
|
7
7
|
install();
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
Crypto,
|
|
10
|
+
CRYPTO_HASH_ALGORITHM,
|
|
11
|
+
CryptoVerifyError,
|
|
12
|
+
Environment,
|
|
13
|
+
StandardCrypto
|
|
14
|
+
} from "#general";
|
|
9
15
|
import { NodeJsCrypto } from "#nodejs";
|
|
10
16
|
import jwk2pem from "jwk-to-pem";
|
|
11
17
|
crypto.hkdf = (digest, ikm, salt, info, keylen) => {
|
|
@@ -27,7 +33,8 @@ crypto.hkdf = (digest, ikm, salt, info, keylen) => {
|
|
|
27
33
|
}
|
|
28
34
|
return T.slice(0, keylen);
|
|
29
35
|
};
|
|
30
|
-
class
|
|
36
|
+
class ReactNativeCrypto extends NodeJsCrypto {
|
|
37
|
+
implementationName = "React Native";
|
|
31
38
|
signEcdsa(privateKey, data, dsaEncoding = "ieee-p1363") {
|
|
32
39
|
const signer = crypto.createSign(CRYPTO_HASH_ALGORITHM);
|
|
33
40
|
if (Array.isArray(data)) {
|
|
@@ -58,8 +65,13 @@ class CryptoReactNative extends NodeJsCrypto {
|
|
|
58
65
|
);
|
|
59
66
|
if (!success) throw new CryptoVerifyError("Signature verification failed");
|
|
60
67
|
}
|
|
68
|
+
// Quick crypto does not support AES-CCM. Install the JS version to compensate
|
|
69
|
+
// TODO - remove this once we have proper feature detection to configure crypto
|
|
70
|
+
encrypt = StandardCrypto.prototype.encrypt;
|
|
71
|
+
decrypt = StandardCrypto.prototype.decrypt;
|
|
61
72
|
}
|
|
73
|
+
Environment.default.set(Crypto, new ReactNativeCrypto());
|
|
62
74
|
export {
|
|
63
|
-
|
|
75
|
+
ReactNativeCrypto
|
|
64
76
|
};
|
|
65
77
|
//# sourceMappingURL=ReactNativeCrypto.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/crypto/ReactNativeCrypto.ts"],
|
|
4
|
-
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,eAAe;AAExB,QAAQ;AAER,
|
|
4
|
+
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,SAAS,eAAe;AAExB,QAAQ;AAER;AAAA,EACI;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,oBAAoB;AAE7B,OAAO,aAAa;AAGpB,OAAO,OAAO,CACV,QACA,KACA,MACA,MACA,WACC;AACD,QAAM,UAAU,SAAS,OAAO,OAAO,CAAC,GAAG,EAAE,KAAK,KAAK;AACvD,QAAM,MAAM,OAEP,WAAW,QAAQ,KAAK,aAAa,OAAO,IAAI,WAAW,OAAO,CAAC,EACnE,OAAO,GAAG,EACV,OAAO;AASZ,QAAM,IAAI,KAAK,KAAK,SAAS,OAAO;AAIpC,QAAM,IAAI,IAAI,WAAW,UAAU,IAAI,KAAK,aAAa,CAAC;AAC1D,MAAI,OA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Q,IAAI,kBAAkB,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matter/react-native",
|
|
3
|
-
"version": "0.15.0-alpha.0-
|
|
3
|
+
"version": "0.15.0-alpha.0-20250616-4b3754906",
|
|
4
4
|
"description": "Experimental React Native support for matter.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iot",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"#*": "./src/*"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@matter/general": "0.15.0-alpha.0-
|
|
39
|
-
"@matter/nodejs": "0.15.0-alpha.0-
|
|
40
|
-
"@matter/protocol": "0.15.0-alpha.0-
|
|
38
|
+
"@matter/general": "0.15.0-alpha.0-20250616-4b3754906",
|
|
39
|
+
"@matter/nodejs": "0.15.0-alpha.0-20250616-4b3754906",
|
|
40
|
+
"@matter/protocol": "0.15.0-alpha.0-20250616-4b3754906",
|
|
41
41
|
"@react-native-async-storage/async-storage": "^2.2.0",
|
|
42
42
|
"@react-native-community/netinfo": "^11.3.2",
|
|
43
43
|
"@types/jwk-to-pem": "^2.0.3",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"react-native-udp": "^4.1.7"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@matter/tools": "0.15.0-alpha.0-
|
|
52
|
+
"@matter/tools": "0.15.0-alpha.0-20250616-4b3754906"
|
|
53
53
|
},
|
|
54
54
|
"overrides": {
|
|
55
55
|
"brorand": "npm:@matter.js/brorand@1.1.0"
|
|
@@ -8,10 +8,16 @@ import { install } from "react-native-quick-crypto";
|
|
|
8
8
|
|
|
9
9
|
install(); // Install the react-native crypto module
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
Crypto,
|
|
13
|
+
CRYPTO_HASH_ALGORITHM,
|
|
14
|
+
CryptoDsaEncoding,
|
|
15
|
+
CryptoVerifyError,
|
|
16
|
+
Environment,
|
|
17
|
+
StandardCrypto,
|
|
18
|
+
} from "#general";
|
|
12
19
|
import { NodeJsCrypto } from "#nodejs";
|
|
13
20
|
|
|
14
|
-
// TODO -
|
|
15
21
|
import jwk2pem from "jwk-to-pem";
|
|
16
22
|
|
|
17
23
|
// @ts-expect-error No types but all fine
|
|
@@ -66,11 +72,10 @@ crypto.hkdf = (
|
|
|
66
72
|
|
|
67
73
|
/**
|
|
68
74
|
* Crypto implementation for React Native
|
|
69
|
-
*
|
|
70
|
-
* We do not install this implementation by default because it is not fully functional. The Node.js crypto
|
|
71
|
-
* compatibility interface in React Native does not implement all features (AES-CCM, at least, is missing).
|
|
72
75
|
*/
|
|
73
|
-
export class
|
|
76
|
+
export class ReactNativeCrypto extends NodeJsCrypto {
|
|
77
|
+
override implementationName = "React Native";
|
|
78
|
+
|
|
74
79
|
override signEcdsa(
|
|
75
80
|
privateKey: JsonWebKey,
|
|
76
81
|
data: Uint8Array | Uint8Array[],
|
|
@@ -113,4 +118,11 @@ export class CryptoReactNative extends NodeJsCrypto {
|
|
|
113
118
|
);
|
|
114
119
|
if (!success) throw new CryptoVerifyError("Signature verification failed");
|
|
115
120
|
}
|
|
121
|
+
|
|
122
|
+
// Quick crypto does not support AES-CCM. Install the JS version to compensate
|
|
123
|
+
// TODO - remove this once we have proper feature detection to configure crypto
|
|
124
|
+
override encrypt = StandardCrypto.prototype.encrypt;
|
|
125
|
+
override decrypt = StandardCrypto.prototype.decrypt;
|
|
116
126
|
}
|
|
127
|
+
|
|
128
|
+
Environment.default.set(Crypto, new ReactNativeCrypto());
|