Skip to main content

Submit records to a Data Maker form: read a signed .dmf bundle, validate values, sealed-box encrypt, and post to the public submissions endpoint.

Project description

datamaker (Python)

Submit records to a Data Maker form from Python. Reads a signed .dmf bundle, validates your values against its field schema, sealed-box encrypts them client-side against the form owner's public key, and posts the ciphertext to the public submissions endpoint. Everything except the final POST runs offline; the server never sees your data in the clear.

The Node twin is @fobo-tools/datamaker — same wire contract, same .dmf reader.

Install

pip install datamaker-forms

Depends only on PyNaCl. Python ≥ 3.9.

Library

import datamaker as dm

with open("contact.dmf", "rb") as fh:
    form = dm.read_form(fh.read())   # verifies signature + form hash

result = dm.submit(
    form=form,
    values={"email": "ada@example.com", "full_name": "Ada"},
)
# → {"submission_id": ..., "edit_token": ..., "form_id": "contact_form"}

You can also pass the raw bundle straight to submit:

dm.submit(dmf=open("contact.dmf", "rb").read(), values={"email": "ada@example.com"})

API

  • read_form(dmf_bytes, verify=True) -> FormDescriptor — verifies the publisher's Ed25519 signature over the manifest and that form.json matches its signed hash; raises DmfError on tampering. The descriptor exposes form_id, name, schema_version, submit_policy, recipient_user_id, recipient_public_key, fields, and verified.

  • submit(form=… | dmf=…, values=…, **opts) -> dict — validates, seals, and posts. Options: api_base_url, submitter_id (default None = anonymous), validate (default True), allow_unknown, verify, and poster (inject a custom HTTP poster for testing).

  • build_submission(form, values, **opts) -> dict — validate + seal without sending; returns submission_id, envelope, payload, values.

  • post_submission(envelope, **opts) -> dict — post a pre-built envelope.

  • validate_values(fields, input, allow_unknown=False) -> (values, issues) — pure validation/coercion, no crypto.

Validation

submit/build_submission raise ValidationError (with .issues) for missing required fields, unknown keys (set allow_unknown=True to ignore), and values for read-only kinds (calc, heading, signature). Values are coerced to the wire shape per kind: numbers from strings, booleans from "yes"/"true"/1, multi-choice → list, choice membership checked unless the field allows custom.

File-upload kinds (image, attachment) are passed through as-is.

CLI

datamaker inspect contact.dmf
datamaker inspect contact.dmf --json

datamaker submit contact.dmf --field email=ada@example.com --field full_name=Ada
datamaker submit contact.dmf --data '{"email": "ada@example.com"}'
datamaker submit contact.dmf --data-file answers.json --dry-run

License

BSD-3-Clause © FOBO Tools

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datamaker_forms-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datamaker_forms-0.1.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file datamaker_forms-0.1.0.tar.gz.

File metadata

  • Download URL: datamaker_forms-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for datamaker_forms-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b79344523b991cccefd5512439d78f42a71b491f576911fa45874b1e8d4a6a04
MD5 5d81984ac3acd89699224b484be6652d
BLAKE2b-256 220768f4634c0c1563bf3022fbfb3cfcbbfa02e3db0cd4166f851a5b7fe65b4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for datamaker_forms-0.1.0.tar.gz:

Publisher: publish-sdk-py.yml on FOBO-Tools/fobo-data-maker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file datamaker_forms-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for datamaker_forms-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c5fd20c6d8a222f795885bbbeea9be5e0d317c018694d86b0c92d897f1188f9
MD5 57e51c200f2e5c27341b403a9ceff8f5
BLAKE2b-256 dc2b17cd0a0300386ab025829c3be9aeaa2ed8ab045a41115fd38b2b2a160255

See more details on using hashes here.

Provenance

The following attestation bundles were made for datamaker_forms-0.1.0-py3-none-any.whl:

Publisher: publish-sdk-py.yml on FOBO-Tools/fobo-data-maker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page