Skip to content

Commit

Permalink
[worker] add some doc
Browse files Browse the repository at this point in the history
  • Loading branch information
clangenb committed May 1, 2024
1 parent 3ec349d commit 33600bf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/worker-api/src/webCryptoRSA.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import BN from "bn.js";

type CryptoKey = import("crypto").KeyObject | import("@peculiar/webcrypto").CryptoKey;

/**
* Provides crypto in both, the browser and in the node-js environment (like our tests)
* via the `@peculiar/webcrypto` polyfill.
*/
let cryptoProvider: any;

if (typeof window !== "undefined" && typeof window.crypto !== "undefined") {
Expand All @@ -11,6 +13,12 @@ if (typeof window !== "undefined" && typeof window.crypto !== "undefined") {
cryptoProvider = new Crypto();
}

/**
* Type dependent on our environment browser vs. node-js.
*/
type CryptoKey = import("crypto").KeyObject | import("@peculiar/webcrypto").CryptoKey;


export async function parseWebCryptoRSA(data: any): Promise<CryptoKey> {
const keyJson = JSON.parse(data);

Expand Down

0 comments on commit 33600bf

Please sign in to comment.