@sphereon/ssi-sdk-ext.key-utils 0.34.1-feature.SSISDK.26.55 → 0.34.1-feature.SSISDK.26.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +39 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +39 -20
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/conversion.ts +38 -19
- package/src/functions.ts +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/ssi-sdk-ext.key-utils",
|
|
3
3
|
"description": "Sphereon SSI-SDK plugin for key creation.",
|
|
4
|
-
"version": "0.34.1-feature.SSISDK.26.
|
|
4
|
+
"version": "0.34.1-feature.SSISDK.26.75+414583f1",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.cjs",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@ethersproject/random": "^5.7.0",
|
|
26
26
|
"@noble/curves": "1.7.0",
|
|
27
27
|
"@noble/hashes": "1.6.1",
|
|
28
|
-
"@sphereon/ssi-sdk-ext.x509-utils": "0.34.1-feature.SSISDK.26.
|
|
29
|
-
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.26.
|
|
28
|
+
"@sphereon/ssi-sdk-ext.x509-utils": "0.34.1-feature.SSISDK.26.75+414583f1",
|
|
29
|
+
"@sphereon/ssi-types": "0.34.1-feature.SSISDK.26.75+414583f1",
|
|
30
30
|
"@stablelib/ed25519": "^1.0.3",
|
|
31
31
|
"@trust/keyto": "^1.0.1",
|
|
32
32
|
"@veramo/core": "4.2.0",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"DID",
|
|
64
64
|
"Veramo"
|
|
65
65
|
],
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "414583f1b1ed3f44a7b125c6a4f816c573aefacd"
|
|
67
67
|
}
|
package/src/conversion.ts
CHANGED
|
@@ -105,27 +105,38 @@ export function coseToJoseSignatureAlg(coseAlg: ICoseSignatureAlgorithm): JoseSi
|
|
|
105
105
|
|
|
106
106
|
export function joseToCoseSignatureAlg(joseAlg: JoseSignatureAlgorithm | JoseSignatureAlgorithmString): ICoseSignatureAlgorithm {
|
|
107
107
|
switch (joseAlg) {
|
|
108
|
-
case
|
|
108
|
+
case JoseSignatureAlgorithm.ES256K:
|
|
109
|
+
case 'ES256K':
|
|
109
110
|
return ICoseSignatureAlgorithm.ES256K
|
|
110
|
-
case
|
|
111
|
+
case JoseSignatureAlgorithm.ES256:
|
|
112
|
+
case 'ES256':
|
|
111
113
|
return ICoseSignatureAlgorithm.ES256
|
|
112
|
-
case
|
|
114
|
+
case JoseSignatureAlgorithm.ES384:
|
|
115
|
+
case 'ES384':
|
|
113
116
|
return ICoseSignatureAlgorithm.ES384
|
|
114
|
-
case
|
|
117
|
+
case JoseSignatureAlgorithm.ES512:
|
|
118
|
+
case 'ES512':
|
|
115
119
|
return ICoseSignatureAlgorithm.ES512
|
|
116
|
-
case
|
|
120
|
+
case JoseSignatureAlgorithm.PS256:
|
|
121
|
+
case 'PS256':
|
|
117
122
|
return ICoseSignatureAlgorithm.PS256
|
|
118
|
-
case
|
|
123
|
+
case JoseSignatureAlgorithm.PS384:
|
|
124
|
+
case 'PS384':
|
|
119
125
|
return ICoseSignatureAlgorithm.PS384
|
|
120
|
-
case
|
|
126
|
+
case JoseSignatureAlgorithm.PS512:
|
|
127
|
+
case 'PS512':
|
|
121
128
|
return ICoseSignatureAlgorithm.PS512
|
|
122
|
-
case
|
|
129
|
+
case JoseSignatureAlgorithm.HS256:
|
|
130
|
+
case 'HS256':
|
|
123
131
|
return ICoseSignatureAlgorithm.HS256
|
|
124
|
-
case
|
|
132
|
+
case JoseSignatureAlgorithm.HS384:
|
|
133
|
+
case 'HS384':
|
|
125
134
|
return ICoseSignatureAlgorithm.HS384
|
|
126
|
-
case
|
|
135
|
+
case JoseSignatureAlgorithm.HS512:
|
|
136
|
+
case 'HS512':
|
|
127
137
|
return ICoseSignatureAlgorithm.HS512
|
|
128
|
-
case
|
|
138
|
+
case JoseSignatureAlgorithm.EdDSA:
|
|
139
|
+
case 'EdDSA':
|
|
129
140
|
return ICoseSignatureAlgorithm.EdDSA
|
|
130
141
|
default:
|
|
131
142
|
throw Error(`Signature algorithm ${joseAlg} not supported in Cose`)
|
|
@@ -134,21 +145,29 @@ export function joseToCoseSignatureAlg(joseAlg: JoseSignatureAlgorithm | JoseSig
|
|
|
134
145
|
|
|
135
146
|
export function joseToCoseKeyOperation(keyOp: JoseKeyOperation | JoseKeyOperationString): ICoseKeyOperation {
|
|
136
147
|
switch (keyOp) {
|
|
137
|
-
case
|
|
148
|
+
case JoseKeyOperation.SIGN:
|
|
149
|
+
case 'sign':
|
|
138
150
|
return ICoseKeyOperation.SIGN
|
|
139
|
-
case
|
|
151
|
+
case JoseKeyOperation.VERIFY:
|
|
152
|
+
case 'verify':
|
|
140
153
|
return ICoseKeyOperation.VERIFY
|
|
141
|
-
case
|
|
154
|
+
case JoseKeyOperation.ENCRYPT:
|
|
155
|
+
case 'encrypt':
|
|
142
156
|
return ICoseKeyOperation.ENCRYPT
|
|
143
|
-
case
|
|
157
|
+
case JoseKeyOperation.DECRYPT:
|
|
158
|
+
case 'decrypt':
|
|
144
159
|
return ICoseKeyOperation.DECRYPT
|
|
145
|
-
case
|
|
160
|
+
case JoseKeyOperation.WRAP_KEY:
|
|
161
|
+
case 'wrapKey':
|
|
146
162
|
return ICoseKeyOperation.WRAP_KEY
|
|
147
|
-
case
|
|
163
|
+
case JoseKeyOperation.UNWRAP_KEY:
|
|
164
|
+
case 'unwrapKey':
|
|
148
165
|
return ICoseKeyOperation.UNWRAP_KEY
|
|
149
|
-
case
|
|
166
|
+
case JoseKeyOperation.DERIVE_KEY:
|
|
167
|
+
case 'deriveKey':
|
|
150
168
|
return ICoseKeyOperation.DERIVE_KEY
|
|
151
|
-
case
|
|
169
|
+
case JoseKeyOperation.DERIVE_BITS:
|
|
170
|
+
case 'deriveBits':
|
|
152
171
|
return ICoseKeyOperation.DERIVE_BITS
|
|
153
172
|
default:
|
|
154
173
|
throw Error(`Key operation ${keyOp} not supported in Cose`)
|
package/src/functions.ts
CHANGED
|
@@ -951,9 +951,9 @@ export async function verifyRawSignature({
|
|
|
951
951
|
case 'RSA': {
|
|
952
952
|
const signatureAlgorithm = opts?.signatureAlg ?? (jwk.alg as JoseSignatureAlgorithm | undefined) ?? JoseSignatureAlgorithm.PS256
|
|
953
953
|
const hashAlg =
|
|
954
|
-
signatureAlgorithm ===
|
|
954
|
+
signatureAlgorithm === JoseSignatureAlgorithm.RS512 || signatureAlgorithm === JoseSignatureAlgorithm.PS512
|
|
955
955
|
? sha512
|
|
956
|
-
: signatureAlgorithm ===
|
|
956
|
+
: signatureAlgorithm === JoseSignatureAlgorithm.RS384 || signatureAlgorithm === JoseSignatureAlgorithm.PS384
|
|
957
957
|
? sha384
|
|
958
958
|
: sha256
|
|
959
959
|
switch (signatureAlgorithm) {
|