Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neeboo/schnorr_snap
A schnorr plugin for metamask snap, nostr supported
https://github.com/neeboo/schnorr_snap
Last synced: 24 days ago
JSON representation
A schnorr plugin for metamask snap, nostr supported
- Host: GitHub
- URL: https://github.com/neeboo/schnorr_snap
- Owner: neeboo
- Created: 2022-12-20T15:06:42.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-21T03:54:13.000Z (almost 2 years ago)
- Last Synced: 2024-02-17T05:33:55.367Z (10 months ago)
- Language: TypeScript
- Homepage:
- Size: 316 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-nostr - schorr_snap - A snap plugin for Metamask Flask, supports nostr (Libraries / Client reviews and/or comparisons)
README
# SchnorrSnap
## Quick Start
```bash
yarn install && yarn build:all && yarn demo:local
```## Example code,
In [packages/example/frontend/Intro.tsx](./packages/example/frontend/Intro.tsx)
```typescript
import { initiateSchnorrSnap } from "./services/metamask"
import { SnapIdentity } from "@astrox/schnorr-adapter"
import { SignRawMessageResponse } from "@astrox/schnorr-types"...
const [snapIdentity, setSnapIdentity] = useState(
undefined,
)const installSnap = useCallback(async () => {
// you can customize initiateSchnorrSnap with your function, hooks, or service what ever
// pass network type `mainnet`, `local`, or `nostr`
// coinType in derived path will be different, mainnet and local will be 0, nostr will be 1237 (NIP-06)
const installResult = await initiateSchnorrSnap("nostr")
if (!installResult.isSnapInstalled) {
setInstalled(false)
} else {
setInstalled(true)
setSnapIdentity(await installResult.snap?.createSnapIdentity())
}
}, [])const getPublicKey = async () => {
setPublicKey(snapIdentity?.publicKey)
}const signMessage = async () => {
const signed = await snapIdentity?.api.sign(message!)
setSignedMessage(signed!)
}
...```
## Components and install instructions
1. [Download Metamask Flask](https://metamask.io/flask/)
and uninstall/disable old metamask2. Go to example page or any supported page, install SchnorrSnap before run
3. Can sign message afterwards
## How it works
1. Develope Metamask Flask Snap project
2. Use Secp256k1Key(Schnorr) identity inside snap
3. Get identity and signing method for web app## Use cases
1. Use Metamask as your schnorr wallet
2. Access NoStr