@sphereon/ssi-sdk-ext.key-utils 0.34.1-feature.merge.crypto.extensions.modules.34 → 0.34.1-feature.merge.crypto.extensions.modules.36
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 +16 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -28
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/conversion.ts +16 -28
package/src/conversion.ts
CHANGED
|
@@ -105,26 +105,6 @@ export function coseToJoseSignatureAlg(coseAlg: ICoseSignatureAlgorithm): JoseSi
|
|
|
105
105
|
|
|
106
106
|
export function joseToCoseSignatureAlg(joseAlg: JoseSignatureAlgorithm | JoseSignatureAlgorithmString): ICoseSignatureAlgorithm {
|
|
107
107
|
switch (joseAlg) {
|
|
108
|
-
case (JoseSignatureAlgorithm.ES256K, 'ES256K'):
|
|
109
|
-
return ICoseSignatureAlgorithm.ES256K
|
|
110
|
-
case (JoseSignatureAlgorithm.ES256, 'ES256'):
|
|
111
|
-
return ICoseSignatureAlgorithm.ES256
|
|
112
|
-
case (JoseSignatureAlgorithm.ES384, 'ES384'):
|
|
113
|
-
return ICoseSignatureAlgorithm.ES384
|
|
114
|
-
case (JoseSignatureAlgorithm.ES512, 'ES512'):
|
|
115
|
-
return ICoseSignatureAlgorithm.ES512
|
|
116
|
-
case (JoseSignatureAlgorithm.PS256, 'PS256'):
|
|
117
|
-
return ICoseSignatureAlgorithm.PS256
|
|
118
|
-
case (JoseSignatureAlgorithm.PS384, 'PS384'):
|
|
119
|
-
return ICoseSignatureAlgorithm.PS384
|
|
120
|
-
case (JoseSignatureAlgorithm.PS512, 'PS512'):
|
|
121
|
-
return ICoseSignatureAlgorithm.PS512
|
|
122
|
-
case (JoseSignatureAlgorithm.HS256, 'HS256'):
|
|
123
|
-
return ICoseSignatureAlgorithm.HS256
|
|
124
|
-
case (JoseSignatureAlgorithm.HS384, 'HS384'):
|
|
125
|
-
return ICoseSignatureAlgorithm.HS384
|
|
126
|
-
case (JoseSignatureAlgorithm.HS512, 'HS512'):
|
|
127
|
-
return ICoseSignatureAlgorithm.HS512
|
|
128
108
|
case JoseSignatureAlgorithm.ES256K:
|
|
129
109
|
case 'ES256K':
|
|
130
110
|
return ICoseSignatureAlgorithm.ES256K
|
|
@@ -165,21 +145,29 @@ export function joseToCoseSignatureAlg(joseAlg: JoseSignatureAlgorithm | JoseSig
|
|
|
165
145
|
|
|
166
146
|
export function joseToCoseKeyOperation(keyOp: JoseKeyOperation | JoseKeyOperationString): ICoseKeyOperation {
|
|
167
147
|
switch (keyOp) {
|
|
168
|
-
case
|
|
148
|
+
case JoseKeyOperation.SIGN:
|
|
149
|
+
case 'sign':
|
|
169
150
|
return ICoseKeyOperation.SIGN
|
|
170
|
-
case
|
|
151
|
+
case JoseKeyOperation.VERIFY:
|
|
152
|
+
case 'verify':
|
|
171
153
|
return ICoseKeyOperation.VERIFY
|
|
172
|
-
case
|
|
154
|
+
case JoseKeyOperation.ENCRYPT:
|
|
155
|
+
case 'encrypt':
|
|
173
156
|
return ICoseKeyOperation.ENCRYPT
|
|
174
|
-
case
|
|
157
|
+
case JoseKeyOperation.DECRYPT:
|
|
158
|
+
case 'decrypt':
|
|
175
159
|
return ICoseKeyOperation.DECRYPT
|
|
176
|
-
case
|
|
160
|
+
case JoseKeyOperation.WRAP_KEY:
|
|
161
|
+
case 'wrapKey':
|
|
177
162
|
return ICoseKeyOperation.WRAP_KEY
|
|
178
|
-
case
|
|
163
|
+
case JoseKeyOperation.UNWRAP_KEY:
|
|
164
|
+
case 'unwrapKey':
|
|
179
165
|
return ICoseKeyOperation.UNWRAP_KEY
|
|
180
|
-
case
|
|
166
|
+
case JoseKeyOperation.DERIVE_KEY:
|
|
167
|
+
case 'deriveKey':
|
|
181
168
|
return ICoseKeyOperation.DERIVE_KEY
|
|
182
|
-
case
|
|
169
|
+
case JoseKeyOperation.DERIVE_BITS:
|
|
170
|
+
case 'deriveBits':
|
|
183
171
|
return ICoseKeyOperation.DERIVE_BITS
|
|
184
172
|
default:
|
|
185
173
|
throw Error(`Key operation ${keyOp} not supported in Cose`)
|