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
4 changes: 2 additions & 2 deletions .github/workflows/validate-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:

- name: Bootstrap JS
run: |
bun install --frozen-lockfile
bun install

- name: Run ESLint (rnqc)
run: |
Expand All @@ -83,4 +83,4 @@ jobs:
bun format:fix

- name: Verify no files have changed after auto-fix
run: git diff --exit-code HEAD
run: git diff --exit-code HEAD -- . ':(exclude)bun.lockb'
Binary file modified bun.lockb
Binary file not shown.
12 changes: 6 additions & 6 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PODS:
- ReactCommon/turbomodule/core
- Yoga
- OpenSSL-Universal (3.3.2000)
- QuickCrypto (1.0.0-beta.5):
- QuickCrypto (1.0.0-beta.6):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1719,8 +1719,8 @@ DEPENDENCIES:
- fmt (from `../../node_modules/react-native/third-party-podspecs/fmt.podspec`)
- glog (from `../../node_modules/react-native/third-party-podspecs/glog.podspec`)
- hermes-engine (from `../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
- NitroModules (from `../node_modules/react-native-nitro-modules`)
- QuickCrypto (from `../node_modules/react-native-quick-crypto`)
- NitroModules (from `../../node_modules/react-native-nitro-modules`)
- QuickCrypto (from `../../node_modules/react-native-quick-crypto`)
- RCT-Folly (from `../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCT-Folly/Fabric (from `../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCTDeprecation (from `../../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation`)
Expand Down Expand Up @@ -1805,9 +1805,9 @@ EXTERNAL SOURCES:
:podspec: "../../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
:tag: hermes-2024-09-09-RNv0.76.0-db6d12e202e15f7a446d8848d6ca8f7abb3cfb32
NitroModules:
:path: "../node_modules/react-native-nitro-modules"
:path: "../../node_modules/react-native-nitro-modules"
QuickCrypto:
:path: "../node_modules/react-native-quick-crypto"
:path: "../../node_modules/react-native-quick-crypto"
RCT-Folly:
:podspec: "../../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec"
RCTDeprecation:
Expand Down Expand Up @@ -1940,7 +1940,7 @@ SPEC CHECKSUMS:
hermes-engine: 46f1ffbf0297f4298862068dd4c274d4ac17a1fd
NitroModules: 55f64932b4581a7d02103bc35b84c7bd3204106b
OpenSSL-Universal: b60a3702c9fea8b3145549d421fdb018e53ab7b4
QuickCrypto: 8d76ae3a0bf60509f671193eb4ed666a80da34cb
QuickCrypto: e68316432823f70bdae0bf1486dc5e9afdfdff4d
RCT-Folly: 84578c8756030547307e4572ab1947de1685c599
RCTDeprecation: fde92935b3caa6cb65cbff9fbb7d3a9867ffb259
RCTRequired: 75c6cee42d21c1530a6f204ba32ff57335d19007
Expand Down
2 changes: 1 addition & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"react-native-bouncy-checkbox": "4.0.1",
"react-native-nitro-modules": "0.18.1",
"react-native-quick-base64": "2.1.2",
"react-native-quick-crypto": "1.0.0-beta.5",
"react-native-quick-crypto": "workspace:*",
"react-native-safe-area-context": "4.14.0",
"react-native-screens": "3.35.0",
"react-native-vector-icons": "^10.1.0",
Expand Down
2 changes: 1 addition & 1 deletion example/src/navigators/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Tab = createBottomTabNavigator();
export const Root: React.FC = () => {
return (
<NavigationContainer>
<Tab.Navigator initialRouteName="Benchmarks">
<Tab.Navigator initialRouteName="Tests">
<Tab.Screen
name="Tests"
component={TestStack}
Expand Down
25 changes: 23 additions & 2 deletions example/src/tests/ed25519/ed25519_tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-expressions */
import { Ed } from 'react-native-quick-crypto';
import { Ed, randomBytes, ab2str } from 'react-native-quick-crypto';
// import type {
// // KeyObject,
// // CFRGKeyPairType,
Expand Down Expand Up @@ -46,11 +46,32 @@ types.map((type) => {
});
*/

test(SUITE, 'sign/verify', async () => {
test(SUITE, 'sign/verify - round trip happy', async () => {
const data = Buffer.from('hello world');
const ed = new Ed('ed25519', {});
await ed.generateKeyPair();
const signature = await ed.sign(data.buffer);
const verified = await ed.verify(signature, data.buffer);
expect(verified).to.be.true;
});

test(SUITE, 'sign/verify - round trip sad', async () => {
const data1 = Buffer.from('hello world');
const data2 = Buffer.from('goodbye cruel world');
const ed = new Ed('ed25519', {});
await ed.generateKeyPair();
const signature = await ed.sign(data1.buffer);
const verified = await ed.verify(signature, data2.buffer);
expect(verified).to.be.false;
});

test(SUITE, 'sign/verify - bad signature does not verify', async () => {
const data = Buffer.from('hello world');
const ed = new Ed('ed25519', {});
await ed.generateKeyPair();
const signature = await ed.sign(data.buffer);
const signature2 = randomBytes(64).buffer;
expect(ab2str(signature2)).not.to.equal(ab2str(signature));
const verified = await ed.verify(signature2, data.buffer);
expect(verified).to.be.false;
});
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
},
{
"file": "example/package.json",
"path": "version"
"path": [
"version",
"dependencies.react-native-quick-crypto"
]
}
]
},
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-quick-crypto/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ global.process.nextTick = setImmediate;
// exports
export default QuickCrypto;
export * from './ed';
export * from './pbkdf2';
export * from './random';
export * from './utils';

// Additional exports for CommonJS compatibility
Expand Down
Loading