decentralized-identity / decentralized-identity/web5-go

Duplicate jws.Sign variadic parameter options functions

Open
#98 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
21
Forks
7
PR merge metrics
No merged PRs in 30d

Description

These three functions in `jws/jws.go` are all semantically equivalent. Albeit the first two are identical function signatures so we can definitely remove one, but the third is a different signature but the same functionality, consider narrowing this down to a single function.

```go
// Purpose is an option that can be passed to [github.com/tbd54566975/web5-go/jws.Sign].
// It is used to select the appropriate key to sign with
func Purpose(p string) SignOpt {
return func(opts *signOpts) {
opts.selector = didcore.Purpose(p)
}
}

// VerificationMethod is an option that can be passed to [github.com/tbd54566975/web5-go/jws.Sign].
// It is used to select the appropriate key to sign with
func VerificationMethod(id string) SignOpt {
return func(opts *signOpts) {
opts.selector = didcore.ID(id)
}
}

// VMSelector is an option that can be passed to [github.com/tbd54566975/web5-go/jws.Sign].
// It is used to select the appropriate key to sign with
func VMSelector(selector didcore.VMSelector) SignOpt {
return func(opts *signOpts) {
opts.selector = selector
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.