Skip to content

Commit 4766389

Browse files
committed
fix: hacky sigType map
1 parent 6b66532 commit 4766389

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

packages/crypto/src/lib/crypto.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ const ecdsaSigntureTypeMap: Partial<Record<LIT_CURVE_VALUES, EcdsaVariant>> = {
166166
[LIT_CURVE.EcdsaCaitSith]: 'K256',
167167
[LIT_CURVE.EcdsaK256]: 'K256',
168168
[LIT_CURVE.EcdsaCAITSITHP256]: 'P256',
169+
[LIT_CURVE.EcdsaK256Sha256]: 'K256',
169170
};
170171

171172
/**

packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -122,18 +122,6 @@ export const getSignatures = async <T>(params: {
122122
delete signatureResponse[sigName];
123123
} else {
124124
let share = getFlattenShare(signatureResponse[sigName]);
125-
126-
// FIXME: we should not be hacking the sigType here, but the wsam package is expecting enum EcdsaVariant which
127-
// might not have account for the sha256 variant. This is a temporary fix until the wsam package is updated.
128-
// This is the wasm error we are getting:
129-
// Error: invalid type: unit value, expected enum EcdsaVariant
130-
// at imports.wbg.__wbindgen_throw (file:///js-sdk/local-tests/build/test.mjs:101518:11)
131-
// at wasm://wasm/0028e512:wasm-function[1245]:0x90506
132-
// at wasm://wasm/0028e512:wasm-function[538]:0x6a4f9
133-
// if (share.sigType === LIT_CURVE.EcdsaK256Sha256) {
134-
// share.sigType = LIT_CURVE.EcdsaK256;
135-
// }
136-
137125
share = {
138126
sigType: share.sigType,
139127
signatureShare: share.signatureShare,
@@ -181,9 +169,7 @@ export const getSignatures = async <T>(params: {
181169
shares.sort((a, b) => a.shareIndex - b.shareIndex);
182170

183171
let sigName = shares[0].sigName;
184-
if (sigName === LIT_CURVE.EcdsaK256Sha256) {
185-
sigName = LIT_CURVE.EcdsaK256;
186-
}
172+
187173
logWithRequestId(
188174
requestId,
189175
`starting signature combine for sig name: ${sigName}`,
@@ -247,7 +233,8 @@ export const getSignatures = async <T>(params: {
247233
if (
248234
sigType !== LIT_CURVE.EcdsaCaitSith &&
249235
sigType !== LIT_CURVE.EcdsaK256 &&
250-
sigType !== LIT_CURVE.EcdsaCAITSITHP256
236+
sigType !== LIT_CURVE.EcdsaCAITSITHP256 &&
237+
sigType! == LIT_CURVE.EcdsaK256Sha256
251238
) {
252239
throw new UnknownSignatureType(
253240
{

0 commit comments

Comments
 (0)