Closed mistermoe closed 7 months ago
secp256k1
ed25519
ecdsa
eddsa
dsa
[!IMPORTANT] Adding this functionality for upcoming did:dht creation PR
did:dht
package main import ( "encoding/hex" "fmt" "github.com/tbd54566975/web5-go/crypto/dsa" "github.com/tbd54566975/web5-go/crypto/dsa/ecdsa" "github.com/tbd54566975/web5-go/jwk" ) func main() { jwk := jwk.JWK{ KTY: "EC", CRV: ecdsa.SECP256K1JWACurve, X: "eb5mfvncu6xVoGKVzocLBwKb_NstzijZWfKBWxb4F5g", Y: "SDradyajxGVdpPv8DhEIqP0XtEimhVQZnEfQj_sQ1Lg", } pubKeyBytes, err := dsa.PublicKeyToBytes(jwk) if err != nil { panic(err) } fmt.Println(hex.EncodeToString(pubKeyBytes)) }
I really want to restructure the crypto package to be a bit cleaner. Specifically,
@mihai-chiorean this should help convert JWKs to the format expected in did:dht DNS records
Overview
secp256k1
public key jwk -> bytesed25519
public key jwk -> bytesecdsa
,eddsa
, anddsa
Usage
High Level API
Internal Dialogue
I really want to restructure the crypto package to be a bit cleaner. Specifically,
secp256k1
anded25519
up and into their own packages. These key types are applicable beyond DSA (e.g. ECDH)