Skip to content

Commit fcc5f44

Browse files
committed
fix: it passes the testUseEoaSessionSigsToPkpSign test! but it's a temp fix until we update the wasm package
1 parent fca727f commit fcc5f44

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ export const getSignatures = async <T>(params: {
123123
} else {
124124
let share = getFlattenShare(signatureResponse[sigName]);
125125

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+
if (share.sigType === LIT_CURVE.EcdsaK256Sha256) {
129+
share.sigType = LIT_CURVE.EcdsaK256;
130+
}
131+
126132
share = {
127133
sigType: share.sigType,
128134
signatureShare: share.signatureShare,
@@ -169,7 +175,10 @@ export const getSignatures = async <T>(params: {
169175

170176
shares.sort((a, b) => a.shareIndex - b.shareIndex);
171177

172-
const sigName = shares[0].sigName;
178+
let sigName = shares[0].sigName;
179+
if (sigName === LIT_CURVE.EcdsaK256Sha256) {
180+
sigName = LIT_CURVE.EcdsaK256;
181+
}
173182
logWithRequestId(
174183
requestId,
175184
`starting signature combine for sig name: ${sigName}`,
@@ -211,7 +220,7 @@ export const getSignatures = async <T>(params: {
211220
);
212221
}
213222

214-
const sigType = mostCommonString(shares.map((s) => s.sigType));
223+
let sigType = mostCommonString(shares.map((s) => s.sigType));
215224

216225
// -- validate if this.networkPubKeySet is null
217226
if (networkPubKeySet === null) {
@@ -225,12 +234,15 @@ export const getSignatures = async <T>(params: {
225234
);
226235
}
227236

237+
if (sigType === LIT_CURVE.EcdsaK256Sha256) {
238+
sigType = LIT_CURVE.EcdsaK256;
239+
}
240+
228241
// -- validate if signature type is ECDSA
229242
if (
230243
sigType !== LIT_CURVE.EcdsaCaitSith &&
231244
sigType !== LIT_CURVE.EcdsaK256 &&
232-
sigType !== LIT_CURVE.EcdsaCAITSITHP256 &&
233-
sigType !== LIT_CURVE.EcdsaK256Sha256
245+
sigType !== LIT_CURVE.EcdsaCAITSITHP256
234246
) {
235247
throw new UnknownSignatureType(
236248
{

0 commit comments

Comments
 (0)