Skip to content

Commit

Permalink
make sure sodium is not an empty object in service workers (#567)
Browse files Browse the repository at this point in the history
* make sure sodium is not an empty object in service workers

* Update CHANGELOG.md

Co-authored-by: George <[email protected]>

Co-authored-by: George <[email protected]>
  • Loading branch information
piyalbasu and Shaptic authored Dec 13, 2022
1 parent 0e26959 commit f508a02
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@

## Unreleased

## [v8.2.2](https://github.com/stellar/js-stellar-base/compare/v8.2.1..v8.2.2)

### Fix

- Enable signing in service workers using FastSigning ([#567](https://github.com/stellar/js-stellar-base/pull/567)).

## [v8.2.1](https://github.com/stellar/js-stellar-base/compare/v8.2.0..v8.2.1)

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stellar-base",
"version": "8.2.1",
"version": "8.2.2",
"description": "Low level stellar support library",
"main": "./lib/index.js",
"types": "./types/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions src/signing.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ function checkFastSigningNode() {
return checkFastSigningBrowser();
}

if (!Object.keys(sodium).length) {
return checkFastSigningBrowser();
}

actualMethods.generate = (secretKey) => {
const pk = Buffer.alloc(sodium.crypto_sign_PUBLICKEYBYTES);
const sk = Buffer.alloc(sodium.crypto_sign_SECRETKEYBYTES);
Expand Down

0 comments on commit f508a02

Please sign in to comment.