https://github.com/nichoth/ssc-keys
https://github.com/nichoth/ssc-keys
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/nichoth/ssc-keys
- Owner: nichoth
- Created: 2022-04-08T23:17:44.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-02-15T22:08:12.000Z (over 1 year ago)
- Last Synced: 2025-03-24T06:22:15.399Z (over 1 year ago)
- Language: JavaScript
- Size: 782 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ssc keys
Key operations for web browsers.
This uses the [one-webcrypto](https://github.com/fission-suite/one-webcrypto) API, so the [WebCrypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) in a browser.
This is used to create keys that are visible as strings in a web browser, for use with [ssc-server](https://github.com/nichoth/ssc-server)
## install
```
npm i ssc-keys
```
## example
```js
import { create } from 'ssc-keys'
create().then(kp => {
console.log('*kp*', kp)
// =>
// *kp*
// {
// "publicKey": "BPVcET2JN9HP3M3BaXGAtcZHDmKSrRjbSUXUFPjY+bS4wHesYEqKHIhKCx4mSQb4aZaA5eeRrK73SPWvIxqfXwY=",
// "privateKey": "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgjBVEyaAeWR63att0e9guTZpPI9ptabkz+TUpntepf+qhRANCAAT1XBE9iTfRz9zNwWlxgLXGRw5ikq0Y20lF1BT42Pm0uMB3rGBKihyISgseJkkG+GmWgOXnkayu90j1ryMan18G"
// }
})
```
Keys are created with this algorithm
```js
// (algorithm, extractable, uses)
webcrypto.subtle.generateKey({
name: 'ECDSA',
namedCurve: 'P-256'
}, true, ['sign', 'verify'])
```