402mob-merchant-sdk 0.4.1 → 0.4.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.2 — prepared, unpublished
4
+
5
+ - Add optional `artifact` commitment and `share` fields to resolved resources. Validate supplied commitments and preserve compatibility with older servers that omit them.
6
+
3
7
  ## 0.4.1
4
8
 
5
9
  - Documentation-only release. The packaged README no longer states that the CLI's published SDK dependency remains 0.3.1; it states that published CLI 0.2.0 pins SDK 0.4.0. No code changes: `dist` is byte-identical to 0.4.0.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # 402Mob Merchant SDK
2
2
 
3
+ Source 0.4.2 is prepared locally with optional Payment Links commitment/share types and validation. Published 0.4.1 remains unchanged; these additions require the new source build until publication.
4
+
3
5
  **Version 0.4.0** adds worker profiles and discovery, public buyer requests and newest-first Work Ticket reads. Upgrade from 0.3.1 to use these additions. Check the target server's `/v1/capabilities` first; new worker routes require `workerDiscovery`. See [CHANGELOG.md](./CHANGELOG.md).
4
6
 
5
7
  An open-source, dependency-free TypeScript client for resolving agent resources and enrolling or operating a 402Mob merchant from a Node.js server or agent runtime.
package/dist/index.d.ts CHANGED
@@ -124,8 +124,16 @@ export interface AgentResourceProvider {
124
124
  payoutAddress?: EvmAddress;
125
125
  createdAt?: string;
126
126
  }
127
+ /** Public commitment; the private verifier is returned only with paid delivery. */
128
+ export interface ArtifactCommitment {
129
+ algorithm: "sha256-private-proof-v1";
130
+ commitment: string;
131
+ sizeUpperBound: number;
132
+ }
127
133
  /** A provider-published, fixed-price resource descriptor. */
128
134
  export interface AgentResource {
135
+ artifact?: ArtifactCommitment;
136
+ share?: string;
129
137
  id: string;
130
138
  seriesId: string;
131
139
  version: string;
package/dist/index.js CHANGED
@@ -443,7 +443,12 @@ function isAgentResource(value) {
443
443
  return false;
444
444
  const amountAtomic = value.amountAtomic;
445
445
  const amountUSDC = value.amountUSDC;
446
- return nonempty(value.id) && nonempty(value.seriesId) && nonempty(value.version) &&
446
+ return (value.share === undefined || nonempty(value.share)) &&
447
+ (value.artifact === undefined || (isRecord(value.artifact) && value.artifact.algorithm === "sha256-private-proof-v1" &&
448
+ typeof value.artifact.commitment === "string" && /^[a-f0-9]{64}$/.test(value.artifact.commitment) &&
449
+ Number.isSafeInteger(value.artifact.sizeUpperBound) && Number(value.artifact.sizeUpperBound) >= 1024 &&
450
+ Number(value.artifact.sizeUpperBound) <= 49152 && Number(value.artifact.sizeUpperBound) % 1024 === 0)) &&
451
+ nonempty(value.id) && nonempty(value.seriesId) && nonempty(value.version) &&
447
452
  nonempty(value.title) && typeof value.description === "string" &&
448
453
  typeof amountAtomic === "string" && /^[1-9][0-9]*$/.test(amountAtomic) &&
449
454
  typeof amountUSDC === "string" && /^(0|[1-9][0-9]*)(\.[0-9]{1,6})?$/.test(amountUSDC) &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "402mob-merchant-sdk",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "TypeScript client for resolving agent resources and enrolling and operating 402Mob merchants.",
5
5
  "license": "MIT",
6
6
  "repository": {