Skip to content

Commit

Permalink
add missing Certificate to crypto export default (#2739)
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig authored Sep 18, 2024
1 parent 442762b commit 57db380
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/node/crypto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ export default {
// WebCrypto
subtle,
webcrypto,
// Spkac
Certificate,
// X509
X509Certificate,
};
Expand Down
9 changes: 9 additions & 0 deletions src/workerd/api/node/tests/crypto_x509-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import { deepStrictEqual, ok, strictEqual, throws } from 'node:assert';

import { Buffer } from 'node:buffer';
import assert from 'node:assert';

import { X509Certificate, PublicKeyObject } from 'node:crypto';

Expand Down Expand Up @@ -348,3 +349,11 @@ export const test_ok = {
// throws(() => new X509Certificate(badCert));
// }
// };

// Ref: https://github.com/unjs/unenv/pull/310
export const shouldImportCertificate = {
test() {
// This is allowed by Node.js as well.
assert(process.getBuiltinModule('crypto').Certificate);
},
};

0 comments on commit 57db380

Please sign in to comment.