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
- Host: GitHub
- URL: https://github.com/dimensiondev/secp256k1-webcrypto
- Owner: DimensionDev
- License: mit
- Created: 2022-04-07T08:58:21.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-01T07:12:21.000Z (over 3 years ago)
- Last Synced: 2024-10-16T09:32:59.202Z (over 1 year ago)
- Language: TypeScript
- Size: 64.5 KB
- Stars: 5
- Watchers: 8
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
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