Skip to content

Commit e2b58a5

Browse files
committed
refactor!: removed secp256k1 JWS support
1 parent 5352083 commit e2b58a5

File tree

13 files changed

+0
-54
lines changed

13 files changed

+0
-54
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ Please note that certain algorithms may not be available depending on the runtim
142142
- JSON Web Key Thumbprint URI - [RFC9278](https://www.rfc-editor.org/rfc/rfc9278)
143143
- JWS Unencoded Payload Option - [RFC7797](https://www.rfc-editor.org/rfc/rfc7797)
144144
- CFRG Elliptic Curve ECDH and Signatures - [RFC8037](https://www.rfc-editor.org/rfc/rfc8037)
145-
- secp256k1 EC Key curve support - [RFC8812](https://www.rfc-editor.org/rfc/rfc8812)
146145

147146
The algorithm implementations in `jose` have been tested using test vectors from their respective specifications as well as [RFC7520](https://www.rfc-editor.org/rfc/rfc7520).
148147

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"pem",
4040
"pkcs8",
4141
"rsa",
42-
"secp256k1",
4342
"sign",
4443
"signature",
4544
"spki",

src/jwks/local.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ class LocalJWKSet<KeyLikeType extends KeyLike = KeyLike> {
107107
case 'ES256':
108108
candidate = jwk.crv === 'P-256'
109109
break
110-
case 'ES256K':
111-
candidate = jwk.crv === 'secp256k1'
112-
break
113110
case 'ES384':
114111
candidate = jwk.crv === 'P-384'
115112
break

src/runtime/node/dsa_digest.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export default function dsaDigest(alg: string) {
55
case 'PS256':
66
case 'RS256':
77
case 'ES256':
8-
case 'ES256K':
98
return 'sha256'
109

1110
case 'PS384':

src/runtime/node/generate.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ export async function generateKeyPair(alg: string, options?: GenerateKeyPairOpti
6464
}
6565
case 'ES256':
6666
return generate('ec', { namedCurve: 'P-256' })
67-
case 'ES256K':
68-
return generate('ec', { namedCurve: 'secp256k1' })
6967
case 'ES384':
7068
return generate('ec', { namedCurve: 'P-384' })
7169
case 'ES512':

src/runtime/node/get_named_curve.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ const namedCurveToJOSE = (namedCurve: string) => {
1616
return 'P-384'
1717
case 'secp521r1':
1818
return 'P-521'
19-
case 'secp256k1':
20-
return 'secp256k1'
2119
default:
2220
throw new JOSENotSupported('Unsupported key curve for this operation')
2321
}

src/runtime/node/node_key.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type { JWK } from '../../types.d'
88

99
const ecCurveAlgMap = new Map([
1010
['ES256', 'P-256'],
11-
['ES256K', 'secp256k1'],
1211
['ES384', 'P-384'],
1312
['ES512', 'P-521'],
1413
])
@@ -106,7 +105,6 @@ export default function keyForCrypto<KeyObjectOptions, JWKOptions>(
106105
}
107106
break
108107
case 'ES256':
109-
case 'ES256K':
110108
case 'ES384':
111109
case 'ES512': {
112110
if (asymmetricKeyType !== 'ec') {

tap/ecdh.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export default (QUnit: QUnit, lib: typeof jose, keys: typeof jose) => {
1414
['ECDH-ES', true],
1515
['ECDH-ES', true, { crv: 'P-384' }],
1616
['ECDH-ES', !env.isDeno, { crv: 'P-521' }],
17-
['ECDH-ES', false, { crv: 'secp256k1' }],
1817
[
1918
'ECDH-ES',
2019
env.isNode ||

tap/fixtures.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -262,33 +262,4 @@ export const KEYS = {
262262
'-----END PUBLIC KEY-----\n',
263263
x509: undefined,
264264
},
265-
secp256k1: {
266-
jwk: {
267-
crv: 'secp256k1',
268-
d: '4FnXRICPA8cKwNZhg1XvGS3cyWXzuJ17imMFjlgn42w',
269-
kty: 'EC',
270-
x: 'hwxzC9RSkkBmbBche2iTjNCLbB7XG6h5lfHmOXTQDmQ',
271-
y: 'xzddq8Sa9Gn6EOCeYghU6uyWQoh1mWAHx0p6Zd0N9Bo',
272-
},
273-
pkcs8:
274-
'-----BEGIN PRIVATE KEY-----\n' +
275-
'MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQg4FnXRICPA8cKwNZhg1Xv\n' +
276-
'GS3cyWXzuJ17imMFjlgn42yhRANCAASHDHML1FKSQGZsFyF7aJOM0ItsHtcbqHmV\n' +
277-
'8eY5dNAOZMc3XavEmvRp+hDgnmIIVOrslkKIdZlgB8dKemXdDfQa\n' +
278-
'-----END PRIVATE KEY-----\n',
279-
spki:
280-
'-----BEGIN PUBLIC KEY-----\n' +
281-
'MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEhwxzC9RSkkBmbBche2iTjNCLbB7XG6h5\n' +
282-
'lfHmOXTQDmTHN12rxJr0afoQ4J5iCFTq7JZCiHWZYAfHSnpl3Q30Gg==\n' +
283-
'-----END PUBLIC KEY-----\n',
284-
x509:
285-
'-----BEGIN CERTIFICATE-----\n' +
286-
'MIIBBTCBrQIJAMqeTnxEXkWqMAoGCCqGSM49BAMCMA0xCzAJBgNVBAYTAkNaMB4X\n' +
287-
'DTIyMTAxMTEyMjUxNFoXDTIzMTAwNjEyMjUxNFowDTELMAkGA1UEBhMCQ1owVjAQ\n' +
288-
'BgcqhkjOPQIBBgUrgQQACgNCAASHDHML1FKSQGZsFyF7aJOM0ItsHtcbqHmV8eY5\n' +
289-
'dNAOZMc3XavEmvRp+hDgnmIIVOrslkKIdZlgB8dKemXdDfQaMAoGCCqGSM49BAMC\n' +
290-
'A0cAMEQCICLsIR+59yZbMsxvtYMH+Lmlko0/ihPHU/vbpfc7XXa1AiALT04GYkMx\n' +
291-
'/xy0TNunfynvxfMAX+9x+3tO8g/KbPZp7w==\n' +
292-
'-----END CERTIFICATE-----\n',
293-
},
294265
}

tap/jwk.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export default (QUnit: QUnit, lib: typeof jose, keys: typeof jose) => {
2929
['Ed25519', KEYS.Ed25519.jwk, !env.isBlink],
3030
['EdDSA', KEYS.Ed448.jwk, env.isNode || env.isEdgeRuntime],
3131
['ES256', KEYS.P256.jwk, true],
32-
['ES256K', KEYS.secp256k1.jwk, lib.cryptoRuntime === 'node:crypto' && !env.isElectron],
3332
['ES384', KEYS.P384.jwk, true],
3433
['ES512', KEYS.P521.jwk, env.isDeno ? [true, false] : true],
3534
['PS256', KEYS.RSA.jwk, true],

tap/jws.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ export default (QUnit: QUnit, lib: typeof jose, keys: typeof jose) => {
1313
['Ed25519', !env.isBlink],
1414
['EdDSA', env.isNode || env.isEdgeRuntime, { crv: 'Ed448' }],
1515
['ES256', true],
16-
[
17-
'ES256K',
18-
lib.cryptoRuntime === 'node:crypto' &&
19-
keys.cryptoRuntime === 'node:crypto' &&
20-
!env.isElectron,
21-
],
2216
['ES384', true],
2317
['ES512', !env.isDeno],
2418
['PS256', true],

tap/pem.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ export default (QUnit: QUnit, lib: typeof jose, keys: typeof jose) => {
1616
['ES256', KEYS.P256.pkcs8, true],
1717
['ES256', KEYS.P256.spki, true],
1818
['ES256', KEYS.P256.x509, true],
19-
['ES256K', KEYS.secp256k1.pkcs8, lib.cryptoRuntime === 'node:crypto' && !env.isElectron],
20-
['ES256K', KEYS.secp256k1.spki, lib.cryptoRuntime === 'node:crypto' && !env.isElectron],
21-
['ES256K', KEYS.secp256k1.x509, lib.cryptoRuntime === 'node:crypto' && !env.isElectron],
2219
['ES384', KEYS.P384.pkcs8, true],
2320
['ES384', KEYS.P384.spki, true],
2421
['ES384', KEYS.P384.x509, true],

test/jws/restrictions.test.mjs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,3 @@ test(testRSAenc, 'RSA-OAEP-512')
121121
test(testECDSASigEncoding, 'ES256')
122122
test(testECDSASigEncoding, 'ES384')
123123
test(testECDSASigEncoding, 'ES512')
124-
125-
test(testECDSASigEncoding, 'ES256K')

0 commit comments

Comments
 (0)