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