Python: Transparency log (c2sp-tlog)
Everything on this page is imported from dnsid.c2sp_tlog. The subpackage is wire-compatible with the other DNSid SDKs’ c2sp-tlog implementations.
AsyncC2spBoundedResourceFetcher
Section titled “AsyncC2spBoundedResourceFetcher”from dnsid.c2sp_tlog import AsyncC2spBoundedResourceFetcherBases: C2spBoundedResourceFetcher, Protocol
Optional native async capability of a synchronous bounded fetcher.
Apply the same URL, decoded-byte, DNS/TLS and redirect guarantees. Honor the verification budget and close in-progress responses on cancellation. Injected resources remain caller-owned and must support concurrent calls on their supported event loops.
async_fetch_bounded
Section titled “async_fetch_bounded”AsyncC2spBoundedResourceFetcher.async async_fetch_bounded(url: str, max_bytes: int) -> bytesFetch bounded decoded bytes, closing the response on cancellation.
AsyncC2spTlogSource
Section titled “AsyncC2spTlogSource”from dnsid.c2sp_tlog import AsyncC2spTlogSourceBases: C2spTlogSource, Protocol
Optional async evidence reads with the same guarantees as C2spTlogSource.
async_fetch_checkpoint
Section titled “async_fetch_checkpoint”AsyncC2spTlogSource.async async_fetch_checkpoint(reference: ParsedC2spTlogLr) -> bytesFetch the raw signed checkpoint bytes without blocking.
async_read_entry
Section titled “async_read_entry”AsyncC2spTlogSource.async async_read_entry(reference: ParsedC2spTlogLr, index: int) -> C2spProvenEntryReturn bounded, untrusted inclusion evidence without blocking.
async_load_stream
Section titled “async_load_stream”AsyncC2spTlogSource.async async_load_stream(reference: ParsedC2spTlogLr, fqdn: str) -> C2spStreamEvidenceReturn the same complete evidence as load_stream without blocking.
C2SP_SPEC_REVISIONS
Section titled “C2SP_SPEC_REVISIONS”from dnsid.c2sp_tlog import C2SP_SPEC_REVISIONSType: dict[str, str]
Value: {'tlog-checkpoint': 'v1.0.0', 'tlog-tiles': 'v0.1.0', 'tlog-proof': 'ab17a74116563005f908b9167e6421cc929a5c2b', 'tlog-policy': '1896a5aea5559b3203d275d0206d872f59348cf5', 'tlog-witness': 'v1.0.0', 'tlog-cosignature': 'v1.0.1', 'tlog-mirror': 'd0fe789122c75b903bfc1680b0b8b8dc570f0db3', 'signed-note': 'v1.0.0'}
C2spBoundedResourceFetcher
Section titled “C2spBoundedResourceFetcher”from dnsid.c2sp_tlog import C2spBoundedResourceFetcherBases: Protocol
Fetcher that enforces a decoded response limit during each read.
Implementations also provide cancellation or finite request deadlines so a resource read cannot wait indefinitely.
fetch_bounded
Section titled “fetch_bounded”C2spBoundedResourceFetcher.fetch_bounded(url: str, max_bytes: int) -> bytesFetch exactly url and return at most max_bytes decoded bytes.
security_guarantees
Section titled “security_guarantees”C2spBoundedResourceFetcher.security_guarantees() -> C2spResourceFetchGuaranteesDeclare the public-read security capabilities enforced by the fetcher.
C2spChain
Section titled “C2spChain”from dnsid.c2sp_tlog import C2spChainLogical stream-chain metadata required in every scope.
C2spCheckpointConsistencyError
Section titled “C2spCheckpointConsistencyError”from dnsid.c2sp_tlog import C2spCheckpointConsistencyErrorBases: C2spTlogVerificationError
A checkpoint violates previously accepted trust; never automatically retry.
category identifies the failed check: LOG_ROLLBACK (smaller size),
LOG_FORK (same size, different root), or LOG_INCONSISTENT (growing
tree is not an extension). None establishes whether recovery was authorized.
At the LogReader boundary this becomes a non-transient VerificationError
with the same category and this typed error as its __cause__.
C2spCheckpointConsistencyError constructor
Section titled “C2spCheckpointConsistencyError constructor”C2spCheckpointConsistencyError(message: str, *, category: C2spLifecycleErrorCategory, trusted: TrustedCheckpoint, observed: TrustedCheckpoint) -> NoneCapture both checkpoints so routing never requires message matching.
Arguments:
message(str): Description of the failed consistency check.category(C2spLifecycleErrorCategory): The observed rollback, fork, or inconsistency category.trusted(TrustedCheckpoint): Previously accepted checkpoint.observed(TrustedCheckpoint): Candidate that failed the consistency check.
C2spCheckpointStoreError
Section titled “C2spCheckpointStoreError”from dnsid.c2sp_tlog import C2spCheckpointStoreErrorBases: C2spTlogError
Trusted storage is unavailable, corrupt, or changed during recovery.
Fails closed as non-transient LOG_ERROR at the LogReader boundary.
Restore storage or investigate before retrying; never substitute empty trust.
C2spConsistencyProofSource
Section titled “C2spConsistencyProofSource”from dnsid.c2sp_tlog import C2spConsistencyProofSourceBases: Protocol
Optional source for RFC 6962 checkpoint consistency proofs.
fetch_consistency_proof
Section titled “fetch_consistency_proof”C2spConsistencyProofSource.fetch_consistency_proof(reference: ParsedC2spTlogLr, from_size: int, to_size: int) -> list[bytes]Return the RFC 6962 consistency proof from from_size to to_size.
C2spEventContext
Section titled “C2spEventContext”from dnsid.c2sp_tlog import C2spEventContextStream context stamped into (and validated against) public entries.
C2spLifecycleErrorCategory
Section titled “C2spLifecycleErrorCategory”from dnsid.c2sp_tlog import C2spLifecycleErrorCategoryStable failure categories used by C2SP lifecycle selection.
Members:
CHAIN_CONTINUITY='CHAIN_CONTINUITY'DUPLICATE_ISSUANCE='DUPLICATE_ISSUANCE'INVALID_EVIDENCE='INVALID_EVIDENCE'INCOMPLETE_STREAM='INCOMPLETE_STREAM'INVALID_MIGRATION='INVALID_MIGRATION'KEY_CONTINUITY='KEY_CONTINUITY'TERMINAL_STATE='TERMINAL_STATE'LOG_ROLLBACK='LOG_ROLLBACK'LOG_FORK='LOG_FORK'LOG_INCONSISTENT='LOG_INCONSISTENT'CHECKPOINT_STORE_ERROR='CHECKPOINT_STORE_ERROR'
C2spMigrationVerificationLimits
Section titled “C2spMigrationVerificationLimits”from dnsid.c2sp_tlog import C2spMigrationVerificationLimitsCumulative bounds for recursive previous-log verification.
C2spProvenEntry
Section titled “C2spProvenEntry”from dnsid.c2sp_tlog import C2spProvenEntryUntrusted single-entry evidence returned by a C2spTlogSource.
C2spResourceFetchGuarantees
Section titled “C2spResourceFetchGuarantees”from dnsid.c2sp_tlog import C2spResourceFetchGuaranteesCapabilities required for policy and public standard-resource reads.
C2spScanLimits
Section titled “C2spScanLimits”from dnsid.c2sp_tlog import C2spScanLimitsResource limits for the built-in complete C2SP log scanner.
C2SP entry-bundle geometry is fixed at 256 entries. Defaults bound the scanner to one million entries, 1 MiB checkpoints, exactly 16,777,472 bytes per bundle, and 256 MiB total entry-bundle bytes.
C2spSignatureValue
Section titled “C2spSignatureValue”from dnsid.c2sp_tlog import C2spSignatureValueOne member of an entry’s sigs object: signer key ID plus signature.
C2spSignerRole
Section titled “C2spSignerRole”from dnsid.c2sp_tlog import C2spSignerRoleLifecycle signer roles for c2sp-tlog envelopes.
The first three reuse their shared DNSid meanings; NEW_OPERATIONAL is owned by this binding and is only the KEY_ROTATION proof of possession.
Members:
ENTITY='Entity'OPERATIONAL_COUNTERSIGNATURE='OperationalCountersignature'PREVIOUS_OPERATIONAL='PreviousOperational'NEW_OPERATIONAL='NewOperational'
C2spStreamBundleVerifierOptions
Section titled “C2spStreamBundleVerifierOptions”from dnsid.c2sp_tlog import C2spStreamBundleVerifierOptionsLocal trust and resource limits for portable stream bundle verification.
policy_bytes and bundle_keys are independent trust inputs; neither
is taken from the bundle. Times and configured lifetime/freshness bounds
are milliseconds, matching C2spTlogReaderOptions.
C2spStreamEvidence
Section titled “C2spStreamEvidence”from dnsid.c2sp_tlog import C2spStreamEvidenceValue: StreamEvidence
C2spTlogError
Section titled “C2spTlogError”from dnsid.c2sp_tlog import C2spTlogErrorBases: Exception
Base error for the c2sp-tlog package.
During verify_domain these surface as VerificationError with LOG_ERROR.
C2spTlogOriginPolicy
Section titled “C2spTlogOriginPolicy”from dnsid.c2sp_tlog import C2spTlogOriginPolicyTrust policy for one checkpoint origin.
C2spTlogParseError
Section titled “C2spTlogParseError”from dnsid.c2sp_tlog import C2spTlogParseErrorBases: C2spTlogError
Raised when C2SP wire data (checkpoints, proofs, entries) is malformed.
C2spTlogPolicy
Section titled “C2spTlogPolicy”from dnsid.c2sp_tlog import C2spTlogPolicyLocal C2SP trust policy: per-origin log/witness keys and quorum.
C2spTlogQuorumRule
Section titled “C2spTlogQuorumRule”from dnsid.c2sp_tlog import C2spTlogQuorumRuleA quorum rule node: kind is ‘none’, ‘witness’, or ‘threshold’.
C2spTlogReader
Section titled “C2spTlogReader”from dnsid.c2sp_tlog import C2spTlogReaderBases: LogReader
LogReader over a C2SP tile log, verified against a local trust policy.
Read paths authenticate the checkpoint and select the signed lifecycle from either a strictly verified per-domain bundle or a complete raw scan. AsyncLogReader methods use native async source/fetcher capabilities, with worker fallback for sync-only injected adapters. Both APIs share verified history caches and deterministic validation. Async checkpoint-store calls run atomically in tracked workers. Injected resources remain caller-owned.
For a draft 01 record this reader performs the binding-level lifecycle checks verify_domain requires:
- Checkpoint authentication — signed-note signature against the pinned log key plus witness-quorum cosignatures, with append-only consistency against the stored trusted checkpoint (anti-rollback).
- Stream lifecycle verification — scans every entry of the identity’s stream and selects the entries forming a valid signed lifecycle: an ISSUANCE (or verified MIGRATION genesis) establishing the entity and operational keys, followed by rotations and entity-signed lifecycle events, with logical-event hash chaining in every scope.
- Bilateral ISSUANCE binding — the record’s ek/ku anchors must match the
logged entity and operational keys, both signatures verified
(
verify_bilateral_binding). - Operational continuity — the current operational key must descend from the logged initial operational key through recorded rotations.
- Non-termination — no REVOCATION or RETIREMENT event for the domain, under a
sufficiently fresh checkpoint (
checkpoint_freshness_ms). - Merkle inclusion — entry inclusion proofs against the checkpoint root.
C2spTlogReader constructor
Section titled “C2spTlogReader constructor”C2spTlogReader(lr: str, options: C2spTlogReaderOptions) -> NoneBind a reader to the stream addressed by lr and validate options.
Raises:
C2spTlogParseError: If lr is not a valid c2sp-tlog reference.C2spTlogVerificationError: If options is invalid (negative clock skew, or neither/both of transport and source given).
canonical
Section titled “canonical”C2spTlogReader.canonical(event: LogEvent) -> bytesReturn the canonical signed C2SP entry bytes for event.
In every scope only an ISSUANCE can be canonicalized here; later events must go through the prepared-event API.
Raises:
C2spTlogParseError: If the event cannot be encoded as a C2SP entry (for example, missing key metadata).VerificationError: WithVerificationCode.LOG_ERRORif the event type is unsupported or requires the prepared-event API.
key_timestamp
Section titled “key_timestamp”C2spTlogReader.key_timestamp(domain: str, key_thumbprint: str) -> datetime.datetimeReturn when key_thumbprint became an operational key for domain.
The timestamp comes from the verified lifecycle event (ISSUANCE or KEY_ROTATION) that introduced the key.
Raises:
VerificationError: WithVerificationCode.LOG_ERRORif the thumbprint does not appear in the verified history or the history itself cannot be loaded and verified.
preload_history
Section titled “preload_history”C2spTlogReader.preload_history(domain: str, entity_key: JWK) -> NoneFetch and verify the complete history for domain under entity_key.
Warms the same cache verify_bilateral_binding reads, so callers
can overlap the log fetch with other independent network work. Raises
exactly what the later binding check would have raised.
verify_bilateral_binding
Section titled “verify_bilateral_binding”C2spTlogReader.verify_bilateral_binding(record: object, entity_key: JWK, operational_key: JWK) -> BilateralBindingResultVerify the record’s ek/ku anchors against the logged lifecycle.
Loads the complete verified history anchored on entity_key (which becomes this reader’s trusted entity key for later calls), and checks that the ISSUANCE matches the record’s domain and governance ID, its entity key matches the current ek anchor, and the current operational key is recorded in the lifecycle (initial or via rotation).
verify_operational_continuity
Section titled “verify_operational_continuity”C2spTlogReader.verify_operational_continuity(domain: str, initial_operational_thumbprint: str, current_operational_thumbprint: str) -> NoneVerify the active operational key follows from the initial one.
verify_non_revocation
Section titled “verify_non_revocation”C2spTlogReader.verify_non_revocation(domain: str, at: datetime.datetime) -> LoggedStateEvidenceVerify complete, fresh logged history for domain as of at.
Requires checkpoint_freshness_ms to be configured and the
checkpoint’s witness time to be within that bound.
Returns:
LoggedStateEvidence— The accepted completeness, checkpoint, and freshness boundary.
Raises:
VerificationError: WithVerificationCode.LOG_ERRORif the domain was revoked or retired at or before at, the checkpoint is too stale, or the history cannot be loaded and verified.
read_event
Section titled “read_event”C2spTlogReader.read_event(ref: LogRef) -> AnyLogEventRead and verify the single logged event addressed by ref.
The reference must belong to this reader’s stream and carry an
@index; a matching entry in options.proofs supplies the
tlog-proof. The entry is checked for inclusion under a
policy-accepted checkpoint and must be authorized by the verified
lifecycle history of its domain.
Returns:
AnyLogEvent— The parsed, lifecycle-authorized event.
Raises:
C2spTlogParseError: If ref or the entry bytes are malformed.VerificationError: WithVerificationCode.LOG_ERRORif the proof, checkpoint policy, timestamp, or lifecycle authorization checks fail.
rebuild_history
Section titled “rebuild_history”C2spTlogReader.rebuild_history(domain: str) -> list[AnyLogEvent]Return the verified lifecycle events for domain in log order.
Raises:
VerificationError: WithVerificationCode.LOG_ERRORif the stream cannot be completely loaded, checked against the checkpoint, and verified under the trusted entity key.
rebuild_history_through
Section titled “rebuild_history_through”C2spTlogReader.rebuild_history_through(domain: str, final_entry_ref: str, entity_key: JWK, *, max_depth: int, max_events: int, max_response_bytes: int, seen_log_references: frozenset[str]) -> VerifiedCutoffHistoryVerify this stream through exactly final_entry_ref.
async_preload_history
Section titled “async_preload_history”C2spTlogReader.async async_preload_history(domain: str, entity_key: JWK) -> NoneLoad authenticated history through native reads or sync-adapter fallback.
async_key_timestamp
Section titled “async_key_timestamp”C2spTlogReader.async async_key_timestamp(domain: str, key_thumbprint: str) -> datetime.datetimeReturn the same verified key introduction time as key_timestamp.
async_verify_bilateral_binding
Section titled “async_verify_bilateral_binding”C2spTlogReader.async async_verify_bilateral_binding(record: object, entity_key: JWK, operational_key: JWK) -> BilateralBindingResultVerify both anchors against asynchronously loaded lifecycle evidence.
async_verify_operational_continuity
Section titled “async_verify_operational_continuity”C2spTlogReader.async async_verify_operational_continuity(domain: str, initial_operational_thumbprint: str, current_operational_thumbprint: str) -> NoneVerify rotations under the same lifecycle rules as the sync reader.
async_verify_non_revocation
Section titled “async_verify_non_revocation”C2spTlogReader.async async_verify_non_revocation(domain: str, at: datetime.datetime) -> LoggedStateEvidenceVerify fresh, complete, non-terminal history through at.
async_rebuild_history
Section titled “async_rebuild_history”C2spTlogReader.async async_rebuild_history(domain: str) -> list[AnyLogEvent]Rebuild authenticated history, including recursive predecessor reads.
async_rebuild_history_through
Section titled “async_rebuild_history_through”C2spTlogReader.async async_rebuild_history_through(domain: str, final_entry_ref: str, entity_key: JWK, *, max_depth: int, max_events: int, max_response_bytes: int, seen_log_references: frozenset[str]) -> VerifiedCutoffHistoryVerify the exact signed cutoff under cumulative migration bounds.
async_read_event
Section titled “async_read_event”C2spTlogReader.async async_read_event(ref: LogRef) -> AnyLogEventVerify an exact occurrence, its inclusion proof and lifecycle authority.
C2spTlogReaderOptions
Section titled “C2spTlogReaderOptions”from dnsid.c2sp_tlog import C2spTlogReaderOptionsConfiguration for C2spTlogReader.
policy is the local checkpoint trust policy (per-origin log keys,
witness keys, quorum). transport fetches URLs and must raise on HTTP
errors (a testnet deployment typically routes it through the testnet DNS
and CA). proofs pre-supplies TlogProofV1 inclusion proofs keyed by
entry index (as a string). entity_key is the trusted entity key that
anchors lifecycle verification (identity pinning). max_clock_skew_ms
is the tolerated clock skew for checkpoint/cosignature timestamps.
checkpoint_freshness_ms bounds checkpoint staleness for non-revocation.
max_tree_size is an upper bound on the accepted tree size (resource
guard). scan_limits configures all resource bounds of the built-in
complete scanner; when both are set, max_tree_size takes precedence.
migration_limits bounds recursive depth, cumulative stitched events, and
cumulative response bytes. migration_reader_factory is the advanced
low-level hook used to construct fully verifying predecessor readers; the
standard registries configure it automatically. checkpoint_store records
the highest trusted checkpoint per origin so a later verification cannot
accept a forked or rolled-back tree; share one options instance across
readers so the state accumulates.
For public scope, an injected source or transport must expose
security_guarantees() and demonstrate the complete public bounded-read
capability contract, including DNS-rebinding and redirect protections.
A scan transport must also implement fetch_bounded(url, maximum).
Supplying independently trusted bundle_keys and the exact
bundle_policy_document prefers bounded per-domain stream bundles;
hash tiles establish checkpoint continuity, while the scanner remains
the bundle-availability fallback.
C2spTlogResourceLimitError
Section titled “C2spTlogResourceLimitError”from dnsid.c2sp_tlog import C2spTlogResourceLimitErrorBases: C2spTlogVerificationError
Verification cannot complete within a finite resource limit; never noise.
C2spTlogResourceLimitError constructor
Section titled “C2spTlogResourceLimitError constructor”C2spTlogResourceLimitError(message: str) -> NoneClassify exhausted verification resources as invalid evidence.
C2spTlogSource
Section titled “C2spTlogSource”from dnsid.c2sp_tlog import C2spTlogSourceBases: Protocol
Source-neutral interface returning untrusted C2SP evidence.
fetch_checkpoint
Section titled “fetch_checkpoint”C2spTlogSource.fetch_checkpoint(reference: ParsedC2spTlogLr) -> bytesFetch the raw signed checkpoint bytes for reference.
read_entry
Section titled “read_entry”C2spTlogSource.read_entry(reference: ParsedC2spTlogLr, index: int) -> C2spProvenEntryReturn entry index with an inclusion proof and its checkpoint.
load_stream
Section titled “load_stream”C2spTlogSource.load_stream(reference: ParsedC2spTlogLr, fqdn: str) -> C2spStreamEvidenceReturn checkpoint-plus-entries evidence covering fqdn’s stream.
C2spTlogTransport
Section titled “C2spTlogTransport”from dnsid.c2sp_tlog import C2spTlogTransportValue: Callable[[str], 'bytes | str'] | C2spBoundedResourceFetcher
Lower-level callable transport or bounded standard-resource fetcher.
C2spTlogTransportError
Section titled “C2spTlogTransportError”from dnsid.c2sp_tlog import C2spTlogTransportErrorBases: C2spTlogError
Raised when fetching C2SP verification resources fails.
transient is true only when retrying the same read may succeed. TLS,
redirect, authentication, and configured resource-policy failures are
non-transient; network reachability and server-unavailable failures are
transient.
C2spTlogTransportError constructor
Section titled “C2spTlogTransportError constructor”C2spTlogTransportError(message: str, *, transient: bool, cause: BaseException | None = None, status_code: int | None = None) -> NoneInitialize a classified transport failure.
Arguments:
message(str): Human-readable transport failure.transient(bool): Whether retrying the same read may succeed.cause(BaseException | None): Underlying transport exception, when available. — defaultNonestatus_code(int | None): HTTP response status, when the server responded. — defaultNone
C2spTlogTrustProfile
Section titled “C2spTlogTrustProfile”from dnsid.c2sp_tlog import C2spTlogTrustProfileTrusted policy and bundle signers bound to one exact log.
C2spTlogVerificationError
Section titled “C2spTlogVerificationError”from dnsid.c2sp_tlog import C2spTlogVerificationErrorBases: C2spTlogError
Raised when C2SP evidence fails cryptographic or policy verification.
C2spTlogVerificationError constructor
Section titled “C2spTlogVerificationError constructor”C2spTlogVerificationError(message: str, *, category: C2spLifecycleErrorCategory | None = None, failing_candidate_index: int | None = None) -> NoneInitialize with a message and optional failure classification.
Arguments:
message(str): Human-readable description of the verification failure.category(C2spLifecycleErrorCategory | None): Stable lifecycle failure category, when the failure maps to one. — defaultNonefailing_candidate_index(int | None): Zero-based index of the candidate entry that failed, when identifiable. — defaultNone
C2spTlogVerificationOptions
Section titled “C2spTlogVerificationOptions”from dnsid.c2sp_tlog import C2spTlogVerificationOptionsConfigure create_c2sp_tlog_verification_registry.
Exactly one of trust_profile, policy_document, and
policy_url is required. A policy URL is independently trusted caller
configuration and is never inferred from an identity record or log prefix.
resource_fetcher is shared by policy and standard C2SP reads. Custom
fetchers must implement the bounded-fetch and explicit security-capability
contract. transport_config instead applies a custom DNS server and CA
bundle to the built-in fetcher; pass the same DnsidConfig.transport
given to the IdentityManager when verifying against a private registry
such as dnsid local. It is mutually exclusive with resource_fetcher.
The built-in fetcher requires HTTPS and HTTP 200, rejects redirects and
unsafe destinations, pins connections to validated DNS results, bounds
decoded bytes during reads, and uses finite deadlines.
A trust profile or direct bundle_verifier_keys enables verified
per-domain stream bundles. Unavailable endpoints fall back to the bounded
complete scanner. Growing checkpoints use candidate-authenticated hash tiles,
never a consistency-related scan fallback.
require_stream_bundle disables availability fallback, not tile reads. A positive
max_bundle_lifetime_ms is required whenever bundle keys are configured;
bundle byte and event limits retain finite defaults.
migration_limits has finite defaults for recursive depth, cumulative
history events, and cumulative response bytes. Predecessor references are
dispatched through the returned registry; additional registered methods
must implement the method-neutral verified-cutoff contract.
checkpoint_freshness_ms
intentionally has no default. Non-revocation therefore fails closed unless
the application chooses a positive maximum age. The default checkpoint
store is process-lifetime only; inject durable storage when rollback
protection must survive restarts.
C2spVerificationContext
Section titled “C2spVerificationContext”from dnsid.c2sp_tlog import C2spVerificationContextExpected identity and trusted keys for validating a prepared envelope.
A process that countersigns a prepared event (notably the operational side
of a split ISSUANCE) supplies what it expects the envelope to authorize —
its own fqdn/gi/operational_key and, when known, the trusted
entity_key — so a malicious preparer cannot obtain a signature for
an unexpected identity. new_lr pins a MIGRATION destination. Only
ISSUANCE carries gi; other events require independent trusted chain
validation to bind them to a governance identity.
Checkpoint
Section titled “Checkpoint”from dnsid.c2sp_tlog import CheckpointA parsed C2SP checkpoint (origin, tree size, root hash, signatures).
CheckpointPolicyResult
Section titled “CheckpointPolicyResult”from dnsid.c2sp_tlog import CheckpointPolicyResultOutcome of checkpoint policy enforcement.
CheckpointStore
Section titled “CheckpointStore”from dnsid.c2sp_tlog import CheckpointStoreBases: ABC
Record of the highest trusted checkpoint per origin.
Implementations MUST be safe for concurrent use. Consistency enforcement
and advancement MUST be atomic per origin (see verify_and_advance):
checking a new checkpoint against the trusted one and recording it cannot
be split, or two concurrent verifications could each accept a different
forked extension of the same trusted checkpoint.
CheckpointStore.get(origin: str) -> TrustedCheckpoint | NoneReturn the trusted checkpoint for origin, or None if unseen.
CheckpointStore.put(checkpoint: TrustedCheckpoint) -> NoneUnconditionally record checkpoint if it advances origin.
Bypasses consistency checking; intended for seeding trusted state, not
for the verification path (use verify_and_advance).
verify_and_advance
Section titled “verify_and_advance”CheckpointStore.verify_and_advance(candidate: TrustedCheckpoint, verify: Callable[[TrustedCheckpoint | None], None]) -> NoneAtomically check consistency and advance the trusted checkpoint.
Under the per-origin lock: load the trusted checkpoint, call verify with it (which MUST raise if candidate is a rollback or fork of that trusted state), then record candidate if it advances the tree. Implementations must validate inputs and stored records, return immutable snapshots, and check the invocation budget before publication and while waiting for locks. Storage failures raise C2spCheckpointStoreError; callback failures retain their original type and cause.
Holding the lock across verify and advance serializes concurrent verifications of one origin, so an equivocating log cannot get two forked extensions accepted against the same trusted checkpoint.
DNSID_C2SP_ENVELOPE_VERSION
Section titled “DNSID_C2SP_ENVELOPE_VERSION”from dnsid.c2sp_tlog import DNSID_C2SP_ENVELOPE_VERSIONType: int
Value: 1
DnsidManagedVerificationOptions
Section titled “DnsidManagedVerificationOptions”from dnsid.c2sp_tlog import DnsidManagedVerificationOptionsShared infrastructure for managed DNSid log verification.
Trust roots, freshness, resource limits, and bundle preference are fixed by
the embedded managed catalog. Callers needing different trust use
create_c2sp_tlog_verification_registry.
InMemoryCheckpointStore
Section titled “InMemoryCheckpointStore”from dnsid.c2sp_tlog import InMemoryCheckpointStoreBases: CheckpointStore
Process-lifetime trusted-checkpoint store (the default).
Resists rollback and fork only while this same store instance is retained.
Creating a new store or registry loses remembered trust even without a
process restart; the next checkpoint is trusted on first contact. A verifier
that must resist cross-restart rollback MUST inject a deployment-provided
durable CheckpointStore; the SDK supplies only in-memory storage. It does
not emit a runtime warning when this default is selected.
InMemoryCheckpointStore constructor
Section titled “InMemoryCheckpointStore constructor”InMemoryCheckpointStore() -> NoneCreate an empty store with no trusted checkpoints.
InMemoryCheckpointStore.get(origin: str) -> TrustedCheckpoint | NoneReturn the immutable trusted checkpoint for origin, or None if unseen.
InMemoryCheckpointStore.put(checkpoint: TrustedCheckpoint) -> NoneSeed advancing state without proof checks; reject equal-size conflicts.
verify_and_advance
Section titled “verify_and_advance”InMemoryCheckpointStore.verify_and_advance(candidate: TrustedCheckpoint, verify: Callable[[TrustedCheckpoint | None], None]) -> NoneRun verify and record candidate under the per-origin lock.
Exceptions raised by verify propagate and leave the trusted checkpoint for the origin unchanged.
IndexedEntry
Section titled “IndexedEntry”from dnsid.c2sp_tlog import IndexedEntryOne raw log entry paired with its zero-based leaf index.
ManagedIssuanceInProgressError
Section titled “ManagedIssuanceInProgressError”from dnsid.c2sp_tlog import ManagedIssuanceInProgressErrorBases: DNSidError
A durable operation already owns this identity, including completion.
ManagedIssuanceInProgressError constructor
Section titled “ManagedIssuanceInProgressError constructor”ManagedIssuanceInProgressError(issuance: ManagedIssuanceState) -> NoneRetain the existing operation for explicit resume.
ManagedIssuanceOperationError
Section titled “ManagedIssuanceOperationError”from dnsid.c2sp_tlog import ManagedIssuanceOperationErrorBases: DNSidError
Preparation, submission, or persistence failed with retained progress.
ManagedIssuanceOperationError constructor
Section titled “ManagedIssuanceOperationError constructor”ManagedIssuanceOperationError(message: str, issuance: ManagedIssuanceState, *, state: str, transient: bool = False, retry_same_bytes: bool = False, cause: BaseException | None = None) -> NoneRetain state and structured retry semantics.
ManagedIssuanceRegistry
Section titled “ManagedIssuanceRegistry”from dnsid.c2sp_tlog import ManagedIssuanceRegistryBases: Protocol
The existing registry preparation and exact-byte submission surface.
prepare_issuance
Section titled “prepare_issuance”ManagedIssuanceRegistry.prepare_issuance(domain: str, idempotency_key: str) -> PreparedRegistryEventReturn untrusted, partially signed bytes.
submit_prepared_event
Section titled “submit_prepared_event”ManagedIssuanceRegistry.submit_prepared_event(domain: str, entry_bytes: bytes, idempotency_key: str) -> SubmissionResultSubmit exactly the persisted bytes.
ManagedIssuanceState
Section titled “ManagedIssuanceState”from dnsid.c2sp_tlog import ManagedIssuanceStateRecovery record; completed bytes and the idempotency key never change.
ManagedIssuanceStore
Section titled “ManagedIssuanceStore”from dnsid.c2sp_tlog import ManagedIssuanceStoreBases: Protocol
Exclusive durable storage for one operation per identity instance.
create_managed_issuance
Section titled “create_managed_issuance”ManagedIssuanceStore.create_managed_issuance(initial: ManagedIssuanceState) -> ManagedIssuanceState | NonePersist initial atomically, or return the existing operation.
load_managed_issuance
Section titled “load_managed_issuance”ManagedIssuanceStore.load_managed_issuance(domain: str) -> ManagedIssuanceState | NoneLoad the authoritative operation.
persist_managed_issuance
Section titled “persist_managed_issuance”ManagedIssuanceStore.persist_managed_issuance(state: ManagedIssuanceState) -> NoneDurably save a transition while holding exclusive ownership.
MigrationVerificationResult
Section titled “MigrationVerificationResult”from dnsid.c2sp_tlog import MigrationVerificationResultPrior state for the advanced low-level lifecycle-selection callback.
Standard readers do not accept caller-constructed migration results; they recover this state through bounded recursive log verification.
NoteSignature
Section titled “NoteSignature”from dnsid.c2sp_tlog import NoteSignatureOne signature line from a signed note.
ParsedC2spTlogLr
Section titled “ParsedC2spTlogLr”from dnsid.c2sp_tlog import ParsedC2spTlogLrStructured form of a c2sp-tlog lr reference.
PreparedC2spTlogEvent
Section titled “PreparedC2spTlogEvent”from dnsid.c2sp_tlog import PreparedC2spTlogEventAn envelope prepared for split signing.
Treated as immutable apart from adding a role signature (via
sign_prepared_event, which returns a new instance). envelope
preserves unknown signed fields; signed_bytes is the canonical JCS of
the envelope with the top-level sigs member removed.
Attributes:
event_id(str): Locally derived logical ID, independent of lifecycle signatures.
missing_signatures
Section titled “missing_signatures”PreparedC2spTlogEvent.missing_signatures() -> list[C2spSignerRole]Roles still absent from the envelope’s sigs object.
SafeC2spResourceFetcher
Section titled “SafeC2spResourceFetcher”from dnsid.c2sp_tlog import SafeC2spResourceFetcherWebPKI fetcher with fixed deadlines, no redirects, and SSRF protection.
SafeC2spResourceFetcher constructor
Section titled “SafeC2spResourceFetcher constructor”SafeC2spResourceFetcher(*, timeout_seconds: float = 10.0, transport_config: TransportConfig | None = None, allow_loopback_host: str | None = None) -> NoneCreate a fetcher with a finite timeout and optional DNS/TLS configuration.
Arguments:
timeout_seconds(float): Finite timeout for each resource request. — default10.0transport_config(TransportConfig | None): Optional custom DNS server, additional CA bundle, andprivate_address_hostsallowlist, applied exactly as the core HTTPS fetcher does. — defaultNoneallow_loopback_host(str | None): Exact hostname allowed to resolve to loopback for an explicitly configured local testnet. — defaultNone
fetch_bounded
Section titled “fetch_bounded”SafeC2spResourceFetcher.fetch_bounded(url: str, max_bytes: int) -> bytesFetch one HTTPS resource, requiring HTTP 200 and an exact byte bound.
async_fetch_bounded
Section titled “async_fetch_bounded”SafeC2spResourceFetcher.async async_fetch_bounded(url: str, max_bytes: int) -> bytesRead natively with the sync guarantees and one pool per event loop.
Responses close after each read, including on cancellation. Finish all
reads before aclose(); keep owning loops running until it completes.
Injected fetchers remain caller-owned.
security_guarantees
Section titled “security_guarantees”SafeC2spResourceFetcher.security_guarantees() -> C2spResourceFetchGuaranteesReturn the capabilities enforced by this implementation.
SafeC2spResourceFetcher.close() -> NoneClose synchronous connections; use aclose after async reads.
aclose
Section titled “aclose”SafeC2spResourceFetcher.async aclose() -> NoneClose all owned pools after reads finish, with owning loops running.
ScanStreamSource
Section titled “ScanStreamSource”from dnsid.c2sp_tlog import ScanStreamSourceFetches the checkpoint and scans every entry bundle beneath it.
authenticate_checkpoint runs against the parsed checkpoint before any entries are fetched (policy enforcement lives there).
ScanStreamSource constructor
Section titled “ScanStreamSource constructor”ScanStreamSource(transport: C2spTlogTransport, authenticate_checkpoint: Callable[[Checkpoint], None], *, max_tree_size: int = _DEFAULT_MAX_TREE_SIZE, max_checkpoint_bytes: int = _DEFAULT_MAX_CHECKPOINT_BYTES, max_entry_bundle_bytes: int = _DEFAULT_MAX_ENTRY_BUNDLE_BYTES, max_total_entry_bytes: int = _DEFAULT_MAX_TOTAL_ENTRY_BYTES) -> NoneBind the source to transport and validate its resource limits.
Raises:
C2spTlogVerificationError: If any limit is not a positive integer.
ScanStreamSource.load(prefix: str) -> StreamEvidenceFetch the checkpoint under prefix and scan every entry beneath it.
Returns:
StreamEvidence— Complete evidence: the authenticated checkpoint plus all entries.
Raises:
C2spTlogParseError: If the checkpoint or an entry bundle is malformed.C2spTlogVerificationError: If checkpoint authentication fails, a configured size limit is exceeded, or a bundle width is wrong.
async_load
Section titled “async_load”ScanStreamSource.async async_load(prefix: str) -> StreamEvidenceScan standard resources asynchronously, authenticating before tile reads.
verify_checkpoint_consistency
Section titled “verify_checkpoint_consistency”ScanStreamSource.verify_checkpoint_consistency(reference: ParsedC2spTlogLr, trusted: TrustedCheckpoint, candidate: TrustedCheckpoint) -> NoneAuthenticate continuity from bounded hash tiles, without scanning entries.
async_verify_checkpoint_consistency
Section titled “async_verify_checkpoint_consistency”ScanStreamSource.async async_verify_checkpoint_consistency(reference: ParsedC2spTlogLr, trusted: TrustedCheckpoint, candidate: TrustedCheckpoint) -> NoneAuthenticate continuity with native async tile reads when available.
security_guarantees
Section titled “security_guarantees”ScanStreamSource.security_guarantees() -> C2spResourceFetchGuarantees | NoneReturn the injected fetcher’s public-read capabilities, if declared.
fetch_checkpoint
Section titled “fetch_checkpoint”ScanStreamSource.fetch_checkpoint(reference: ParsedC2spTlogLr) -> bytesFetch bounded raw checkpoint bytes for reference.
load_stream
Section titled “load_stream”ScanStreamSource.load_stream(reference: ParsedC2spTlogLr, fqdn: str) -> C2spStreamEvidenceLoad a full scan; the reader verifies fqdn and all evidence.
read_entry
Section titled “read_entry”ScanStreamSource.read_entry(reference: ParsedC2spTlogLr, index: int) -> C2spProvenEntryReturn one entry plus a proof derived from a complete scan.
async_fetch_checkpoint
Section titled “async_fetch_checkpoint”ScanStreamSource.async async_fetch_checkpoint(reference: ParsedC2spTlogLr) -> bytesFetch one bounded checkpoint using the native capability if present.
async_load_stream
Section titled “async_load_stream”ScanStreamSource.async async_load_stream(reference: ParsedC2spTlogLr, fqdn: str) -> C2spStreamEvidenceLoad complete raw evidence through native async resource reads.
async_read_entry
Section titled “async_read_entry”ScanStreamSource.async async_read_entry(reference: ParsedC2spTlogLr, index: int) -> C2spProvenEntryBuild an inclusion proof from an asynchronously fetched full scan.
SignedNoteKey
Section titled “SignedNoteKey”from dnsid.c2sp_tlog import SignedNoteKeyA signed-note verifier key (name + Ed25519 public key bytes).
StreamEvidence
Section titled “StreamEvidence”from dnsid.c2sp_tlog import StreamEvidenceA checkpoint and the entries fetched under it.
StreamVerifierOptions
Section titled “StreamVerifierOptions”from dnsid.c2sp_tlog import StreamVerifierOptionsOptions for advanced lifecycle selection over already proven entries.
TlogProofV1
Section titled “TlogProofV1”from dnsid.c2sp_tlog import TlogProofV1A parsed c2sp.org/tlog-proof@v1 document.
TrustedCheckpoint
Section titled “TrustedCheckpoint”from dnsid.c2sp_tlog import TrustedCheckpointThe highest checkpoint accepted for one log origin.
VerifiedC2spStreamBundle
Section titled “VerifiedC2spStreamBundle”from dnsid.c2sp_tlog import VerifiedC2spStreamBundleA fully verified portable bundle of logged lifecycle state.
VerifiedLifecycleEvent
Section titled “VerifiedLifecycleEvent”from dnsid.c2sp_tlog import VerifiedLifecycleEventOne accepted lifecycle entry with its log position and hashes.
Attributes:
event_id(str): Signature-independent identity of this applied payload.
assert_canonical_json_bytes
Section titled “assert_canonical_json_bytes”from dnsid.c2sp_tlog import assert_canonical_json_bytesassert_canonical_json_bytes(data: bytes, value: object | None = None) -> NoneRaise unless data is exactly the canonical serialization of its content.
begin_managed_issuance
Section titled “begin_managed_issuance”from dnsid.c2sp_tlog import begin_managed_issuancebegin_managed_issuance(*, domain: str, governance_id: str, log_reference: str, entity_public_key: JWK, key_provider: KeyProvider, registry_client: ManagedIssuanceRegistry, idempotency_key: str, store: ManagedIssuanceStore, set_activation_blocked: Callable[[bool], None]) -> ManagedIssuanceStatePersist intent, validate preparation, countersign, persist, and submit.
The caller holds exclusive storage ownership across the entire invocation. An existing operation must be resumed, never prepared under a new key.
c2sp_envelope_to_event
Section titled “c2sp_envelope_to_event”from dnsid.c2sp_tlog import c2sp_envelope_to_eventc2sp_envelope_to_event(obj: object) -> AnyLogEventParse a C2SP JSON envelope into the corresponding DNSid event.
c2sp_event_id
Section titled “c2sp_event_id”from dnsid.c2sp_tlog import c2sp_event_idc2sp_event_id(data: bytes) -> strDerive logical identity without altering exact-entry inclusion evidence.
canonical_bytes
Section titled “canonical_bytes”from dnsid.c2sp_tlog import canonical_bytescanonical_bytes(value: object) -> bytesSerialize value to canonical JSON as UTF-8 bytes.
Raises:
C2spTlogParseError: If value cannot be canonically serialized (seecanonical_json).
canonical_json
Section titled “canonical_json”from dnsid.c2sp_tlog import canonical_jsoncanonical_json(value: object) -> strSerialize value to canonical JSON text, enforcing the nesting limit.
canonical_log_prefix
Section titled “canonical_log_prefix”from dnsid.c2sp_tlog import canonical_log_prefixcanonical_log_prefix(raw: str) -> strValidate and canonicalize a log-prefix URL.
Canonical form has a lowercase scheme and host, no default port, normalized percent-encoding, and no trailing slash.
Raises:
C2spTlogParseError: If raw is not a valid http(s) URL or contains userinfo, a query, a fragment, dot segments, encoded slashes, or characters that must be percent-encoded.
canonicalize_c2sp_event
Section titled “canonicalize_c2sp_event”from dnsid.c2sp_tlog import canonicalize_c2sp_eventcanonicalize_c2sp_event(event: AnyLogEvent, context: C2spEventContext | None = None) -> bytesCanonical stored form of event including signatures.
checkpoint_origin
Section titled “checkpoint_origin”from dnsid.c2sp_tlog import checkpoint_origincheckpoint_origin(log_prefix: str) -> strDerive the signed-note origin (host + path) from a canonical log prefix.
checkpoint_path
Section titled “checkpoint_path”from dnsid.c2sp_tlog import checkpoint_pathcheckpoint_path(prefix: str) -> strReturn the fetch path of the log’s checkpoint under prefix.
complete_managed_issuance
Section titled “complete_managed_issuance”from dnsid.c2sp_tlog import complete_managed_issuancecomplete_managed_issuance(domain: str, store: ManagedIssuanceStore, set_activation_blocked: Callable[[bool], None]) -> ManagedIssuanceStateRelease activation only after the caller verifies public convergence.
create_c2sp_tlog_verification_registry
Section titled “create_c2sp_tlog_verification_registry”from dnsid.c2sp_tlog import create_c2sp_tlog_verification_registrycreate_c2sp_tlog_verification_registry(options: C2spTlogVerificationOptions) -> LogRegistryCreate a ready-to-inject registry for standard c2sp-tlog verification.
create_dnsid_managed_verification_registry
Section titled “create_dnsid_managed_verification_registry”from dnsid.c2sp_tlog import create_dnsid_managed_verification_registrycreate_dnsid_managed_verification_registry(options: DnsidManagedVerificationOptions | None = None) -> LogRegistryCreate a registry for reviewed DNSid-managed trust roots.
Calling this separately named factory is an explicit application trust
decision; the generic factory never selects these roots implicitly. Trust
snapshots are bundled with the SDK and selected only for an exact canonical
(scope, log_prefix) pair. The catalog covers the development,
production, partner (https://log.partners.dnsid.ai), and staging
(https://log.stg.dnsid.ai) logs, and the Known development
(https://log.dev.knownsystems.ai), staging
(https://log.stg.knownsystems.ai), and production
(https://log.knownsystems.ai) logs, each preferring signed stream
bundles with safe raw-scan fallback.
encode_entry_bundle
Section titled “encode_entry_bundle”from dnsid.c2sp_tlog import encode_entry_bundleencode_entry_bundle(entries: list[bytes]) -> bytesEncode entries into the big-endian uint16-length-prefixed bundle form.
Raises:
C2spTlogParseError: If any entry exceeds 65535 bytes.
enforce_checkpoint_policy
Section titled “enforce_checkpoint_policy”from dnsid.c2sp_tlog import enforce_checkpoint_policyenforce_checkpoint_policy(checkpoint: Checkpoint, origin: str, policy: C2spTlogPolicy, scope: str, now_ms: float, max_clock_skew_ms: int = 0) -> CheckpointPolicyResultVerify the checkpoint against the local trust policy for origin.
Checks the log signature and evaluates the witness quorum; returns the accepted witness timestamps and the earliest one as the checkpoint’s integration time.
entry_bundle_path
Section titled “entry_bundle_path”from dnsid.c2sp_tlog import entry_bundle_pathentry_bundle_path(prefix: str, n: int, width: int | None = None) -> strReturn the C2SP tlog-tiles fetch path for entry bundle n.
A partial bundle is addressed by passing its width, which appends the
.p/<width> suffix defined by the tlog-tiles spec.
entry_bytes
Section titled “entry_bytes”from dnsid.c2sp_tlog import entry_bytesentry_bytes(prepared: PreparedC2spTlogEvent, context: C2spVerificationContext | None = None) -> bytesReturn the complete canonical entry bytes.
Requires every role in required_signatures to be present, verifies
all of them cryptographically, and re-validates the complete entry.
Does not append.
event_to_c2sp_envelope
Section titled “event_to_c2sp_envelope”from dnsid.c2sp_tlog import event_to_c2sp_envelopeevent_to_c2sp_envelope(event: AnyLogEvent, context: C2spEventContext | None = None, include_sigs: bool = True) -> dict[str, Any]Build the C2SP JSON envelope for event.
generate_c2sp_tlog_stream_id
Section titled “generate_c2sp_tlog_stream_id”from dnsid.c2sp_tlog import generate_c2sp_tlog_stream_idgenerate_c2sp_tlog_stream_id() -> strGenerate a fresh version-1 identity-instance stream ID.
Returns:
str— The unpadded base64url encoding of 128 cryptographically random bits.
inclusion_root
Section titled “inclusion_root”from dnsid.c2sp_tlog import inclusion_rootinclusion_root(leaf: bytes, index: int, tree_size: int, proof: list[bytes]) -> bytesRecompute the tree root from a leaf hash and its inclusion proof.
leaf_hash
Section titled “leaf_hash”from dnsid.c2sp_tlog import leaf_hashleaf_hash(entry_bytes: bytes) -> bytesRFC 6962 leaf hash: SHA-256(0x00 || entry).
merkle_root_from_entries
Section titled “merkle_root_from_entries”from dnsid.c2sp_tlog import merkle_root_from_entriesmerkle_root_from_entries(entries: list[bytes]) -> bytesCompute the RFC 6962 root over a complete, ordered entry list.
node_hash
Section titled “node_hash”from dnsid.c2sp_tlog import node_hashnode_hash(left: bytes, right: bytes) -> bytesRFC 6962 interior node hash: SHA-256(0x01 || left || right).
normalized_origin_policy
Section titled “normalized_origin_policy”from dnsid.c2sp_tlog import normalized_origin_policynormalized_origin_policy(policy: C2spTlogPolicy, origin: str) -> NormalizedOriginPolicyResolve, validate, and normalize the policy for origin.
parse_c2sp_event_entry
Section titled “parse_c2sp_event_entry”from dnsid.c2sp_tlog import parse_c2sp_event_entryparse_c2sp_event_entry(data: bytes, context: C2spEventContext | None = None, *, candidate: bool = False) -> AnyLogEventParse an entry; scans defer signed chain errors until after authentication.
parse_c2sp_policy_file
Section titled “parse_c2sp_policy_file”from dnsid.c2sp_tlog import parse_c2sp_policy_fileparse_c2sp_policy_file(text: str) -> C2spTlogPolicyParse the C2SP text policy format (log/witness/group/quorum directives).
parse_c2sp_signatures
Section titled “parse_c2sp_signatures”from dnsid.c2sp_tlog import parse_c2sp_signaturesparse_c2sp_signatures(value: object, type_: str, require_complete: bool = True) -> dict[str, C2spSignatureValue]Parse an entry’s sigs object into signature values keyed by role.
Partial signature sets are allowed when require_complete is False (prepared events mid-collection).
Raises:
C2spTlogParseError: If type_ is unsupported, the object is missing or malformed, a role is unexpected, or (when require_complete is True) a required signature is absent.
parse_c2sp_tlog_lr
Section titled “parse_c2sp_tlog_lr”from dnsid.c2sp_tlog import parse_c2sp_tlog_lrparse_c2sp_tlog_lr(lr: str) -> ParsedC2spTlogLrParse and validate a full c2sp-tlog lr string.
The reference form is
c2sp-tlog:<scope>:<log-prefix>#<stream-id>[@<entry-index>] where
scope is public, testnet, or private-<label>, and
log-prefix is the log’s canonical HTTPS base URL.
Returns:
ParsedC2spTlogLr— The structured reference, with the log prefix required to already be canonical andlrset to the canonical bound reference (no index).
Raises:
C2spTlogParseError: If any component of lr is missing or invalid.
parse_c2sp_tlog_trust_profile
Section titled “parse_c2sp_tlog_trust_profile”from dnsid.c2sp_tlog import parse_c2sp_tlog_trust_profileparse_c2sp_tlog_trust_profile(data: bytes) -> C2spTlogTrustProfileParse and validate a dnsid-c2sp-tlog-trust-profile@v1 document.
parse_checkpoint
Section titled “parse_checkpoint”from dnsid.c2sp_tlog import parse_checkpointparse_checkpoint(text: str) -> CheckpointParse a signed-note checkpoint into its body and signature lines.
parse_entry_bundle
Section titled “parse_entry_bundle”from dnsid.c2sp_tlog import parse_entry_bundleparse_entry_bundle(data: bytes) -> list[bytes]Decode a bundle of big-endian uint16-length-prefixed entries.
Returns:
list[bytes]— The entry byte strings in bundle order.
Raises:
C2spTlogParseError: If a length prefix or entry is truncated.
parse_json_no_duplicate_members
Section titled “parse_json_no_duplicate_members”from dnsid.c2sp_tlog import parse_json_no_duplicate_membersparse_json_no_duplicate_members(data: bytes) -> AnyParse bounded-depth JSON, rejecting duplicate object member names.
parse_note_signature
Section titled “parse_note_signature”from dnsid.c2sp_tlog import parse_note_signatureparse_note_signature(line: str) -> NoteSignatureParse one ”— name base64” signed-note signature line.
parse_prepared_event
Section titled “parse_prepared_event”from dnsid.c2sp_tlog import parse_prepared_eventparse_prepared_event(data: bytes, lr: str, context: C2spVerificationContext | None = None) -> PreparedC2spTlogEventParse prepared bytes received from another process as untrusted input.
Requires canonical JCS with no duplicate members, validates the envelope and its signed context against lr, preserves unknown signed fields, and validates every signature already present before the result may be given another signature. For roles whose key is not embedded in the envelope, the corresponding trusted key must be supplied via context; a signature whose key cannot be resolved fails closed.
parse_prepared_issuance
Section titled “parse_prepared_issuance”from dnsid.c2sp_tlog import parse_prepared_issuanceparse_prepared_issuance(data: bytes, context: C2spVerificationContext) -> PreparedC2spTlogEventParse ISSUANCE bytes against their signed bound reference.
Use only for issuance, where no verified stream reference exists yet.
Later events must use parse_prepared_event with the identity’s
verified reference. Supply the expected identity and keys in context;
operational countersigning requires the complete context.
parse_signed_note_verifier_key
Section titled “parse_signed_note_verifier_key”from dnsid.c2sp_tlog import parse_signed_note_verifier_keyparse_signed_note_verifier_key(text: str) -> SignedNoteKeyParse a signed-note verifier key from its text form.
Accepts the C2SP name+hexid+base64 form as well as the name base64
and name ed25519 base64 forms. The base64 key material is either a
bare 32-byte Ed25519 key or a signature-type byte followed by the key.
Raises:
C2spTlogParseError: If the text matches none of the supported forms, the key ID is not four bytes, or the key material is invalid.
parse_tlog_proof_v1
Section titled “parse_tlog_proof_v1”from dnsid.c2sp_tlog import parse_tlog_proof_v1parse_tlog_proof_v1(text: str) -> TlogProofV1Parse the tlog-proof@v1 text format (header + inclusion hashes + checkpoint).
prepare_event
Section titled “prepare_event”from dnsid.c2sp_tlog import prepare_eventprepare_event(event: AnyLogEvent, lr: str, chain: C2spChain | None = None) -> PreparedC2spTlogEventBuild the unsigned prepared form of event bound to lr.
Any signatures already on event are discarded: they cannot be proven to
cover the resulting envelope. Preparation requires no private key. For
every scope, ISSUANCE (and inbound MIGRATION) genesis derives seq=0
and rejects prior-chain fields; every later event requires chain.
register_c2sp_tlog
Section titled “register_c2sp_tlog”from dnsid.c2sp_tlog import register_c2sp_tlogregister_c2sp_tlog(registry: LogRegistry, options: C2spTlogReaderOptions) -> NoneRegister the c2sp-tlog reader factory on registry.
required_c2sp_signature_names
Section titled “required_c2sp_signature_names”from dnsid.c2sp_tlog import required_c2sp_signature_namesrequired_c2sp_signature_names(type_: str) -> list[str]Return the sigs member names a complete entry of type_ must carry.
required_signer_roles
Section titled “required_signer_roles”from dnsid.c2sp_tlog import required_signer_rolesrequired_signer_roles(event_type: str) -> list[C2spSignerRole]Return the signer roles a complete entry of event_type must carry.
resume_managed_issuance
Section titled “resume_managed_issuance”from dnsid.c2sp_tlog import resume_managed_issuanceresume_managed_issuance(*, domain: str, log_reference: str, entity_public_key: JWK, key_provider: KeyProvider, registry_client: ManagedIssuanceRegistry, store: ManagedIssuanceStore, set_activation_blocked: Callable[[bool], None]) -> ManagedIssuanceStateResume authoritative state, without re-signing fixed bytes.
Completed historical bytes can be recovered without the initial private key. The caller separately validates the current application signing binding.
sign_prepared_event
Section titled “sign_prepared_event”from dnsid.c2sp_tlog import sign_prepared_eventsign_prepared_event(prepared: PreparedC2spTlogEvent, role: C2spSignerRole, key_provider: KeyProvider, context: C2spVerificationContext | None = None, *, replace_existing: bool = False) -> PreparedC2spTlogEventSign prepared for role and return a new prepared event.
The provider’s key for the role’s kid must match the key the envelope (or trusted context) requires for role by kid, alg, and RFC 7638 thumbprint. Only the requested signature is added; an existing signature for the role is never replaced unless replace_existing is set. Entity signers must inspect/approve the entire prepared envelope (including reason, delegatee, scope, expiry and chain fields) before signing: the identity context alone cannot authorize the event’s action.
signed_c2sp_entry_bytes
Section titled “signed_c2sp_entry_bytes”from dnsid.c2sp_tlog import signed_c2sp_entry_bytessigned_c2sp_entry_bytes(data: bytes) -> bytesReturn the signed byte form of a stored entry: the envelope minus sigs.
signed_c2sp_event_bytes
Section titled “signed_c2sp_event_bytes”from dnsid.c2sp_tlog import signed_c2sp_event_bytessigned_c2sp_event_bytes(event: AnyLogEvent, context: C2spEventContext | None = None) -> bytesCanonical byte form of event that signatures cover (no sigs member).
state_hash
Section titled “state_hash”from dnsid.c2sp_tlog import state_hashstate_hash(state: object) -> strHash of the post-event lifecycle state, used by prev_state_hash chaining.
tile_path
Section titled “tile_path”from dnsid.c2sp_tlog import tile_pathtile_path(prefix: str, level: int, n: int, width: int | None = None) -> strReturn the C2SP tlog-tiles fetch path for hash tile n at level.
A partial tile (one not yet full) is addressed by passing its width,
which appends the .p/<width> suffix defined by the tlog-tiles spec.
verified_cosignature_timestamp
Section titled “verified_cosignature_timestamp”from dnsid.c2sp_tlog import verified_cosignature_timestampverified_cosignature_timestamp(checkpoint: Checkpoint, key: SignedNoteKey) -> int | NoneReturn the verified cosignature/v1 timestamp (epoch seconds) under key.
Returns None if key is not a cosignature/v1 key (signature type 0x04) or the checkpoint carries no valid timestamped cosignature from it.
verify_c2sp_stream_bundle
Section titled “verify_c2sp_stream_bundle”from dnsid.c2sp_tlog import verify_c2sp_stream_bundleverify_c2sp_stream_bundle(data: bytes, options: C2spStreamBundleVerifierOptions) -> VerifiedC2spStreamBundleParse and verify one canonical dnsid-c2sp-stream-bundle@v1.
Successful return establishes logged lifecycle state through the accepted checkpoint. It does not establish current protocol status. Migrated bundles require reader-managed recursive predecessor resolution and are rejected by this standalone verifier. Invalid, expired, incomplete, or incorrectly bound evidence fails closed.
verify_c2sp_tlog_proof
Section titled “verify_c2sp_tlog_proof”from dnsid.c2sp_tlog import verify_c2sp_tlog_proofverify_c2sp_tlog_proof(entry_bytes: bytes, proof: TlogProofV1 | str, policy: C2spTlogPolicy, origin: str | None = None, scope: str = 'testnet', now_ms: float = 0, max_clock_skew_ms: int = 0) -> TlogProofV1Verify an inclusion proof against a policy-authenticated checkpoint.
verify_checkpoint_signature
Section titled “verify_checkpoint_signature”from dnsid.c2sp_tlog import verify_checkpoint_signatureverify_checkpoint_signature(checkpoint: Checkpoint, key: SignedNoteKey) -> boolTrue if any of the checkpoint’s signature lines verifies under key.
verify_consistency
Section titled “verify_consistency”from dnsid.c2sp_tlog import verify_consistencyverify_consistency(old_size: int, new_size: int, old_root: bytes, new_root: bytes, proof: list[bytes]) -> boolVerify an RFC 6962 consistency proof between two checkpoints.
verify_inclusion
Section titled “verify_inclusion”from dnsid.c2sp_tlog import verify_inclusionverify_inclusion(entry_bytes: bytes, index: int, tree_size: int, root_hash: bytes, proof: list[bytes]) -> boolTrue if entry_bytes is provably included at index under root_hash.
verify_lifecycle
Section titled “verify_lifecycle”from dnsid.c2sp_tlog import verify_lifecycleverify_lifecycle(events: list[VerifiedLifecycleEvent], options: StreamVerifierOptions | None = None) -> NoneVerify that events forms one valid, fully signed lifecycle.
verify_logged_event_signature
Section titled “verify_logged_event_signature”from dnsid.c2sp_tlog import verify_logged_event_signatureverify_logged_event_signature(item: VerifiedLifecycleEvent, signer_key: JWK) -> NoneVerify one logged event’s primary signature against signer_key.
verify_note_signature
Section titled “verify_note_signature”from dnsid.c2sp_tlog import verify_note_signatureverify_note_signature(message: str, sig: NoteSignature, key: SignedNoteKey) -> boolVerify one signed-note signature line against key.
Type 0x01 is a plain Ed25519 signature over the note body. Type 0x04 is a
cosignature/v1: an 8-byte big-endian timestamp followed by an Ed25519
signature over “cosignature/v1\ntime
verify_stream_lifecycle
Section titled “verify_stream_lifecycle”from dnsid.c2sp_tlog import verify_stream_lifecycleverify_stream_lifecycle(entries: list[IndexedEntry], domain: str, options: StreamVerifierOptions | None = None) -> list[VerifiedLifecycleEvent]Select and verify the lifecycle entries for domain from a full scan.
New payloads require every signer role under their verified predecessor’s historical state. Applied logical IDs deduplicate regardless of signatures or physical position. Authenticated forks or invalid transitions are fatal.
write_prepared_event
Section titled “write_prepared_event”from dnsid.c2sp_tlog import write_prepared_eventwrite_prepared_event(prepared: PreparedC2spTlogEvent, *, submit: Callable[[bytes, str], int], idempotency_key: str, validate_chain: Callable[[PreparedC2spTlogEvent], None] | None = None, context: C2spVerificationContext | None = None) -> LogRefValidate the complete entry and append it via submit.
submit(entry_bytes, idempotency_key) appends the exact bytes and
returns the assigned entry index. Non-genesis events in every scope require a
validate_chain(prepared) callback that checks the chain fields against
authoritative prior stream state. Returns the final event reference
{lr}@{index}.