Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate jws.Sign variadic parameter options functions #98

Open
KendallWeihe opened this issue Feb 29, 2024 · 0 comments
Open

Duplicate jws.Sign variadic parameter options functions #98

KendallWeihe opened this issue Feb 29, 2024 · 0 comments

Comments

@KendallWeihe
Copy link
Contributor

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.

// 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
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant