append-upsert

Append a relationship.upsert event to the event feed.

Append a relationship.upsert event to the event feed. This creates or updates a relationship between an issuer and a subject.

Usage

ak append-upsert [FLAGS]

Flags

FlagRequiredDefaultDescription
--events-path <PATH>YesPath to the events.jsonl file.
--issuer <DID>YesIssuer DID (e.g., did:web:example.com).
--event-id <ID>YesUnique event identifier.
--relationship-id <ID>YesStable relationship identifier.
--subject <DID>YesSubject DID.
--relationship-type <TYPE>YesOne of: employee, founder, contractor, advisor, investor, admin_delegate, other.
--roles <ROLES>YesComma-separated list of roles.
--issued-at <TIMESTAMP>YesRFC 3339 UTC timestamp (e.g., 2025-01-15T00:00:00Z).
--valid-from <TIMESTAMP>NoValidity start timestamp (RFC 3339 UTC).
--valid-until <TIMESTAMP>NoValidity end timestamp (RFC 3339 UTC).
--kid <KID>YesKey ID used for signing the event.
--seed-hex <HEX>YesHex seed for the signing key.

Relationship Types

TypeDescription
employeeFull-time or part-time employee.
founderCompany founder.
contractorIndependent contractor or consultant.
advisorAdvisory role.
investorInvestor or board member.
admin_delegateDelegated administrative authority.
otherAny relationship not covered above.

Example

ak append-upsert \
  --events-path ./issuer-root/.well-known/sig/events.jsonl \
  --issuer did:web:example.com \
  --event-id evt-001 \
  --relationship-id rel-alice-eng \
  --subject did:web:alice.example.com \
  --relationship-type employee \
  --roles "engineer,deploy" \
  --issued-at 2025-01-15T00:00:00Z \
  --valid-from 2025-01-15T00:00:00Z \
  --kid orgsign-1 \
  --seed-hex 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f

Output:

Appended relationship.upsert event evt-001 (seq=1)
  Relationship: rel-alice-eng
  Subject:      did:web:alice.example.com
  Type:         employee
  Roles:        engineer, deploy

Notes

  • The --relationship-id is a stable identifier. Issuing another upsert with the same relationship ID updates the existing relationship rather than creating a new one.
  • The --event-id must be unique across the entire feed.
  • Events are appended with an automatically incremented sequence number.
  • The --valid-from and --valid-until flags are optional. When omitted, the relationship has no explicit time bounds beyond the --issued-at timestamp.