@peac/adapter-openclaw 0.10.12 → 0.10.14

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/dist/index.mjs CHANGED
@@ -1,5 +1,7 @@
1
- import { canonicalize, base64urlDecode, sign, generateKeypair, base64urlEncode as base64urlEncode$1 } from '@peac/crypto';
2
- import { toInteractionEvidence, createHasher, createCaptureSession } from '@peac/capture-core';
1
+ import * as crypto from '@peac/crypto';
2
+ import { canonicalize, generateKeypair, base64urlEncode as base64urlEncode$1 } from '@peac/crypto';
3
+ import * as captureCore from '@peac/capture-core';
4
+ import { toInteractionEvidence } from '@peac/capture-core';
3
5
  import * as path from 'path';
4
6
  import * as fs2 from 'fs/promises';
5
7
  import { createFsSpoolStore, createFsDedupeIndex, getFsSpoolDiagnostics } from '@peac/capture-node';
@@ -486,10 +488,10 @@ function createJwkSigner(jwk, issuer, audience) {
486
488
  if (!jwk.d) {
487
489
  throw new Error("JWK must include private key (d parameter)");
488
490
  }
489
- const privateKeyBytes = base64urlDecode(jwk.d);
491
+ const privateKeyBytes = crypto.base64urlDecode(jwk.d);
490
492
  return {
491
493
  async sign(payload) {
492
- return sign(payload, privateKeyBytes, kid);
494
+ return crypto.sign(payload, privateKeyBytes, kid);
493
495
  },
494
496
  getKeyId() {
495
497
  return kid;
@@ -594,8 +596,8 @@ async function createPluginInstance(options) {
594
596
  batchSize = 100,
595
597
  onError
596
598
  } = options;
597
- const hasher = await createHasher();
598
- const session = createCaptureSession({
599
+ const hasher = await captureCore.createHasher();
600
+ const session = captureCore.createCaptureSession({
599
601
  store,
600
602
  dedupe,
601
603
  hasher
@@ -710,6 +712,10 @@ function decodeReceiptPayload(receipt) {
710
712
  return null;
711
713
  }
712
714
  }
715
+ function stripRedundantFields(content) {
716
+ const { auth, evidence, ...rest } = content;
717
+ return rest;
718
+ }
713
719
  var ALG_KEY_TYPE_MAP = {
714
720
  EdDSA: { kty: "OKP", crv: ["Ed25519", "Ed448"] },
715
721
  ES256: { kty: "EC", crv: ["P-256"] },
@@ -900,9 +906,11 @@ function createExportBundleTool(outputDir, logger) {
900
906
  const receiptsDir = pathModule.join(bundleDir, "receipts");
901
907
  await fs3.promises.mkdir(receiptsDir, { recursive: true });
902
908
  for (const receipt of receipts) {
909
+ const content = receipt.content;
910
+ const written = typeof content._jws === "string" ? stripRedundantFields(content) : content;
903
911
  await fs3.promises.writeFile(
904
912
  pathModule.join(receiptsDir, receipt.file),
905
- JSON.stringify(receipt.content, null, 2)
913
+ JSON.stringify(written, null, 2)
906
914
  );
907
915
  }
908
916
  logger.info(`Exported ${receipts.length} receipts to ${bundleDir}`);