Skip to content
Merged
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solid/jose",
"version": "0.6.9",
"version": "0.7.0",
"description": "JSON Object Signing and Encryption",
"main": "src/index.js",
"directories": {
Expand Down
54 changes: 50 additions & 4 deletions src/algorithms/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,23 @@ supportedAlgorithms.define('ES256', 'sign', new ECDSA({
},
namedCurve: 'P-256'
}))
//supportedAlgorithms.define('ES384', 'sign', {})
//supportedAlgorithms.define('ES512', 'sign', {})

supportedAlgorithms.define('ES384', 'sign', new ECDSA({
name: 'ECDSA',
hash: {
name: 'SHA-384'
},
namedCurve: 'P-384'
}))

supportedAlgorithms.define('ES512', 'sign', new ECDSA({
name: 'ECDSA',
hash: {
name: 'SHA-512'
},
namedCurve: 'P-521'
}))

//supportedAlgorithms.define('PS256', 'sign', {})
//supportedAlgorithms.define('PS384', 'sign', {})
//supportedAlgorithms.define('PS512', 'sign', {})
Expand Down Expand Up @@ -126,8 +141,23 @@ supportedAlgorithms.define('ES256', 'verify', new ECDSA({
},
namedCurve: 'P-256'
}))
//supportedAlgorithms.define('ES384', 'verify', {})
//supportedAlgorithms.define('ES512', 'verify', {})

supportedAlgorithms.define('ES384', 'verify', new ECDSA({
name: 'ECDSA',
hash: {
name: 'SHA-384'
},
namedCurve: 'P-384'
}))

supportedAlgorithms.define('ES512', 'verify', new ECDSA({
name: 'ECDSA',
hash: {
name: 'SHA-512'
},
namedCurve: 'P-521'
}))

//supportedAlgorithms.define('PS256', 'verify', {})
//supportedAlgorithms.define('PS384', 'verify', {})
//supportedAlgorithms.define('PS512', 'verify', {})
Expand Down Expand Up @@ -165,6 +195,22 @@ supportedAlgorithms.define('ES256', 'importKey', new ECDSA({
namedCurve: 'P-256'
}))

supportedAlgorithms.define('ES384', 'importKey', new ECDSA({
name: 'ECDSA',
hash: {
name: 'SHA-384'
},
namedCurve: 'P-384'
}))

supportedAlgorithms.define('ES512', 'importKey', new ECDSA({
name: 'ECDSA',
hash: {
name: 'SHA-512'
},
namedCurve: 'P-521'
}))

/**
* Export
*/
Expand Down
5 changes: 5 additions & 0 deletions src/jose/JWA.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ class JWA {
*/
static async importKey (key) {
let normalizedAlgorithm = supportedAlgorithms.normalize('importKey', key.alg)

if (normalizedAlgorithm instanceof Error) {
return Promise.reject(new NotSupportedError(key.alg))
}

return normalizedAlgorithm.importKey(key)
}
}
Expand Down