Problem
client.upload() always wraps content in a metadata structure:
{
"data": "<base64 of content>",
"content_hash": "<sha256 of content>",
"stamp_id": "..."
}
This is the SWIP-defined wrapper, but some use cases need to store clean JSON directly — e.g. dataprovenance-app stores a file-proof record (just a hash + metadata) and wants:
- The JSON readable on Swarm without base64 decoding
- The
data field to contain the structured record directly (not base64)
- Compatibility with gateway notary signing (which hashes the
data field)
Current workaround
dataprovenance-app bypasses client.upload() entirely and POSTs directly to the gateway via fetch, using only client.acquireStamp() from the SDK.
Proposed solution
Add a raw or passthrough mode to upload() that skips the base64/metadata wrapping:
await client.upload(proofJson, { raw: true, sign: 'notary' });
// Uploads the JSON as-is, no wrapping
// Gateway can still sign it (requires data field)
Or a dedicated method:
await client.uploadDocument(proofRecord, { sign: 'notary' });
// Wraps in { data: proofRecord } if not already wrapped
// No base64 encoding
Context
Problem
client.upload()always wraps content in a metadata structure:{ "data": "<base64 of content>", "content_hash": "<sha256 of content>", "stamp_id": "..." }This is the SWIP-defined wrapper, but some use cases need to store clean JSON directly — e.g. dataprovenance-app stores a file-proof record (just a hash + metadata) and wants:
datafield to contain the structured record directly (not base64)datafield)Current workaround
dataprovenance-app bypasses
client.upload()entirely and POSTs directly to the gateway via fetch, using onlyclient.acquireStamp()from the SDK.Proposed solution
Add a
raworpassthroughmode toupload()that skips the base64/metadata wrapping:Or a dedicated method:
Context
datafield in the JSONdatacan hold arbitrary structured content