Skip to content

Commit

Permalink
chore: use global bytelength variable
Browse files Browse the repository at this point in the history
  • Loading branch information
dcangulo committed Aug 10, 2022
1 parent ee5a0d7 commit bd13efb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOGS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelogs

## 5.1.0 (2022-08-10)
* Used global bytelength variable.

## 5.0.1 (2022-08-10)
* Removed extra files published to npm.

Expand Down
3 changes: 2 additions & 1 deletion cpp/random-bytes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ namespace randombytes
const Value *arguments,
size_t count) -> Value
{
vector<uint8_t> buffer(96, 0);
int byteLength = arguments[0].getNumber();
vector<uint8_t> buffer(byteLength, 0);
arc4random_buf(&buffer[0],
buffer.size());

Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-pkce-challenge",
"version": "5.0.2",
"version": "5.1.0",
"description": "Proof Key for Code Exchange (PKCE) challenge generator for React Native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down Expand Up @@ -31,7 +31,8 @@
"react-native-macos",
"PKCE",
"oauth2",
"jsi"
"jsi",
"c++"
],
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/generate-random-bytes.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function generateRandomBytes(): string {
}

if ((global as any).RNPkceChallenge) {
const bytes = (global as any).RNPkceChallenge.randomBytes();
const bytes = (global as any).RNPkceChallenge.randomBytes(BYTE_LENGTH);

return bytes;
}
Expand Down

0 comments on commit bd13efb

Please sign in to comment.