package main
import (
"fmt"
"github.com/decentralized-identity/web5-go/didjwk"
"github.com/decentralized-identity/web5-go/jwt"
)
func main() {
did, err := didjwk.Create()
if err != nil {
panic(err)
}
claims := jwt.Claims{
Issuer: did.URI,
Misc: map[string]interface{}{"c_nonce": "abcd123"},
}
jwt, err := jwt.Sign(claims, did)
if err != nil {
panic(err)
}
}
package main
import (
"fmt"
"github.com/decentralized-identity/web5-go/dids"
"github.com/decentralized-identity/web5-go/jwt"
)
func main() {
someJWT := "SOME_JWT"
ok, err := jwt.Verify(signedJWT)
if err != nil {
panic(err)
}
if (!ok) {
fmt.Printf("dookie JWT")
}
}
specifying a specific category of key to use relative to the did provided can be done in the same way shown with jws.Sign
jwt
├── jwt.go
└── jwt_test.go
same as jws
.