Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/internal/crypto/webcrypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ async function exportKey(format, key) {
}

if (!key[kExtractable])
throw lazyDOMException('key is not extractable', 'InvalidAccessException');
throw lazyDOMException('key is not extractable', 'InvalidAccessError');

let result;
switch (format) {
Expand Down
12 changes: 8 additions & 4 deletions test/parallel/test-webcrypto-export-import-cfrg.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ async function testImportSpki({ name, publicUsages }, extractable) {
} else {
await assert.rejects(
subtle.exportKey('spki', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down Expand Up @@ -172,7 +173,8 @@ async function testImportPkcs8({ name, privateUsages }, extractable) {
} else {
await assert.rejects(
subtle.exportKey('pkcs8', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down Expand Up @@ -303,11 +305,13 @@ async function testImportJwk({ name, publicUsages, privateUsages }, extractable)
} else {
await assert.rejects(
subtle.exportKey('jwk', publicKey), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
await assert.rejects(
subtle.exportKey('jwk', privateKey), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down
12 changes: 8 additions & 4 deletions test/parallel/test-webcrypto-export-import-ec.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ async function testImportSpki({ name, publicUsages }, namedCurve, extractable) {
} else {
await assert.rejects(
subtle.exportKey('spki', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down Expand Up @@ -165,7 +166,8 @@ async function testImportPkcs8(
} else {
await assert.rejects(
subtle.exportKey('pkcs8', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down Expand Up @@ -270,11 +272,13 @@ async function testImportJwk(
} else {
await assert.rejects(
subtle.exportKey('jwk', publicKey), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
await assert.rejects(
subtle.exportKey('jwk', privateKey), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down
18 changes: 12 additions & 6 deletions test/parallel/test-webcrypto-export-import-ml-dsa.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ async function testImportSpki({ name, publicUsages }, extractable) {
} else {
await assert.rejects(
subtle.exportKey('spki', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down Expand Up @@ -144,7 +145,8 @@ async function testImportPkcs8({ name, privateUsages }, extractable) {
} else {
await assert.rejects(
subtle.exportKey('pkcs8', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down Expand Up @@ -181,7 +183,8 @@ async function testImportPkcs8SeedOnly({ name, privateUsages }, extractable) {
} else {
await assert.rejects(
subtle.exportKey('pkcs8', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down Expand Up @@ -219,7 +222,8 @@ async function testImportPkcs8PrivOnly({ name, privateUsages }, extractable) {
} else {
await assert.rejects(
subtle.exportKey('pkcs8', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down Expand Up @@ -299,11 +303,13 @@ async function testImportJwk({ name, publicUsages, privateUsages }, extractable)
} else {
await assert.rejects(
subtle.exportKey('jwk', publicKey), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
await assert.rejects(
subtle.exportKey('jwk', privateKey), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down
12 changes: 8 additions & 4 deletions test/parallel/test-webcrypto-export-import-ml-kem.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ async function testImportSpki({ name, publicUsages }, extractable) {
} else {
await assert.rejects(
subtle.exportKey('spki', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down Expand Up @@ -127,7 +128,8 @@ async function testImportPkcs8({ name, privateUsages }, extractable) {
} else {
await assert.rejects(
subtle.exportKey('pkcs8', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down Expand Up @@ -164,7 +166,8 @@ async function testImportPkcs8SeedOnly({ name, privateUsages }, extractable) {
} else {
await assert.rejects(
subtle.exportKey('pkcs8', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down Expand Up @@ -202,7 +205,8 @@ async function testImportPkcs8PrivOnly({ name, privateUsages }, extractable) {
} else {
await assert.rejects(
subtle.exportKey('pkcs8', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down
12 changes: 8 additions & 4 deletions test/parallel/test-webcrypto-export-import-rsa.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ async function testImportSpki({ name, publicUsages }, size, hash, extractable) {
} else {
await assert.rejects(
subtle.exportKey('spki', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}
}
Expand Down Expand Up @@ -372,7 +373,8 @@ async function testImportPkcs8(
} else {
await assert.rejects(
subtle.exportKey('pkcs8', key), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down Expand Up @@ -479,11 +481,13 @@ async function testImportJwk(
} else {
await assert.rejects(
subtle.exportKey('jwk', publicKey), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
await assert.rejects(
subtle.exportKey('jwk', privateKey), {
message: /key is not extractable/
message: /key is not extractable/,
name: 'InvalidAccessError',
});
}

Expand Down
Loading