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

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

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)
})

```