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

configure rekor signer (v2 for now) with trustroot #487

Merged
merged 1 commit into from
Aug 30, 2023
Merged

Conversation

loosebazooka
Copy link
Member

Part 1 of plumbing tuf into rekor. I think the only difference between this and the original client is where the url comes from.

20c20,25
< import com.google.api.client.http.*;
---
> import com.google.api.client.http.ByteArrayContent;
> import com.google.api.client.http.GenericUrl;
> import com.google.api.client.http.HttpRequest;
> import com.google.api.client.http.HttpResponse;
> import com.google.api.client.http.HttpResponseException;
> import com.google.common.base.Preconditions;
23a29
> import dev.sigstore.trustroot.TransparencyLog;
26c32,36
< import java.util.*;
---
> import java.util.Arrays;
> import java.util.HashMap;
> import java.util.List;
> import java.util.Locale;
> import java.util.Optional;
29,31c39
< public class RekorClient {
<   public static final String PUBLIC_REKOR_SERVER = "https://rekor.sigstore.dev";
<   public static final String STAGING_REKOR_SERVER = "https://rekor.sigstage.dev";
---
> public class RekorClient2 {
36c44
<   private final URI serverUrl;
---
>   private final TransparencyLog tlog;
38,39c46,47
<   public static RekorClient.Builder builder() {
<     return new RekorClient.Builder();
---
>   public static RekorClient2.Builder builder() {
>     return new RekorClient2.Builder();
42,43c50,51
<   private RekorClient(HttpParams httpParams, URI serverUrl) {
<     this.serverUrl = serverUrl;
---
>   private RekorClient2(HttpParams httpParams, TransparencyLog tlog) {
>     this.tlog = tlog;
48d55
<     private URI serverUrl = URI.create(PUBLIC_REKOR_SERVER);
49a57
>     private TransparencyLog tlog;
54c62
<     public RekorClient.Builder setHttpParams(HttpParams httpParams) {
---
>     public Builder setHttpParams(HttpParams httpParams) {
59,61c67,69
<     /** The fulcio remote server URI, defaults to {@value PUBLIC_REKOR_SERVER}. */
<     public RekorClient.Builder setServerUrl(URI uri) {
<       this.serverUrl = uri;
---
>     /** Configure the remote rekor instance to communicate with. */
>     public Builder setTransparencyLog(TransparencyLog tlog) {
>       this.tlog = tlog;
65,66c73,75
<     public RekorClient build() {
<       return new RekorClient(httpParams, serverUrl);
---
>     public RekorClient2 build() {
>       Preconditions.checkNotNull(tlog);
>       return new RekorClient2(httpParams, tlog);
78c87
<     URI rekorPutEndpoint = serverUrl.resolve(REKOR_ENTRIES_PATH);
---
>     URI rekorPutEndpoint = tlog.getBaseUrl().resolve(REKOR_ENTRIES_PATH);
99c108
<     URI rekorEntryUri = serverUrl.resolve(resp.getHeaders().getLocation());
---
>     URI rekorEntryUri = tlog.getBaseUrl().resolve(resp.getHeaders().getLocation());
110c119
<     URI getEntryURI = serverUrl.resolve(REKOR_ENTRIES_PATH + "/" + UUID);
---
>     URI getEntryURI = tlog.getBaseUrl().resolve(REKOR_ENTRIES_PATH + "/" + UUID);
136c145
<     URI rekorSearchEndpoint = serverUrl.resolve(REKOR_INDEX_SEARCH_PATH);
---
>     URI rekorSearchEndpoint = tlog.getBaseUrl().resolve(REKOR_INDEX_SEARCH_PATH);

Signed-off-by: Appu Goundan <appu@google.com>
@loosebazooka loosebazooka merged commit 08a3c5c into main Aug 30, 2023
13 checks passed
@loosebazooka loosebazooka deleted the tuf-in-rekor1 branch August 30, 2023 15:13
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.

None yet

2 participants