wao 0.24.2 → 0.25.1

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.
package/esm/hb.js CHANGED
@@ -285,6 +285,7 @@ class HB {
285
285
  ],
286
286
  "output-prefix": "wasm",
287
287
  "patch-from": "/results/outbox",
288
+ "patch-mode": "patches",
288
289
  "stack-keys": ["init", "compute", "snapshot", "normalize"],
289
290
  passes: 2,
290
291
  })
@@ -382,7 +383,10 @@ class HB {
382
383
  module: "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
383
384
  device: "process@1.0",
384
385
  "scheduler-device": "scheduler@1.0",
385
- "execution-device": "genesis-wasm@1.0",
386
+ "execution-device": "stack@1.0",
387
+ "device-stack": ["genesis-wasm@1.0", "patch@1.0"],
388
+ "patch-from": "/results/outbox",
389
+ "stack-keys": ["init", "compute", "snapshot", "normalize"],
386
390
  })
387
391
  return await this.spawn(tags)
388
392
  }
package/esm/hyperbeam.js CHANGED
@@ -63,7 +63,6 @@ export default class HyperBEAM {
63
63
  this.hbeam.on("close", code =>
64
64
  console.log(`child process exited with code ${code}`)
65
65
  )
66
- return this.hbeam
67
66
  }
68
67
 
69
68
  genEnv() {
@@ -375,3 +375,28 @@ export const toHttpSigner = signer => {
375
375
  }
376
376
  }
377
377
  }
378
+
379
+ /**
380
+ * Utility function to extract the message ID from a signed message
381
+ * Based on the original code's hash calculation
382
+ */
383
+ async function getMessageId(signedMessage) {
384
+ // Extract signature from the Signature header
385
+ const signatureHeader =
386
+ signedMessage.headers.Signature || signedMessage.headers.signature
387
+ const match = signatureHeader.match(/Signature:\s*'http-sig-[^:]+:([^']+)'/)
388
+ const signature = match ? match[1] : null
389
+
390
+ if (!signature) {
391
+ throw new Error("Could not extract signature from headers")
392
+ }
393
+
394
+ // Hash the signature to get message ID
395
+ const encoder = new TextEncoder()
396
+ const data = encoder.encode(signature)
397
+ const hashBuffer = await crypto.subtle.digest("SHA-256", data)
398
+ const hashArray = Array.from(new Uint8Array(hashBuffer))
399
+ const hashBase64 = btoa(String.fromCharCode(...hashArray))
400
+
401
+ return hashBase64
402
+ }