@@ -151,17 +151,31 @@ test('fails to generate unsupported kty', async t => {
151
151
} , { instanceOf : errors . JOSENotSupported , message : 'unsupported key type: foo' } )
152
152
} )
153
153
154
- test ( 'fails to generate unsupported OKP crv' , async t => {
155
- await t . throwsAsync ( ( ) => {
156
- return generate ( 'OKP' , 'foo' )
157
- } , { instanceOf : errors . JOSENotSupported , message : 'unsupported OKP key curve: foo' } )
158
- } )
154
+ if ( edDSASupported ) {
155
+ test ( 'fails to generate unsupported OKP crv' , async t => {
156
+ await t . throwsAsync ( ( ) => {
157
+ return generate ( 'OKP' , 'foo' )
158
+ } , { instanceOf : errors . JOSENotSupported , message : 'unsupported OKP key curve: foo' } )
159
+ } )
159
160
160
- test ( 'fails to generateSync unsupported OKP crv' , async t => {
161
- await t . throws ( ( ) => {
162
- return generateSync ( 'OKP' , 'foo' )
163
- } , { instanceOf : errors . JOSENotSupported , message : 'unsupported OKP key curve: foo' } )
164
- } )
161
+ test ( 'fails to generateSync unsupported OKP crv' , async t => {
162
+ await t . throws ( ( ) => {
163
+ return generateSync ( 'OKP' , 'foo' )
164
+ } , { instanceOf : errors . JOSENotSupported , message : 'unsupported OKP key curve: foo' } )
165
+ } )
166
+ } else {
167
+ test ( 'fails to generate OKP when not supported' , async t => {
168
+ await t . throwsAsync ( ( ) => {
169
+ return generate ( 'OKP' )
170
+ } , { instanceOf : errors . JOSENotSupported , message : 'OKP keys are not supported in your Node.js runtime version' } )
171
+ } )
172
+
173
+ test ( 'fails to generateSync OKP when not supported' , async t => {
174
+ await t . throws ( ( ) => {
175
+ return generateSync ( 'OKP' )
176
+ } , { instanceOf : errors . JOSENotSupported , message : 'OKP keys are not supported in your Node.js runtime version' } )
177
+ } )
178
+ }
165
179
166
180
test ( 'fails to generateSync unsupported EC crv' , t => {
167
181
t . throws ( ( ) => {
0 commit comments