https://github.com/yngfoxx/web-crypto-hooks
Web Crypto Hooks
https://github.com/yngfoxx/web-crypto-hooks
ecdsa elliptic-curves hooks p256 simple web
Last synced: 14 days ago
JSON representation
Web Crypto Hooks
- Host: GitHub
- URL: https://github.com/yngfoxx/web-crypto-hooks
- Owner: yngfoxx
- Created: 2023-02-19T15:07:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-30T08:23:54.000Z (over 1 year ago)
- Last Synced: 2025-03-02T01:43:17.840Z (over 1 year ago)
- Topics: ecdsa, elliptic-curves, hooks, p256, simple, web
- Language: JavaScript
- Homepage: https://cdn.jsdelivr.net/gh/yngfoxx/web-crypto-hooks/
- Size: 28.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# web-crypto-hooks
Web Crypto Hooks
## Usage
Import hook into your project
### ECDSA hook example
```
const cert = await useECDSA()
const hash = cert.hash('test-message-to-hash')
const sig = await cert.sign(hash)
// verify signature sample
const isValid = await cert.verify(hash, sig)
if (!isValid) {
alert('cert or signature is invalid')
return;
}
const certificate = JSON.stringify({
'hsh': cert.buf2hex(hash.buffer),
'sig': cert.buf2hex(new Uint8Array(sig).buffer),
'pbk': cert.buf2hex(new Uint8Array(pbk).buffer)
})
```