Skip to content

Commit

Permalink
Merge branch 'main' into aslobodian/add-provider-info-dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandr-slobodian committed Oct 11, 2024
2 parents 13518aa + 4a7c3fd commit fca8da0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
},
"dependencies": {
"@peculiar/certificates-viewer-react": "^4.3.1",
"@peculiar/fortify-webcomponents-react": "^4.0.8",
"@peculiar/fortify-webcomponents-react": "^4.0.9",
"@peculiar/react-components": "^0.6.7",
"@peculiar/x509": "^1.12.3",
"clsx": "^2.1.1",
Expand Down
5 changes: 3 additions & 2 deletions src/components/certificates-list/CertificatesList.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Meta, StoryObj } from "@storybook/react";
import { CertificatesList } from "./CertificatesList";
import { faker } from "@faker-js/faker";
import { CertificateProps } from "../../types";

const meta: Meta<typeof CertificatesList> = {
title: "Components/CertificatesList",
Expand All @@ -27,9 +28,9 @@ export const Default: Story = {
label: faker.internet.domainName(),
privateKeyId: "",
subject: {
commonName: "",
CN: faker.internet.domainName(),
},
})),
})) as unknown as CertificateProps[],
},
};

Expand Down
13 changes: 8 additions & 5 deletions src/utils/certificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,25 @@ export function certificateSubjectToString(
}

export function getCertificateName(certificate: CertificateProps) {
const { G, CN, SN, E } =
certificate.subject as unknown as CertificateSubjectProps;
if (!certificate.subject) {
return certificate.subjectName;
}

const { G, CN, SN, E } = certificate.subject;

// Return Common Name if present.
if (CN) {
return CN;
return CN[0];
}

// Return Given Name + Surname if both present.
if (G && SN) {
return `${G} ${SN}`;
return `${G[0]} ${SN[0]}`;
}

// Return Email if none of the above present
if (E) {
return E;
return E[0];
}

return certificate.subjectName;
Expand Down
28 changes: 14 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1003,10 +1003,10 @@
resolved "https://registry.npmjs.org/@peculiar/color/-/color-0.1.3.tgz"
integrity sha512-ndvAb80Ej1kz4chPngOoSJcbaqZTJRacAs/M7k57raqVkUx/dlMwYflHGgQGVtkfAMAVkjE9TWVMqbjjtxbnhg==

"@peculiar/fortify-client-core@^4.0.8":
version "4.0.8"
resolved "https://registry.npmjs.org/@peculiar/fortify-client-core/-/fortify-client-core-4.0.8.tgz"
integrity sha512-KjswgC50KUbvXraKYO9qnMGjTwM+C44Y2GelquWilZMvrsXiWG8vv7OqWYGtgLPgYuhbxwPM5f4x92HKt3eCUQ==
"@peculiar/fortify-client-core@^4.0.9":
version "4.0.9"
resolved "https://registry.yarnpkg.com/@peculiar/fortify-client-core/-/fortify-client-core-4.0.9.tgz#6aeecb75132962235af0dc09768d666deb17dd8f"
integrity sha512-yZCMKEQHT6xScYeHaoRFaRZCZAeThuxxX6aZfGd2TIaTV/8vH0tQp1smnCisSqE34bFkN5DvUPMvm4hLg2TvjA==
dependencies:
"@peculiar/asn1-schema" "^2.3.8"
"@peculiar/asn1-x509" "^2.3.8"
Expand All @@ -1018,21 +1018,21 @@
pvtsutils "^1.3.5"
tslib "^2.4.0"

"@peculiar/fortify-webcomponents-react@^4.0.8":
version "4.0.8"
resolved "https://registry.npmjs.org/@peculiar/fortify-webcomponents-react/-/fortify-webcomponents-react-4.0.8.tgz"
integrity sha512-kJ14fdQWNqF1Ps30H3b4SuHlZXf/rWSMm0F4uVFxPKQG7lfJt/RDPJdAd06sEX+TpSqunrQZGlGudj//fFNmqA==
"@peculiar/fortify-webcomponents-react@^4.0.9":
version "4.0.9"
resolved "https://registry.yarnpkg.com/@peculiar/fortify-webcomponents-react/-/fortify-webcomponents-react-4.0.9.tgz#ae96522d541effff4f542122615d16de65d6a38d"
integrity sha512-RNfVbxOa0nfYJuTZpdVwTNn6zBjHXwK7lbiNmrfkrfft1hS2T3v0WWfE7Xvbv3W9SUcAbGYG6Yy1yTztZmOwtg==
dependencies:
"@peculiar/fortify-webcomponents" "^4.0.8"
"@peculiar/fortify-webcomponents" "^4.0.9"
tslib "^2.4.0"

"@peculiar/fortify-webcomponents@^4.0.8":
version "4.0.8"
resolved "https://registry.npmjs.org/@peculiar/fortify-webcomponents/-/fortify-webcomponents-4.0.8.tgz"
integrity sha512-Q/j8oDqgyVatFTUV4/V49NGh7RJ7N2DYXuPLtIYACi6rLU3r7i9JGyLHXIwCvNdemACNmbY7RgCSj0wT0ZF4Yw==
"@peculiar/fortify-webcomponents@^4.0.9":
version "4.0.9"
resolved "https://registry.yarnpkg.com/@peculiar/fortify-webcomponents/-/fortify-webcomponents-4.0.9.tgz#68c5a70c6f6d6daa780b0740f6973af6b5b3685b"
integrity sha512-jxmBFY9hoU5XlBfxy5jrx+hcHSxxuuUI8N03TuRBvnB+oSV6w02QHKb30i/eK3YCprwh1RnwjY1oQwf2I1Lr1w==
dependencies:
"@peculiar/certificates-viewer" "^4.2.0"
"@peculiar/fortify-client-core" "^4.0.8"
"@peculiar/fortify-client-core" "^4.0.9"
"@stencil/core" "^4.3.0"
pvtsutils "^1.3.5"

Expand Down

0 comments on commit fca8da0

Please sign in to comment.