Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/early-dogs-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"jazz-react-native-core": patch
---

Fix the InvalidSignature errors on RNQuickCrypto
55 changes: 55 additions & 0 deletions examples/chat-rn-expo/app.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const { withBuildProperties } = require("expo-build-properties");
const { withDangerousMod } = require("@expo/config-plugins");
const fs = require("fs/promises");
const path = require("path");

/**
* https://github.com/mrousavy/nitro/issues/422#issuecomment-2545988256
*/
function withCustomIosMod(config) {
// Use expo-build-properties to bump iOS deployment target
config = withBuildProperties(config, { ios: { deploymentTarget: "16.0" } });
// Patch the generated Podfile fallback to ensure platform is always 16.0
config = withDangerousMod(config, [
"ios",
async (modConfig) => {
const podfilePath = path.join(
modConfig.modRequest.platformProjectRoot,
"Podfile",
);
let contents = await fs.readFile(podfilePath, "utf-8");

// Check if the IPHONEOS_DEPLOYMENT_TARGET setting is already present
// We search for the key being assigned, e.g., config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] =
const deploymentTargetSettingExists =
/\.build_settings\s*\[\s*['"]IPHONEOS_DEPLOYMENT_TARGET['"]\s*\]\s*=/.test(
contents,
);

if (!deploymentTargetSettingExists) {
// IPHONEOS_DEPLOYMENT_TARGET setting not found, proceed to add it.
contents = contents.replace(
/(post_install\s+do\s+\|installer\|[\s\S]*?)(\r?\n\s end\s*)$/m,
`$1

# Expo Build Properties: force deployment target
# https://github.com/mrousavy/nitro/issues/422#issuecomment-2545988256
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '16.0'
end
end
$2`,
);
}

await fs.writeFile(podfilePath, contents);
return modConfig;
},
]);
return config;
}

module.exports = ({ config }) => {
return withCustomIosMod(config);
};
2 changes: 2 additions & 0 deletions examples/chat-rn-expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
"react-dom": "18.3.1",
"react-native": "0.76.7",
"react-native-get-random-values": "^1.11.0",
"react-native-nitro-modules": "0.25.2",
"react-native-quick-crypto": "1.0.0-beta.15",
"react-native-safe-area-context": "4.12.0",
"react-native-screens": "4.4.0",
"react-native-url-polyfill": "^2.0.0",
Expand Down
2 changes: 2 additions & 0 deletions examples/chat-rn-expo/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import * as Linking from "expo-linking";
import { RNQuickCrypto } from "jazz-expo/crypto";
import React, { StrictMode, useEffect, useState } from "react";
import HandleInviteScreen from "./invite";

Expand Down Expand Up @@ -46,6 +47,7 @@ function App() {
return (
<StrictMode>
<JazzProvider
CryptoProvider={RNQuickCrypto}
sync={{
peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
}}
Expand Down
4 changes: 2 additions & 2 deletions packages/jazz-react-native-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"cojson-transport-ws": "workspace:*",
"jazz-react-core": "workspace:*",
"jazz-tools": "workspace:*",
"react-native-nitro-modules": "0.24.1",
"react-native-quick-crypto": "1.0.0-beta.13"
"react-native-nitro-modules": "0.25.2",
"react-native-quick-crypto": "1.0.0-beta.15"
},
"devDependencies": {
"typescript": "catalog:"
Expand Down
8 changes: 0 additions & 8 deletions packages/jazz-react-native-core/src/crypto/RNQuickCrypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ export class RNQuickCrypto extends PureJSCrypto {
return new Uint8Array(this.ed.getPrivateKey());
}

getSignerID(
secret: CojsonInternalTypes.SignerSecret,
): CojsonInternalTypes.SignerID {
return `signer_z${base58.encode(
base58.decode(secret.substring("signerSecret_z".length)),
)}`;
}

sign(
secret: CojsonInternalTypes.SignerSecret,
message: JsonValue,
Expand Down
45 changes: 33 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.