Skip to content

Commit

Permalink
Fix checking WebCrypto existence
Browse files Browse the repository at this point in the history
  • Loading branch information
krasun committed Sep 27, 2023
1 parent dc5e51f commit 5b5bffb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "screenshotone-api-sdk",
"homepage": "https://screenshotone.com",
"version": "1.1.3",
"version": "1.1.4",
"description": "Use ScreenshotOne.com API to generate screenshots of any website.",
"repository": {
"type": "git",
Expand Down
5 changes: 4 additions & 1 deletion src/signature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { Crypto } from "@peculiar/webcrypto";
const encoder = new TextEncoder();

export async function signQueryString(queryString: string, secretKey: string) {
const webCrypto = crypto ? crypto : new Crypto();
const webCrypto =
typeof globalThis.crypto !== "undefined"
? globalThis.crypto
: new Crypto();

let algorithm = { name: "HMAC", hash: "SHA-256" };
let key = await webCrypto.subtle.importKey(
Expand Down

0 comments on commit 5b5bffb

Please sign in to comment.