@chipi-stack/backend 14.6.0 → 14.8.0

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.
@@ -240,21 +240,28 @@ async function buildEd25519Envelope(params) {
240
240
  );
241
241
  }
242
242
  const ed = await import('@noble/ed25519');
243
- const garaga = await ensureGaragaInit();
244
243
  const publicKey = await ed.getPublicKeyAsync(params.privateKey);
245
244
  const signedBytes = ed25519SignedBytes(params.messageHash);
246
245
  const signature = await ed.signAsync(signedBytes, params.privateKey);
247
- const R = signature.slice(0, 32);
248
- const s = signature.slice(32, 64);
249
- const payload = garaga.eddsaCalldataBuilder(
250
- bytesToLeBigInt(R),
251
- bytesToLeBigInt(s),
252
- bytesToLeBigInt(publicKey),
246
+ return assembleEd25519Envelope({
247
+ R: signature.slice(0, 32),
248
+ s: signature.slice(32, 64),
249
+ publicKey,
253
250
  signedBytes,
251
+ ownerIndex
252
+ });
253
+ }
254
+ async function assembleEd25519Envelope(parts) {
255
+ const garaga = await ensureGaragaInit();
256
+ const payload = garaga.eddsaCalldataBuilder(
257
+ bytesToLeBigInt(parts.R),
258
+ bytesToLeBigInt(parts.s),
259
+ bytesToLeBigInt(parts.publicKey),
260
+ parts.signedBytes,
254
261
  false
255
262
  );
256
263
  return wrapV2Snip12Envelope({
257
- ownerId: ownerIndex,
264
+ ownerId: parts.ownerIndex,
258
265
  kindTag: ED25519_KIND_TAG,
259
266
  payload
260
267
  });