Skip to content
This repository was archived by the owner on Feb 12, 2026. It is now read-only.

Commit a2ec67a

Browse files
authored
Merge pull request #44 from SignPath/feature/SIGN-8057
Feature/sign 8057
2 parents 22bcc18 + 752d05e commit a2ec67a

14 files changed

Lines changed: 201 additions & 183 deletions
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export class ConnectorUrlBuilder {
2+
private readonly apiVersion: string = "1.0";
3+
private readonly baseSigningRequestsRoute: string;
4+
5+
constructor(private readonly connectorBaseUrl: string, private readonly organizationId: string) {
6+
this.connectorBaseUrl = this.trimSlash(this.connectorBaseUrl);
7+
this.baseSigningRequestsRoute = `${this.connectorBaseUrl}/${encodeURIComponent(this.organizationId)}/SigningRequests`
8+
}
9+
10+
public buildSubmitSigningRequestUrl(): string {
11+
return `${this.baseSigningRequestsRoute}?api-version=${this.apiVersion}`
12+
}
13+
14+
public buildGetSigningRequestStatusUrl(signingRequestId: string): string {
15+
return `${this.baseSigningRequestsRoute}/${encodeURIComponent(signingRequestId)}/Status?api-version=${this.apiVersion}`
16+
}
17+
18+
public buildGetSignedArtifactUrl(signingRequestId: string): string {
19+
return `${this.baseSigningRequestsRoute}/${encodeURIComponent(signingRequestId)}/SignedArtifact?api-version=${this.apiVersion}`
20+
}
21+
22+
private trimSlash(text: string): string {
23+
if (text && text[text.length - 1] === '/') {
24+
return text.substring(0, text.length - 1);
25+
}
26+
return text;
27+
}
28+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface SigningRequestStatusDto {
2+
status: string;
3+
isFinalStatus: boolean;
4+
webLink: string;
5+
hasArtifactBeenDownloadedBySignPathInCaseOfArtifactRetrieval: boolean;
6+
}

actions/submit-signing-request/dtos/signing-request.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.

actions/submit-signing-request/helper-artifact-download.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as path from 'path';
44
import * as nodeStreamZip from 'node-stream-zip';
55
import axios, { AxiosError } from 'axios';
66
import { HelperInputOutput } from "./helper-input-output";
7-
import { buildSignPathAuthorizationHeader, httpErrorResponseToText } from './utils';
7+
import { httpErrorResponseToText } from './utils';
88
import { TimeoutStream } from './timeout-stream';
99

1010

@@ -19,14 +19,11 @@ export class HelperArtifactDownload {
1919

2020
const response = await axios.get(artifactDownloadUrl, {
2121
responseType: 'stream',
22-
timeout: timeoutMs,
23-
headers: {
24-
Authorization: buildSignPathAuthorizationHeader(this.helperInputOutput.signPathApiToken)
25-
}
22+
timeout: timeoutMs
2623
})
27-
.catch((e: AxiosError) => {
28-
throw new Error(httpErrorResponseToText(e));
29-
});
24+
.catch((e: AxiosError) => {
25+
throw new Error(httpErrorResponseToText(e));
26+
});
3027

3128
const targetDirectory = this.resolveOrCreateDirectory(this.helperInputOutput.outputArtifactDirectory);
3229

@@ -67,8 +64,8 @@ export class HelperArtifactDownload {
6764
core.info(`The signed artifact has been successfully downloaded from SignPath and extracted to ${targetDirectory}`);
6865
}
6966

70-
public resolveOrCreateDirectory(directoryPath:string): string {
71-
const workingDirectory = process.env.GITHUB_WORKSPACE as string;
67+
public resolveOrCreateDirectory(directoryPath: string): string {
68+
const workingDirectory = process.env.GITHUB_WORKSPACE as string;
7269
const absolutePath = path.isAbsolute(directoryPath) ? directoryPath :
7370
path.join(workingDirectory as string, directoryPath);
7471

actions/submit-signing-request/helper-input-output.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,4 @@ export class HelperInputOutput {
7171
setSigningRequestWebUrl(signingRequestUrl: string): void {
7272
core.setOutput('signing-request-web-url', signingRequestUrl);
7373
}
74-
75-
setSignPathApiUrl(signingRequestUrl: string): void {
76-
core.setOutput('signpath-api-url', signingRequestUrl);
77-
}
7874
}

actions/submit-signing-request/signpath-url-builder.ts

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)