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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
tsconfig.tsbuildinfo
package-lock.json
.vscode/settings.json
.vscode/mcp.json
Binary file modified bun.lockb
Binary file not shown.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"version": "0.7.14",
"version": "0.7.17",
"scripts": {
"clean": "bun --filter='*' clean",
"deepclean": "bun --filter='*' deepclean && del-cli node_modules",
"specs": "bun --filter='react-native-quick-crypto' specs",
"specs": "bun --filter='@coolwallet-app/react-native-quick-crypto' specs",
"bundle-install": "bun --filter='react-native-quick-crypto-example' bundle-install",
"pods": "bun --filter='react-native-quick-crypto-example' pods",
"start": "cd packages/example && bun start",
Expand All @@ -13,7 +13,7 @@
"lint:fix": "bun --filter='*' lint:fix",
"format": "bun --filter='*' format",
"format:fix": "bun --filter='*' format:fix",
"prepare": "bun --filter=\"react-native-quick-crypto\" prepare",
"prepare": "bun --filter=\"@coolwallet-app/react-native-quick-crypto\" prepare",
"release": "./scripts/release.sh"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ PODS:
- react-native-quick-base64 (2.1.2):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- react-native-quick-crypto (0.7.15):
- react-native-quick-crypto (0.7.17):
- OpenSSL-Universal
- RCT-Folly (= 2021.07.22.00)
- React
Expand Down Expand Up @@ -628,7 +628,7 @@ SPEC CHECKSUMS:
React-logger: 8edc785c47c8686c7962199a307015e2ce9a0e4f
react-native-fast-encoder: 6f59e9b08e2bc5a8bf1f36e1630cdcfd66dd18af
react-native-quick-base64: 61228d753294ae643294a75fece8e0e80b7558a6
react-native-quick-crypto: 0e6636e4a9ae327d710d3eee75f1c105584636bd
react-native-quick-crypto: c63f09c36b5e03ee0cb6b03cc2de296fb6ff3f0f
react-native-safe-area-context: 141eca0fd4e4191288dfc8b96a7c7e1c2983447a
React-NativeModulesApple: b6868ee904013a7923128892ee4a032498a1024a
React-perflogger: 31ea61077185eb1428baf60c0db6e2886f141a5a
Expand Down
4 changes: 2 additions & 2 deletions packages/example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "react-native-quick-crypto-example",
"description": "Example app for react-native-quick-crypto",
"version": "0.7.15",
"version": "0.7.17",
"private": true,
"packageManager": "[email protected]",
"scripts": {
Expand Down Expand Up @@ -33,7 +33,7 @@
"react-native": "0.72.7",
"react-native-fast-encoder": "^0.1.12",
"react-native-quick-base64": "^2.1.2",
"react-native-quick-crypto": "0.7.15",
"react-native-quick-crypto": "0.7.17",
"react-native-safe-area-context": "^4.5.0",
"react-native-screens": "3.35.0",
"readable-stream": "^4.5.2",
Expand Down
30 changes: 22 additions & 8 deletions packages/example/src/testing/tests/webcryptoTests/import_export.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import { assert, expect } from 'chai';
import { Buffer } from '@craftzdog/react-native-buffer';
import { assert, expect } from 'chai';
import {
fromByteArray,
toByteArray,
trimBase64Padding,
} from 'react-native-quick-base64';
import crypto from 'react-native-quick-crypto';
import { describe, it } from '../../MochaRNAdapter';
import {
ab2str,
binaryLikeToArrayBuffer,
} from '../../../../../react-native-quick-crypto/src/Utils';
import { assertThrowsAsync } from '../util';
import type {
CryptoKey,
CryptoKeyPair,
Expand All @@ -23,8 +17,14 @@ import type {
SubtleAlgorithm,
} from '../../../../../react-native-quick-crypto/src/keys';
import type { RandomTypedArrays } from '../../../../../react-native-quick-crypto/src/random';
import pubTestKeyEc256 from '../../fixtures/keys/ec_p256_public';
import {
ab2str,
binaryLikeToArrayBuffer,
} from '../../../../../react-native-quick-crypto/src/Utils';
import privTestKeyEc256 from '../../fixtures/keys/ec_p256_private';
import pubTestKeyEc256 from '../../fixtures/keys/ec_p256_public';
import { describe, it } from '../../MochaRNAdapter';
import { assertThrowsAsync } from '../util';

const { subtle, createPublicKey, createPrivateKey } = crypto;

Expand Down Expand Up @@ -132,6 +132,20 @@ describe('subtle - importKey / exportKey', () => {
);
});

it(' importKey - raw - pbkdf2 - empty byte source #735', async () => {
const key = await crypto.subtle.importKey(
'raw',
new Uint8Array(),
{
name: 'PBKDF2',
hash: 'SHA-256',
},
false,
['deriveBits', 'deriveKey'],
);
expect(key).to.not.equal(null);
});

// Import/Export AES Secret Key
{
it('AES import raw / export raw', async () => {
Expand Down
5 changes: 3 additions & 2 deletions packages/react-native-quick-crypto/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ android {
externalNativeBuild {
cmake {
cppFlags "-O2 -frtti -fexceptions -Wall -Wno-unused-variable -fstack-protector-all -DANDROID"
arguments "-DANDROID_STL=c++_shared"
arguments "-DANDROID_STL=c++_shared",
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
abiFilters (*reactNativeArchitectures())
}
}
Expand Down Expand Up @@ -175,7 +176,7 @@ dependencies {
implementation "com.facebook.react:react-android:+"

// Add a dependency on OpenSSL
implementation 'io.github.ronickg:openssl:3.3.2'
implementation 'io.github.ronickg:openssl:3.3.2-1'
}

// Resolves "LOCAL_SRC_FILES points to a missing file, Check that libfb.so exists or that its path is correct".
Expand Down
1 change: 0 additions & 1 deletion packages/react-native-quick-crypto/cpp/MGLKeys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,6 @@ KeyObjectData::KeyObjectData(KeyType type,

std::shared_ptr<KeyObjectData> KeyObjectData::CreateSecret(ByteSource key)
{
CHECK(key);
return std::shared_ptr<KeyObjectData>(new KeyObjectData(std::move(key)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
#include <assert.h>
#include <string.h>
#if defined(__GNUC__)
#include <endian.h>
#if TARGET_OS_MACCATALYST
#include <machine/endian.h> // Mac Catalyst
#else
#include <endian.h> // iOS
#endif
#endif

#include <openssl/sha.h>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-quick-crypto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coolwallet-app/react-native-quick-crypto",
"version": "0.7.15",
"version": "0.7.17",
"description": "A fast implementation of Node's `crypto` module written in C/C++ JSI",
"packageManager": "[email protected]",
"main": "lib/commonjs/index",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native-quick-crypto/src/pbkdf2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function pbkdf2Sync(
iterations: number,
keylen: number,
digest?: string,
): ArrayBuffer {
): Buffer {
const sanitizedPassword = sanitizeInput(password, WRONG_PASS);
const sanitizedSalt = sanitizeInput(salt, WRONG_SALT);
const algo = digest ? normalizeHashName(digest, HashContext.Node) : 'sha1';
Expand All @@ -83,7 +83,7 @@ export function pbkdf2Sync(
algo,
);

return result;
return Buffer.from(result);
}

// We need this because the typescript overload signatures in pbkdf2() above do
Expand Down