Skip to content

Commit 76c3e75

Browse files
committed
Fix: Multiple entry point exception.
The X509Certificate class is now only used in the library where the compiler uses resolves the main entry to the correct js file. There is also another solution to fix the problem: delete the "browser" field in the x509 package.json (not really a clean solution...) Some links: https://webpack.js.org/configuration/entry-context/ microsoft/TypeScript#21423
1 parent 53dfce6 commit 76c3e75

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

examples/ts-react/src/App.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
DccBase45, Jwt, Verifier,
99
ZlibDecoder
1010
} from "digital-covid-certificate-lib";
11-
import {X509Certificate} from "@peculiar/x509/";
1211

1312
function App() {
1413
const validVaccinationCert = "HC1:NCFK60DG0/3WUWGSLKH47GO0Y%5S.PK%96L79CK-500XK0JCV496F3PYJ-982F3:OR2B8Y50.FK6ZK7:EDOLOPCO8F6%E3.DA%EOPC1G72A6YM86G7/F6/G80X6H%6946746T%6C46/96SF60R6FN8UPC0JCZ69FVCPD0LVC6JD846Y96C463W5307+EDG8F3I80/D6$CBECSUER:C2$NS346$C2%E9VC- CSUE145GB8JA5B$D% D3IA4W5646646-96:96.JCP9EJY8L/5M/5546.96SF63KC.SC4KCD3DX47B46IL6646H*6Z/ER2DD46JH8946JPCT3E5JDLA7$Q69464W51S6..DX%DZJC2/DYOA$$E5$C JC3/D9Z95LEZED1ECW.C8WE2OA3ZAGY8MPCG/DU2DRB8MTA8+9$PC5$CUZC$$5Y$5FBB*10GBH A81QK UV-$SOGD1APAB4$5UV C-EWB4T*6H%QV/DAP9L7J3Y4O/WVI5IW3672HO-HV16IW3JHV-FI%WJCPBI8QTE008I+FPR01MYFA6EBN2SR3H+4KH1M9RCIM2 VV15REG 516N93SS70RBUCH-RJM2JMULZ6*/HBBW7W7:S2BU7T6PRTMF4ALUNEXH3P7 LE0YF0TGE461PBK9TD68HDIT4AIFD9NH14V%GBCONJOV$KN C+3U-IT$SE-A2V+9UO9WYRJ4HN+M/Z5W$QEDT/8C:88OQ4DXOBBIQ453863NPW0EJXG8$GH1T 38C*UI6T /FCDC%6VLNOA6W6BEYJJUH2Z-SOJO1D7JMALD8 $1%5B.GH$7AQOHZ:K3BNO1"
@@ -38,7 +37,7 @@ function App() {
3837
{
3938
jwt: new Jwt(CH_KEYS_UPDATE_LIST_JWT),
4039
verifySignature: true,
41-
rootCertificate: new X509Certificate(CH_ROOT_CERTIFICATE)
40+
rootCertificate: CH_ROOT_CERTIFICATE
4241
}
4342
)
4443
console.log(keystore)

src/crypto/key-store/ChKeyStore.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {IKeyStore} from "./IKeyStore";
66
export type ChKeyStoreIdentifier = string
77
export type ChKeyStoreLoadingArgs = {
88
jwt: Jwt, verifySignature: boolean
9-
rootCertificate?: X509Certificate
9+
rootCertificate?: string
1010
}
1111

1212
export class ChKeyStore implements IKeyStore<ChKeyStoreLoadingArgs, ChKeyStoreIdentifier>{
@@ -18,7 +18,7 @@ export class ChKeyStore implements IKeyStore<ChKeyStoreLoadingArgs, ChKeyStoreId
1818
const {jwt, rootCertificate} = args;
1919
const trustChain: X509Certificate[] = jwt.header.x5c.map(cert => new X509Certificate(cert))
2020
if(rootCertificate){
21-
trustChain.push(rootCertificate)
21+
trustChain.push(new X509Certificate(rootCertificate))
2222
}
2323
for (let i = 0; i < trustChain.length; i++) {
2424
const valid = await trustChain[i].verify({date: new Date(), publicKey: trustChain[i+1]})

test/unit/crypto/kes-store/KeyStore.test.ts

+1-1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)