@sphereon/ssi-sdk-ext.key-utils 0.34.1-feature.SSISDK.26.55 → 0.34.1-feature.SSISDK.26.74

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/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.55+07308f0a",
4
+ "version": "0.34.1-feature.SSISDK.26.74+130d3bc8",
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.55+07308f0a",
29
- "@sphereon/ssi-types": "0.34.1-feature.SSISDK.26.55+07308f0a",
28
+ "@sphereon/ssi-sdk-ext.x509-utils": "0.34.1-feature.SSISDK.26.74+130d3bc8",
29
+ "@sphereon/ssi-types": "0.34.1-feature.SSISDK.26.74+130d3bc8",
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": "07308f0a0f6e8d5b9f116e7cc8bb21a680207ff3"
66
+ "gitHead": "130d3bc8f273240e64c2c2ad2a1623087430b89d"
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 (JoseSignatureAlgorithm.ES256K, 'ES256K'):
108
+ case JoseSignatureAlgorithm.ES256K:
109
+ case 'ES256K':
109
110
  return ICoseSignatureAlgorithm.ES256K
110
- case (JoseSignatureAlgorithm.ES256, 'ES256'):
111
+ case JoseSignatureAlgorithm.ES256:
112
+ case 'ES256':
111
113
  return ICoseSignatureAlgorithm.ES256
112
- case (JoseSignatureAlgorithm.ES384, 'ES384'):
114
+ case JoseSignatureAlgorithm.ES384:
115
+ case 'ES384':
113
116
  return ICoseSignatureAlgorithm.ES384
114
- case (JoseSignatureAlgorithm.ES512, 'ES512'):
117
+ case JoseSignatureAlgorithm.ES512:
118
+ case 'ES512':
115
119
  return ICoseSignatureAlgorithm.ES512
116
- case (JoseSignatureAlgorithm.PS256, 'PS256'):
120
+ case JoseSignatureAlgorithm.PS256:
121
+ case 'PS256':
117
122
  return ICoseSignatureAlgorithm.PS256
118
- case (JoseSignatureAlgorithm.PS384, 'PS384'):
123
+ case JoseSignatureAlgorithm.PS384:
124
+ case 'PS384':
119
125
  return ICoseSignatureAlgorithm.PS384
120
- case (JoseSignatureAlgorithm.PS512, 'PS512'):
126
+ case JoseSignatureAlgorithm.PS512:
127
+ case 'PS512':
121
128
  return ICoseSignatureAlgorithm.PS512
122
- case (JoseSignatureAlgorithm.HS256, 'HS256'):
129
+ case JoseSignatureAlgorithm.HS256:
130
+ case 'HS256':
123
131
  return ICoseSignatureAlgorithm.HS256
124
- case (JoseSignatureAlgorithm.HS384, 'HS384'):
132
+ case JoseSignatureAlgorithm.HS384:
133
+ case 'HS384':
125
134
  return ICoseSignatureAlgorithm.HS384
126
- case (JoseSignatureAlgorithm.HS512, 'HS512'):
135
+ case JoseSignatureAlgorithm.HS512:
136
+ case 'HS512':
127
137
  return ICoseSignatureAlgorithm.HS512
128
- case (JoseSignatureAlgorithm.EdDSA, 'EdDSA'):
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 (JoseKeyOperation.SIGN, 'sign'):
148
+ case JoseKeyOperation.SIGN:
149
+ case 'sign':
138
150
  return ICoseKeyOperation.SIGN
139
- case (JoseKeyOperation.VERIFY, 'verify'):
151
+ case JoseKeyOperation.VERIFY:
152
+ case 'verify':
140
153
  return ICoseKeyOperation.VERIFY
141
- case (JoseKeyOperation.ENCRYPT, 'encrypt'):
154
+ case JoseKeyOperation.ENCRYPT:
155
+ case 'encrypt':
142
156
  return ICoseKeyOperation.ENCRYPT
143
- case (JoseKeyOperation.DECRYPT, 'decrypt'):
157
+ case JoseKeyOperation.DECRYPT:
158
+ case 'decrypt':
144
159
  return ICoseKeyOperation.DECRYPT
145
- case (JoseKeyOperation.WRAP_KEY, 'wrapKey'):
160
+ case JoseKeyOperation.WRAP_KEY:
161
+ case 'wrapKey':
146
162
  return ICoseKeyOperation.WRAP_KEY
147
- case (JoseKeyOperation.UNWRAP_KEY, 'unwrapKey'):
163
+ case JoseKeyOperation.UNWRAP_KEY:
164
+ case 'unwrapKey':
148
165
  return ICoseKeyOperation.UNWRAP_KEY
149
- case (JoseKeyOperation.DERIVE_KEY, 'deriveKey'):
166
+ case JoseKeyOperation.DERIVE_KEY:
167
+ case 'deriveKey':
150
168
  return ICoseKeyOperation.DERIVE_KEY
151
- case (JoseKeyOperation.DERIVE_BITS, 'deriveBits'):
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 === (JoseSignatureAlgorithm.RS512 || JoseSignatureAlgorithm.PS512)
954
+ signatureAlgorithm === JoseSignatureAlgorithm.RS512 || signatureAlgorithm === JoseSignatureAlgorithm.PS512
955
955
  ? sha512
956
- : signatureAlgorithm === (JoseSignatureAlgorithm.RS384 || JoseSignatureAlgorithm.PS384)
956
+ : signatureAlgorithm === JoseSignatureAlgorithm.RS384 || signatureAlgorithm === JoseSignatureAlgorithm.PS384
957
957
  ? sha384
958
958
  : sha256
959
959
  switch (signatureAlgorithm) {