An open API service indexing awesome lists of open source software.

https://github.com/dimensiondev/secp256k1-webcrypto

WebCrypto API with secp256k1 support
https://github.com/dimensiondev/secp256k1-webcrypto

Last synced: 10 months ago
JSON representation

WebCrypto API with secp256k1 support

Awesome Lists containing this project

README

          

# secp256k1-webcrypto

WebCrypto API with secp256k1 support.

This is a light version of that only contains secp256k1 support.

Thanks to `PeculiarVentures` for their webcrypto-liner!

## Usage

```js
import { crypto, Crypto, CryptoKey, SubtleCrypto, polyfill } from '@masknet/secp256k1-webcrypto'
crypto // a polyfilled Crypto instance
crypto.subtle // a polyfilled SubtleCrypto instance
polyfill() // install the polyfill on the global object
```

## Requirement

- Node: Have [native WebCrypto](https://nodejs.org/api/webcrypto.html#web-crypto-api) support.
- Web: Have [native WebCrypro](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto) support.

You can create your own instance by

```js
import { createCrypto } from '@masknet/secp256k1-webcrypto/core'

export const [crypto, { Crypto, CryptoKey, SubtleCrypto }, polyfill] = createCrypto(
globalThis.crypto,
globalThis.CryptoKey,
DOMException,
)
```

## Unsupported

- spki format import/export