Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confirmation is optional #95

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions archivist_samples/c2pa/c2pa.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def attachment_create(arch, attachment_description: AttachmentDescription):


document_creator = make_assets_create(
attachment_creator=attachment_create, confirm=True
attachment_creator=attachment_create,
)


Expand Down Expand Up @@ -170,7 +170,6 @@ def publish(
props=props,
attrs=attrs,
asset_attrs=asset_attrs,
confirm=True,
)

# info_report
Expand All @@ -189,7 +188,6 @@ def info_report(self, document: dict):
self.asset["identity"],
props=props,
attrs=attrs,
confirm=True,
)

# ingredients
Expand All @@ -214,7 +212,6 @@ def ingredients(self, document: dict):
self.asset["identity"],
props=props,
attrs=attrs,
confirm=True,
)

# external_manifest
Expand Down Expand Up @@ -243,7 +240,6 @@ def external_manifest(self, definition: dict, signed_image: dict):
self.asset["identity"],
props=props,
attrs=attrs,
confirm=True,
)

# details_report
Expand Down Expand Up @@ -272,7 +268,6 @@ def details_report(self, detailed: dict, manifest_store: dict):
self.asset["identity"],
props=props,
attrs=attrs,
confirm=True,
)

# parent
Expand Down Expand Up @@ -302,7 +297,6 @@ def parent(self, parent_definition: dict, signed_image: dict):
self.asset["identity"],
props=props,
attrs=attrs,
confirm=True,
)

# edit_manifest
Expand All @@ -327,5 +321,4 @@ def edit_manifest(
self.asset["identity"],
props=props,
attrs=attrs,
confirm=True,
)
26 changes: 1 addition & 25 deletions archivist_samples/document/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def attachment_create(arch, attachment_description: AttachmentDescription):


document_creator = make_assets_create(
attachment_creator=attachment_create, confirm=True
attachment_creator=attachment_create,
)


Expand Down Expand Up @@ -165,28 +165,4 @@ def publish(
props=props,
attrs=attrs,
asset_attrs=asset_attrs,
confirm=True,
)

# Withdraw version of the document
def withdraw(self, document: dict, version: str, doc_hash: str, name: str):
props = {
"operation": "Record",
"behaviour": "RecordEvidence",
}
attrs = {"arc_display_type": "Withdraw", "document_status": "Withdrawn"}

asset_attrs = {
"arc_display_name": name,
"document_document": document,
"document_hash_value": doc_hash,
"document_version": version,
}

return self.arch.events.create(
self.asset["identity"],
props=props,
attrs=attrs,
asset_attrs=asset_attrs,
confirm=True,
)
6 changes: 2 additions & 4 deletions archivist_samples/door_entry/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def attachment_create(doors, attachment_description: AttachmentDescription):
return result


doors_creator = make_assets_create(attachment_creator=attachment_create, confirm=False)
doors_creator = make_assets_create(attachment_creator=attachment_create)


# Create actual door assets
Expand Down Expand Up @@ -269,7 +269,7 @@ def create_doors(doors):
############


cards_creator = make_assets_create(confirm=False)
cards_creator = make_assets_create()


def create_cards(cards):
Expand Down Expand Up @@ -531,7 +531,6 @@ def open_door(doors, doorid, cards, cardid):
"arc_blob_hash_value": image["hash"]["value"],
},
},
confirm=True,
)

unused_card_record_evidence = cards.events.create(
Expand Down Expand Up @@ -568,7 +567,6 @@ def open_door(doors, doorid, cards, cardid):
"wavestone_evt_type": "door_open",
"arc_primary_image": [door_image],
},
confirm=True,
)
LOGGER.info("Opening door '%s' with card '%s': FINISHED", doorid, cardid)

Expand Down
2 changes: 1 addition & 1 deletion archivist_samples/sample_scripts/c2pa/c2pa_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def create_asset(
}
props = {"public": True}

return arch.assets.create(props=props, attrs=attrs, confirm=True)
return arch.assets.create(props=props, attrs=attrs)


# Uploads primary image and related attachments to DataTrails
Expand Down
31 changes: 22 additions & 9 deletions archivist_samples/sbom_document/software_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def attachment_create(arch, attachment_description: AttachmentDescription):
return result


sboms_creator = make_assets_create(attachment_creator=attachment_create, confirm=True)
sboms_creator = make_assets_create(attachment_creator=attachment_create)


class SoftwarePackageDocument:
Expand Down Expand Up @@ -187,7 +187,6 @@ def publish(
props=props,
attrs=attrs,
asset_attrs=asset_attrs,
confirm=True,
)

def release_plan(
Expand Down Expand Up @@ -220,7 +219,9 @@ def release_plan(
attrs.update(custom_attrs)

return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)

def release_accepted(
Expand Down Expand Up @@ -253,7 +254,9 @@ def release_accepted(
attrs.update(custom_attrs)

return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)

# Patch Events
Expand Down Expand Up @@ -289,7 +292,9 @@ def patch(
attrs.update(custom_attrs)

return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)

def private_patch(
Expand Down Expand Up @@ -325,7 +330,9 @@ def private_patch(
attrs.update(custom_attrs)

return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)

# Vulnerability Events
Expand Down Expand Up @@ -364,7 +371,9 @@ def vuln_disclosure(
attrs.update(custom_attrs)

return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)

def vuln_update(
Expand Down Expand Up @@ -401,7 +410,9 @@ def vuln_update(
attrs.update(custom_attrs)

return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)

# EOL/Deprecation
Expand Down Expand Up @@ -436,5 +447,7 @@ def deprecation(
attrs.update(custom_attrs)

return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)
4 changes: 2 additions & 2 deletions archivist_samples/signed_records/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def generate_crypto_asset(archivist, asset_name):
"arc_display_type": "Crypto endpoint",
"arc_evidence_signing_pubkey": pubkey_pem.decode("utf-8"),
}
newasset = archivist.assets.create(attrs=attrs, confirm=True)
newasset = archivist.assets.create(attrs=attrs)
LOGGER.debug(newasset)
if not newasset:
LOGGER.error("Failed to register new asset with Archivist")
Expand Down Expand Up @@ -243,7 +243,7 @@ def submit_signed_evidence(archivist, asset_name, message, corrupt_sig):
# should cover the complete 'arc_evidence' field (and no more)
"arc_evidence_signature": signature,
}
archivist.events.create(a_id, props, attrs, confirm=True)
archivist.events.create(a_id, props, attrs)


def print_history(archivist, asset_name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def installation(
props=props,
attrs=attrs,
asset_attrs=asset_attrs,
confirm=True,
)

def decommission(
Expand Down Expand Up @@ -249,7 +248,6 @@ def upgrade(
props=props,
attrs=attrs,
asset_attrs=asset_attrs,
confirm=True,
)

def upgrade_plan(
Expand Down Expand Up @@ -294,7 +292,9 @@ def upgrade_plan(
if custom_attrs is not None:
attrs.update(custom_attrs)
return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)

def upgrade_accepted(
Expand Down Expand Up @@ -339,7 +339,9 @@ def upgrade_accepted(
if custom_attrs is not None:
attrs.update(custom_attrs)
return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)

# Rollback Events
Expand Down Expand Up @@ -402,7 +404,6 @@ def rollback(
props=props,
attrs=attrs,
asset_attrs=asset_attrs,
confirm=True,
)

def rollback_plan(
Expand Down Expand Up @@ -447,7 +448,9 @@ def rollback_plan(
if custom_attrs is not None:
attrs.update(custom_attrs)
return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)

def rollback_accepted(
Expand Down Expand Up @@ -492,7 +495,9 @@ def rollback_accepted(
if custom_attrs is not None:
attrs.update(custom_attrs)
return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)

# Vulnerability Events
Expand Down Expand Up @@ -538,7 +543,9 @@ def vuln_disclosure(
attrs.update(custom_attrs)

return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)

def vuln_update(
Expand Down Expand Up @@ -581,7 +588,9 @@ def vuln_update(
attrs.update(custom_attrs)

return self.arch.events.create(
self._asset["identity"], props=props, attrs=attrs, confirm=True
self._asset["identity"],
props=props,
attrs=attrs,
)

def _add_attachments(self, attachments: list):
Expand Down
Loading
Loading