• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4if (!common.hasCrypto)
5  common.skip('missing crypto');
6
7const assert = require('assert');
8
9const {
10  generateKeyPairSync,
11} = require('crypto');
12
13// Test invalid parameter encoding.
14{
15  assert.throws(() => generateKeyPairSync('dsa', {
16    modulusLength: 1024,
17    publicKeyEncoding: {
18      format: 'jwk'
19    },
20    privateKeyEncoding: {
21      format: 'jwk'
22    }
23  }), {
24    name: 'Error',
25    code: 'ERR_CRYPTO_JWK_UNSUPPORTED_KEY_TYPE',
26    message: 'Unsupported JWK Key Type.'
27  });
28}
29