diff --git a/apps/console/src/pages/iam/organizations/settings/_components/OrganizationForm.tsx b/apps/console/src/pages/iam/organizations/settings/_components/OrganizationForm.tsx
index d6e8fa3e0..a09b0ab68 100644
--- a/apps/console/src/pages/iam/organizations/settings/_components/OrganizationForm.tsx
+++ b/apps/console/src/pages/iam/organizations/settings/_components/OrganizationForm.tsx
@@ -211,6 +211,7 @@ export function OrganizationForm(props: {
- {trustCenter.organization.logoUrl
+ {trustCenter.logoFileUrl
? (
)
diff --git a/apps/trust/src/queries/TrustGraph.ts b/apps/trust/src/queries/TrustGraph.ts
index a8a2d20a0..63ad05efa 100644
--- a/apps/trust/src/queries/TrustGraph.ts
+++ b/apps/trust/src/queries/TrustGraph.ts
@@ -12,13 +12,14 @@ export const currentTrustGraphQuery = graphql`
slug
isViewerMember
hasAcceptedNonDisclosureAgreement
+ logoFileUrl
+ darkLogoFileUrl
ndaFileName
ndaFileUrl
organization {
name
description
websiteUrl
- logoUrl
email
headquarterAddress
}
diff --git a/apps/trust/src/queries/__generated__/TrustGraphCurrentQuery.graphql.ts b/apps/trust/src/queries/__generated__/TrustGraphCurrentQuery.graphql.ts
index 6165f0c9a..2faccd99a 100644
--- a/apps/trust/src/queries/__generated__/TrustGraphCurrentQuery.graphql.ts
+++ b/apps/trust/src/queries/__generated__/TrustGraphCurrentQuery.graphql.ts
@@ -1,5 +1,5 @@
/**
- * @generated SignedSource<<3dbd64be3b8852cb9bfca995f648dd65>>
+ * @generated SignedSource<<6ca2f281af2d0dfbe388980e05bc8d0c>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -21,16 +21,17 @@ export type TrustGraphCurrentQuery$data = {
};
}>;
};
+ readonly darkLogoFileUrl: string | null | undefined;
readonly hasAcceptedNonDisclosureAgreement: boolean;
readonly id: string;
readonly isViewerMember: boolean;
+ readonly logoFileUrl: string | null | undefined;
readonly ndaFileName: string | null | undefined;
readonly ndaFileUrl: string | null | undefined;
readonly organization: {
readonly description: string | null | undefined;
readonly email: string | null | undefined;
readonly headquarterAddress: string | null | undefined;
- readonly logoUrl: string | null | undefined;
readonly name: string;
readonly websiteUrl: string | null | undefined;
};
@@ -97,52 +98,59 @@ v6 = {
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "ndaFileName",
+ "name": "logoFileUrl",
"storageKey": null
},
v7 = {
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "ndaFileUrl",
+ "name": "darkLogoFileUrl",
"storageKey": null
},
v8 = {
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "name",
+ "name": "ndaFileName",
"storageKey": null
},
v9 = {
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "description",
+ "name": "ndaFileUrl",
"storageKey": null
},
v10 = {
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "websiteUrl",
+ "name": "name",
"storageKey": null
},
v11 = {
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "logoUrl",
+ "name": "description",
"storageKey": null
},
v12 = {
"alias": null,
"args": null,
"kind": "ScalarField",
- "name": "headquarterAddress",
+ "name": "websiteUrl",
"storageKey": null
},
v13 = {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "headquarterAddress",
+ "storageKey": null
+},
+v14 = {
"alias": "vendorInfo",
"args": [
{
@@ -166,35 +174,35 @@ v13 = {
],
"storageKey": "vendors(first:0)"
},
-v14 = [
+v15 = [
{
"kind": "Literal",
"name": "first",
"value": 50
}
],
-v15 = {
+v16 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "category",
"storageKey": null
},
-v16 = [
+v17 = [
{
"kind": "Literal",
"name": "first",
"value": 5
}
],
-v17 = {
+v18 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "isUserAuthorized",
"storageKey": null
},
-v18 = {
+v19 = {
"alias": null,
"args": null,
"kind": "ScalarField",
@@ -235,6 +243,8 @@ return {
(v5/*: any*/),
(v6/*: any*/),
(v7/*: any*/),
+ (v8/*: any*/),
+ (v9/*: any*/),
{
"alias": null,
"args": null,
@@ -243,12 +253,11 @@ return {
"name": "organization",
"plural": false,
"selections": [
- (v8/*: any*/),
- (v9/*: any*/),
(v10/*: any*/),
(v11/*: any*/),
+ (v12/*: any*/),
(v0/*: any*/),
- (v12/*: any*/)
+ (v13/*: any*/)
],
"storageKey": null
},
@@ -257,10 +266,10 @@ return {
"kind": "FragmentSpread",
"name": "OverviewPageFragment"
},
- (v13/*: any*/),
+ (v14/*: any*/),
{
"alias": null,
- "args": (v14/*: any*/),
+ "args": (v15/*: any*/),
"concreteType": "AuditConnection",
"kind": "LinkedField",
"name": "audits",
@@ -338,6 +347,8 @@ return {
(v5/*: any*/),
(v6/*: any*/),
(v7/*: any*/),
+ (v8/*: any*/),
+ (v9/*: any*/),
{
"alias": null,
"args": null,
@@ -346,12 +357,11 @@ return {
"name": "organization",
"plural": false,
"selections": [
- (v8/*: any*/),
- (v9/*: any*/),
(v10/*: any*/),
(v11/*: any*/),
- (v0/*: any*/),
(v12/*: any*/),
+ (v0/*: any*/),
+ (v13/*: any*/),
(v2/*: any*/)
],
"storageKey": null
@@ -387,9 +397,15 @@ return {
"plural": false,
"selections": [
(v2/*: any*/),
- (v8/*: any*/),
- (v11/*: any*/),
- (v10/*: any*/)
+ (v10/*: any*/),
+ {
+ "alias": null,
+ "args": null,
+ "kind": "ScalarField",
+ "name": "logoUrl",
+ "storageKey": null
+ },
+ (v12/*: any*/)
],
"storageKey": null
}
@@ -437,9 +453,9 @@ return {
"name": "countries",
"storageKey": null
},
- (v8/*: any*/),
- (v15/*: any*/),
(v10/*: any*/),
+ (v16/*: any*/),
+ (v12/*: any*/),
{
"alias": null,
"args": null,
@@ -458,7 +474,7 @@ return {
},
{
"alias": null,
- "args": (v16/*: any*/),
+ "args": (v17/*: any*/),
"concreteType": "DocumentConnection",
"kind": "LinkedField",
"name": "documents",
@@ -488,8 +504,8 @@ return {
"name": "title",
"storageKey": null
},
- (v17/*: any*/),
(v18/*: any*/),
+ (v19/*: any*/),
{
"alias": null,
"args": null,
@@ -508,7 +524,7 @@ return {
},
{
"alias": null,
- "args": (v16/*: any*/),
+ "args": (v17/*: any*/),
"concreteType": "TrustCenterFileConnection",
"kind": "LinkedField",
"name": "trustCenterFiles",
@@ -531,10 +547,10 @@ return {
"plural": false,
"selections": [
(v2/*: any*/),
- (v15/*: any*/),
- (v8/*: any*/),
- (v17/*: any*/),
- (v18/*: any*/)
+ (v16/*: any*/),
+ (v10/*: any*/),
+ (v18/*: any*/),
+ (v19/*: any*/)
],
"storageKey": null
}
@@ -544,10 +560,10 @@ return {
],
"storageKey": "trustCenterFiles(first:5)"
},
- (v13/*: any*/),
+ (v14/*: any*/),
{
"alias": null,
- "args": (v14/*: any*/),
+ "args": (v15/*: any*/),
"concreteType": "AuditConnection",
"kind": "LinkedField",
"name": "audits",
@@ -586,8 +602,8 @@ return {
"name": "filename",
"storageKey": null
},
- (v17/*: any*/),
- (v18/*: any*/)
+ (v18/*: any*/),
+ (v19/*: any*/)
],
"storageKey": null
},
@@ -600,7 +616,7 @@ return {
"plural": false,
"selections": [
(v2/*: any*/),
- (v8/*: any*/),
+ (v10/*: any*/),
{
"alias": null,
"args": null,
@@ -633,16 +649,16 @@ return {
]
},
"params": {
- "cacheID": "211acd806d18a69efb76df5c7e6822bc",
+ "cacheID": "f0861cffe9c1b2e60c6408a69ce5690f",
"id": null,
"metadata": {},
"name": "TrustGraphCurrentQuery",
"operationKind": "query",
- "text": "query TrustGraphCurrentQuery {\n viewer {\n email\n fullName\n id\n }\n currentTrustCenter {\n id\n slug\n isViewerMember\n hasAcceptedNonDisclosureAgreement\n ndaFileName\n ndaFileUrl\n organization {\n name\n description\n websiteUrl\n logoUrl\n email\n headquarterAddress\n id\n }\n ...OverviewPageFragment\n vendorInfo: vendors(first: 0) {\n totalCount\n }\n audits(first: 50) {\n edges {\n node {\n id\n ...AuditRowFragment\n }\n }\n }\n }\n}\n\nfragment AuditRowFragment on Audit {\n report {\n id\n filename\n isUserAuthorized\n hasUserRequestedAccess\n }\n framework {\n id\n name\n lightLogoURL\n darkLogoURL\n }\n}\n\nfragment DocumentRowFragment on Document {\n id\n title\n isUserAuthorized\n hasUserRequestedAccess\n}\n\nfragment OverviewPageFragment on TrustCenter {\n references(first: 14) {\n edges {\n node {\n id\n name\n logoUrl\n websiteUrl\n }\n }\n }\n vendors(first: 3) {\n edges {\n node {\n id\n countries\n ...VendorRowFragment\n }\n }\n }\n documents(first: 5) {\n edges {\n node {\n id\n ...DocumentRowFragment\n documentType\n }\n }\n }\n trustCenterFiles(first: 5) {\n edges {\n node {\n id\n category\n ...TrustCenterFileRowFragment\n }\n }\n }\n}\n\nfragment TrustCenterFileRowFragment on TrustCenterFile {\n id\n name\n isUserAuthorized\n hasUserRequestedAccess\n}\n\nfragment VendorRowFragment on Vendor {\n id\n name\n category\n websiteUrl\n privacyPolicyUrl\n countries\n}\n"
+ "text": "query TrustGraphCurrentQuery {\n viewer {\n email\n fullName\n id\n }\n currentTrustCenter {\n id\n slug\n isViewerMember\n hasAcceptedNonDisclosureAgreement\n logoFileUrl\n darkLogoFileUrl\n ndaFileName\n ndaFileUrl\n organization {\n name\n description\n websiteUrl\n email\n headquarterAddress\n id\n }\n ...OverviewPageFragment\n vendorInfo: vendors(first: 0) {\n totalCount\n }\n audits(first: 50) {\n edges {\n node {\n id\n ...AuditRowFragment\n }\n }\n }\n }\n}\n\nfragment AuditRowFragment on Audit {\n report {\n id\n filename\n isUserAuthorized\n hasUserRequestedAccess\n }\n framework {\n id\n name\n lightLogoURL\n darkLogoURL\n }\n}\n\nfragment DocumentRowFragment on Document {\n id\n title\n isUserAuthorized\n hasUserRequestedAccess\n}\n\nfragment OverviewPageFragment on TrustCenter {\n references(first: 14) {\n edges {\n node {\n id\n name\n logoUrl\n websiteUrl\n }\n }\n }\n vendors(first: 3) {\n edges {\n node {\n id\n countries\n ...VendorRowFragment\n }\n }\n }\n documents(first: 5) {\n edges {\n node {\n id\n ...DocumentRowFragment\n documentType\n }\n }\n }\n trustCenterFiles(first: 5) {\n edges {\n node {\n id\n category\n ...TrustCenterFileRowFragment\n }\n }\n }\n}\n\nfragment TrustCenterFileRowFragment on TrustCenterFile {\n id\n name\n isUserAuthorized\n hasUserRequestedAccess\n}\n\nfragment VendorRowFragment on Vendor {\n id\n name\n category\n websiteUrl\n privacyPolicyUrl\n countries\n}\n"
}
};
})();
-(node as any).hash = "7623a958ac84c0615c8f4487ecda9224";
+(node as any).hash = "566fdb9af999e51fdf50e2eccca60941";
export default node;
diff --git a/pkg/server/api/trust/v1/schema.graphql b/pkg/server/api/trust/v1/schema.graphql
index 5abf5a672..93373b64b 100644
--- a/pkg/server/api/trust/v1/schema.graphql
+++ b/pkg/server/api/trust/v1/schema.graphql
@@ -491,6 +491,8 @@ type TrustCenter implements Node {
id: ID!
active: Boolean!
slug: String!
+ logoFileUrl: String @goField(forceResolver: true)
+ darkLogoFileUrl: String @goField(forceResolver: true)
ndaFileName: String
ndaFileUrl: String @goField(forceResolver: true)
organization: Organization! @goField(forceResolver: true)
diff --git a/pkg/server/api/trust/v1/schema/schema.go b/pkg/server/api/trust/v1/schema/schema.go
index d69afeeeb..88018e4c6 100644
--- a/pkg/server/api/trust/v1/schema/schema.go
+++ b/pkg/server/api/trust/v1/schema/schema.go
@@ -185,10 +185,12 @@ type ComplexityRoot struct {
TrustCenter struct {
Active func(childComplexity int) int
Audits func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey) int
+ DarkLogoFileURL func(childComplexity int) int
Documents func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey) int
HasAcceptedNonDisclosureAgreement func(childComplexity int) int
ID func(childComplexity int) int
IsViewerMember func(childComplexity int) int
+ LogoFileURL func(childComplexity int) int
NdaFileName func(childComplexity int) int
NdaFileURL func(childComplexity int) int
Organization func(childComplexity int) int
@@ -304,6 +306,9 @@ type ReportResolver interface {
HasUserRequestedAccess(ctx context.Context, obj *types.Report) (bool, error)
}
type TrustCenterResolver interface {
+ LogoFileURL(ctx context.Context, obj *types.TrustCenter) (*string, error)
+ DarkLogoFileURL(ctx context.Context, obj *types.TrustCenter) (*string, error)
+
NdaFileURL(ctx context.Context, obj *types.TrustCenter) (*string, error)
Organization(ctx context.Context, obj *types.TrustCenter) (*types.Organization, error)
IsViewerMember(ctx context.Context, obj *types.TrustCenter) (bool, error)
@@ -790,6 +795,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
}
return e.complexity.TrustCenter.Audits(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey)), true
+ case "TrustCenter.darkLogoFileUrl":
+ if e.complexity.TrustCenter.DarkLogoFileURL == nil {
+ break
+ }
+
+ return e.complexity.TrustCenter.DarkLogoFileURL(childComplexity), true
case "TrustCenter.documents":
if e.complexity.TrustCenter.Documents == nil {
break
@@ -819,6 +830,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
}
return e.complexity.TrustCenter.IsViewerMember(childComplexity), true
+ case "TrustCenter.logoFileUrl":
+ if e.complexity.TrustCenter.LogoFileURL == nil {
+ break
+ }
+
+ return e.complexity.TrustCenter.LogoFileURL(childComplexity), true
case "TrustCenter.ndaFileName":
if e.complexity.TrustCenter.NdaFileName == nil {
break
@@ -1705,6 +1722,8 @@ type TrustCenter implements Node {
id: ID!
active: Boolean!
slug: String!
+ logoFileUrl: String @goField(forceResolver: true)
+ darkLogoFileUrl: String @goField(forceResolver: true)
ndaFileName: String
ndaFileUrl: String @goField(forceResolver: true)
organization: Organization! @goField(forceResolver: true)
@@ -4213,6 +4232,10 @@ func (ec *executionContext) fieldContext_Query_currentTrustCenter(_ context.Cont
return ec.fieldContext_TrustCenter_active(ctx, field)
case "slug":
return ec.fieldContext_TrustCenter_slug(ctx, field)
+ case "logoFileUrl":
+ return ec.fieldContext_TrustCenter_logoFileUrl(ctx, field)
+ case "darkLogoFileUrl":
+ return ec.fieldContext_TrustCenter_darkLogoFileUrl(ctx, field)
case "ndaFileName":
return ec.fieldContext_TrustCenter_ndaFileName(ctx, field)
case "ndaFileUrl":
@@ -4621,6 +4644,64 @@ func (ec *executionContext) fieldContext_TrustCenter_slug(_ context.Context, fie
return fc, nil
}
+func (ec *executionContext) _TrustCenter_logoFileUrl(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_TrustCenter_logoFileUrl,
+ func(ctx context.Context) (any, error) {
+ return ec.resolvers.TrustCenter().LogoFileURL(ctx, obj)
+ },
+ nil,
+ ec.marshalOString2áš–string,
+ true,
+ false,
+ )
+}
+
+func (ec *executionContext) fieldContext_TrustCenter_logoFileUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "TrustCenter",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type String does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
+func (ec *executionContext) _TrustCenter_darkLogoFileUrl(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) {
+ return graphql.ResolveField(
+ ctx,
+ ec.OperationContext,
+ field,
+ ec.fieldContext_TrustCenter_darkLogoFileUrl,
+ func(ctx context.Context) (any, error) {
+ return ec.resolvers.TrustCenter().DarkLogoFileURL(ctx, obj)
+ },
+ nil,
+ ec.marshalOString2áš–string,
+ true,
+ false,
+ )
+}
+
+func (ec *executionContext) fieldContext_TrustCenter_darkLogoFileUrl(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
+ fc = &graphql.FieldContext{
+ Object: "TrustCenter",
+ Field: field,
+ IsMethod: true,
+ IsResolver: true,
+ Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
+ return nil, errors.New("field of type String does not have child fields")
+ },
+ }
+ return fc, nil
+}
+
func (ec *executionContext) _TrustCenter_ndaFileName(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenter) (ret graphql.Marshaler) {
return graphql.ResolveField(
ctx,
@@ -9204,6 +9285,72 @@ func (ec *executionContext) _TrustCenter(ctx context.Context, sel ast.SelectionS
if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1)
}
+ case "logoFileUrl":
+ field := field
+
+ innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._TrustCenter_logoFileUrl(ctx, field, obj)
+ return res
+ }
+
+ if field.Deferrable != nil {
+ dfs, ok := deferred[field.Deferrable.Label]
+ di := 0
+ if ok {
+ dfs.AddField(field)
+ di = len(dfs.Values) - 1
+ } else {
+ dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
+ deferred[field.Deferrable.Label] = dfs
+ }
+ dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
+ return innerFunc(ctx, dfs)
+ })
+
+ // don't run the out.Concurrently() call below
+ out.Values[i] = graphql.Null
+ continue
+ }
+
+ out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
+ case "darkLogoFileUrl":
+ field := field
+
+ innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) {
+ defer func() {
+ if r := recover(); r != nil {
+ ec.Error(ctx, ec.Recover(ctx, r))
+ }
+ }()
+ res = ec._TrustCenter_darkLogoFileUrl(ctx, field, obj)
+ return res
+ }
+
+ if field.Deferrable != nil {
+ dfs, ok := deferred[field.Deferrable.Label]
+ di := 0
+ if ok {
+ dfs.AddField(field)
+ di = len(dfs.Values) - 1
+ } else {
+ dfs = graphql.NewFieldSet([]graphql.CollectedField{field})
+ deferred[field.Deferrable.Label] = dfs
+ }
+ dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler {
+ return innerFunc(ctx, dfs)
+ })
+
+ // don't run the out.Concurrently() call below
+ out.Values[i] = graphql.Null
+ continue
+ }
+
+ out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
case "ndaFileName":
out.Values[i] = ec._TrustCenter_ndaFileName(ctx, field, obj)
case "ndaFileUrl":
diff --git a/pkg/server/api/trust/v1/types/types.go b/pkg/server/api/trust/v1/types/types.go
index fe644a497..f693cb6a0 100644
--- a/pkg/server/api/trust/v1/types/types.go
+++ b/pkg/server/api/trust/v1/types/types.go
@@ -174,6 +174,8 @@ type TrustCenter struct {
ID gid.GID `json:"id"`
Active bool `json:"active"`
Slug string `json:"slug"`
+ LogoFileURL *string `json:"logoFileUrl,omitempty"`
+ DarkLogoFileURL *string `json:"darkLogoFileUrl,omitempty"`
NdaFileName *string `json:"ndaFileName,omitempty"`
NdaFileURL *string `json:"ndaFileUrl,omitempty"`
Organization *Organization `json:"organization"`
diff --git a/pkg/server/api/trust/v1/v1_resolver.go b/pkg/server/api/trust/v1/v1_resolver.go
index 6a0beeadf..e769d4efb 100644
--- a/pkg/server/api/trust/v1/v1_resolver.go
+++ b/pkg/server/api/trust/v1/v1_resolver.go
@@ -871,6 +871,20 @@ func (r *reportResolver) HasUserRequestedAccess(ctx context.Context, obj *types.
return true, nil
}
+// LogoFileURL is the resolver for the logoFileUrl field.
+func (r *trustCenterResolver) LogoFileURL(ctx context.Context, obj *types.TrustCenter) (*string, error) {
+ trustService := r.TrustService(ctx, obj.ID.TenantID())
+
+ return trustService.TrustCenters.GenerateLogoURL(ctx, obj.ID, 1*time.Hour)
+}
+
+// DarkLogoFileURL is the resolver for the darkLogoFileUrl field.
+func (r *trustCenterResolver) DarkLogoFileURL(ctx context.Context, obj *types.TrustCenter) (*string, error) {
+ trustService := r.TrustService(ctx, obj.ID.TenantID())
+
+ return trustService.TrustCenters.GenerateLogoURL(ctx, obj.ID, 1*time.Hour)
+}
+
// NdaFileURL is the resolver for the ndaFileUrl field.
func (r *trustCenterResolver) NdaFileURL(ctx context.Context, obj *types.TrustCenter) (*string, error) {
trustService := r.TrustService(ctx, obj.ID.TenantID())
diff --git a/pkg/trust/trust_center_service.go b/pkg/trust/trust_center_service.go
index 0c24e1f42..ab69b175d 100644
--- a/pkg/trust/trust_center_service.go
+++ b/pkg/trust/trust_center_service.go
@@ -140,3 +140,79 @@ func (s TrustCenterService) GenerateNDAFileURL(
return presignedReq.URL, nil
}
+
+func (s TrustCenterService) GenerateLogoURL(
+ ctx context.Context,
+ compliancePageID gid.GID,
+ expiresIn time.Duration,
+) (*string, error) {
+ compliancePage, _, err := s.Get(ctx, compliancePageID)
+ if err != nil {
+ return nil, fmt.Errorf("cannot get compliance page: %w", err)
+ }
+
+ if compliancePage.LogoFileID == nil {
+ return nil, nil
+ }
+
+ url, err := s.generateFileURL(ctx, *compliancePage.LogoFileID, expiresIn)
+ if err != nil {
+ return nil, fmt.Errorf("cannot generate file URL: %w", err)
+ }
+
+ return url, nil
+}
+
+func (s TrustCenterService) GenerateDarkLogoURL(
+ ctx context.Context,
+ compliancePageID gid.GID,
+ expiresIn time.Duration,
+) (*string, error) {
+ compliancePage, _, err := s.Get(ctx, compliancePageID)
+ if err != nil {
+ return nil, fmt.Errorf("cannot get compliance page: %w", err)
+ }
+
+ if compliancePage.DarkLogoFileID == nil {
+ return nil, nil
+ }
+
+ url, err := s.generateFileURL(ctx, *compliancePage.DarkLogoFileID, expiresIn)
+ if err != nil {
+ return nil, fmt.Errorf("cannot generate file URL: %w", err)
+ }
+
+ return url, nil
+}
+
+func (s TrustCenterService) generateFileURL(ctx context.Context, fileID gid.GID, expiresIn time.Duration) (*string, error) {
+ file := &coredata.File{}
+ if err := s.svc.pg.WithConn(
+ ctx,
+ func(conn pg.Conn) error {
+ return file.LoadByID(ctx, conn, s.svc.scope, fileID)
+ },
+ ); err != nil {
+ return nil, fmt.Errorf("cannot load file: %w", err)
+ }
+
+ presignClient := s3.NewPresignClient(s.svc.s3)
+
+ encodedFilename := url.QueryEscape(file.FileName)
+ contentDisposition := fmt.Sprintf("attachment; filename=\"%s\"; filename*=UTF-8''%s",
+ encodedFilename, encodedFilename)
+
+ presignedReq, err := presignClient.PresignGetObject(ctx, &s3.GetObjectInput{
+ Bucket: aws.String(s.svc.bucket),
+ Key: aws.String(file.FileKey),
+ ResponseCacheControl: aws.String("max-age=3600, public"),
+ ResponseContentDisposition: aws.String(contentDisposition),
+ }, func(opts *s3.PresignOptions) {
+ opts.Expires = expiresIn
+ })
+ if err != nil {
+ return nil, fmt.Errorf("cannot presign GetObject request: %w", err)
+ }
+
+ return &presignedReq.URL, nil
+}