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

Use a more familiar builder API #36

Merged
merged 1 commit into from
Feb 7, 2022
Merged

Use a more familiar builder API #36

merged 1 commit into from
Feb 7, 2022

Conversation

cyberdelia
Copy link
Contributor

Use a more familiar builder API and Java methods name, essentially not exposing MacaroonsBuilder directly but via Macaroon.builder() methods, and changing the builders method to be more inline with Java naming conventions.

Macaroon macaroon = Macaroon.builder(location, secretKey, identifier)
    .addCaveat("time < 2042-01-01T00:00")
    .addCaveat("http://auth.mybank/", caveat_key, identifier)
    .build();

This also moves all static methods that returns a Macaroon directly has a static method of Macaroon itself:

Macaroon.create(location, secretKey, identifier);
Macaroon.deserialize(serialized);

This is entirely backward compatible for now, but all methods that would need to be changed or removed in the future have been marked as deprecated.

@nitram509 nitram509 merged commit 179c388 into nitram509:master Feb 7, 2022
@cyberdelia cyberdelia deleted the builders branch February 7, 2022 22:48
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

Successfully merging this pull request may close these issues.

2 participants