Skip to content

Commit fca727f

Browse files
committed
feat: add support for EcdsaK256Sha256
1 parent 2019031 commit fca727f

File tree

3 files changed

+39
-13
lines changed

3 files changed

+39
-13
lines changed

packages/constants/src/lib/constants/constants.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,12 +1246,34 @@ export const VMTYPE = {
12461246
export type VMTYPE_TYPE = keyof typeof VMTYPE;
12471247
export type VMTYPE_VALUES = (typeof VMTYPE)[keyof typeof VMTYPE];
12481248

1249+
// pub enum SigningScheme {
1250+
1251+
// -- BLS
1252+
// Bls12381,
1253+
1254+
// -- ECDSA
1255+
// EcdsaK256Sha256,
1256+
// EcdsaP256Sha256,
1257+
// EcdsaP384Sha384,
1258+
1259+
// -- Frost
1260+
// SchnorrEd25519Sha512,
1261+
// SchnorrK256Sha256,
1262+
// SchnorrP256Sha256,
1263+
// SchnorrP384Sha384,
1264+
// SchnorrRistretto25519Sha512,
1265+
// SchnorrEd448Shake256,
1266+
// SchnorrRedJubjubBlake2b512,
1267+
// SchnorrK256Taproot,
1268+
// SchnorrRedDecaf377Blake2b512,
1269+
// SchnorrkelSubstrate,
1270+
// }
12491271
export const LIT_CURVE = {
12501272
BLS: 'BLS',
12511273
EcdsaK256: 'K256',
12521274
EcdsaCaitSith: 'ECDSA_CAIT_SITH', // Legacy alias of K256
12531275
EcdsaCAITSITHP256: 'EcdsaCaitSithP256',
1254-
EcdsaK256Sha256: 'EcdsaK256Sha256',
1276+
EcdsaK256Sha256: 'EcdsaK256Sha256', // same as caitsith
12551277
} as const;
12561278

12571279
export type LIT_CURVE_TYPE = keyof typeof LIT_CURVE;

packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,24 +1197,29 @@ export class LitNodeClientNodeJs
11971197

11981198
logWithRequestId(
11991199
requestId,
1200-
'responseData',
1200+
'pkpSign responseData',
12011201
JSON.stringify(responseData, null, 2)
12021202
);
12031203

12041204
// ========== Extract shares from response data ==========
12051205
// -- 1. combine signed data as a list, and get the signatures from it
12061206
const signedDataList = parsePkpSignResponse(responseData);
12071207

1208-
const signatures = await getSignatures<{ signature: SigResponse }>({
1209-
requestId,
1210-
networkPubKeySet: this.networkPubKeySet,
1211-
minNodeCount: this.config.minNodeCount,
1212-
signedData: signedDataList,
1213-
});
1208+
try {
1209+
const signatures = await getSignatures<{ signature: SigResponse }>({
1210+
requestId,
1211+
networkPubKeySet: this.networkPubKeySet,
1212+
minNodeCount: this.config.minNodeCount,
1213+
signedData: signedDataList,
1214+
});
12141215

1215-
logWithRequestId(requestId, `signature combination`, signatures);
1216+
logWithRequestId(requestId, `signature combination`, signatures);
12161217

1217-
return signatures.signature; // only a single signature is ever present, so we just return it.
1218+
return signatures.signature; // only a single signature is ever present, so we just return it.
1219+
} catch (e) {
1220+
console.error("Error getting signature", e);
1221+
throw e;
1222+
}
12181223
};
12191224

12201225
/**
@@ -1992,8 +1997,6 @@ export class LitNodeClientNodeJs
19921997

19931998
// console.log("priceFeedInfo:", priceFeedInfo);
19941999

1995-
// process.exit();
1996-
19972000
// This is the template that will be combined with the node address as a single object, then signed by the session key
19982001
// so that the node can verify the session signature
19992002
const sessionSigningTemplate = {

packages/types/src/lib/interfaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ export interface SigShare {
671671
| 'BLS'
672672
| 'K256'
673673
| 'ECDSA_CAIT_SITH' // Legacy alias of K256
674-
| 'EcdsaCaitSithP256';
674+
| 'EcdsaCaitSithP256'
675+
| 'EcdsaK256Sha256'
675676

676677
signatureShare: string;
677678
shareIndex?: number;

0 commit comments

Comments
 (0)