Skip to content

Owner KAS: KAS-side standard-TDF EC rewrap, and Rewrap client support for a KAS that answers later (202 polling, request-token lifetime, path-aware KAO matching, extension, metadata) #66

Closed

Description

@arkavo-com

Name (2026-11-08): renamed from "local KAS" to owner KAS before anything shipped (arkavo-ios ADR-0070). Routes, audience, content type and the vault's HKDF info all use owner-kas.

Revised (2026-11-08): the owner decided that "OpenTDFKit can hit either KAS (platform KAS or owner KAS)". The owner KAS now answers OpenTDF's standard Rewrap at its own KAS URL, so the asks below replace the earlier "exposed non-HTTP unwrap".

Why

arkavo-ios is adding an owner KAS on iPhone (arkavo-ios ADR-0070, ADR-0072, ADR-0073, Proposed). The owner's phone holds an EC P-256 KAS key and decides each release. An iPhone can't be reached directly, so its KAS URL is an address on platform.arkavo.net, https://platform.arkavo.net/owner-kas/v1/routes/<route_id>, where a relay queues requests until the phone answers. A receiver calls that URL with KASRewrapClient, exactly as it calls the platform KAS. The difference is that an owner can take up to 15 minutes to approve.

Today OpenTDFKit has KAS-side rewrap (KASService.rewrapKeyInternal) only for NanoTDF v12. Its client expects a 200 within 30 s, signs the request token with a fixed 60 s exp, and matches KAOs by scheme, host and port only.

Design and contract (§4.4–§4.6): https://github.com/arkavo-org/arkavo-ios/blob/7d11e02/docs/superpowers/specs/2026-11-08-owner-kas-design.md

Ask: KAS side (used on the owner's phone)

  1. Standard-TDF EC rewrap. A public, pure API (no network, no storage). Input: the KAS P-256 private key as a value, an ec-wrapped KAO and its policy, and the request's clientPublicKey. It verifies the policy binding, unwraps the DEK and rewraps it to clientPublicKey. It returns the standard result's kasWrappedKey and sessionPublicKey (ECDH, HKDF-SHA-256 with the go SDK TDF salt, AES-256-GCM).
  2. Parse and verify a received Rewrap. Given the body {"signed_request_token": …} and a P-256 public key, verify the ES256 JWT under that key and return its exp, the decoded requestBody (clientPublicKey, the policy, the KAOs) and any extension member (below).
  3. Build a Rewrap response body, so the phone can return {sessionPublicKey, responses:[{policyId, results:[{keyAccessObjectId, status, kasWrappedKey, error, metadata}]}]} with caller-supplied metadata.

Ask: client side (KASRewrapClient, used by the receiver)

  1. Pending answers. On 202 with Location and Retry-After, poll GET Location with the same bearer, honoring Retry-After, until 200 (the normal Rewrap response), 410 (expired) or a caller-supplied deadline. Return expired distinctly from a denial.
  2. Request-token lifetime. Let the caller set the signed request token's exp. The owner KAS needs it equal to the bearer token's exp, not 60 s.
  3. Path-aware KAO matching. When the configured KAS URL has a path, match a KAO's url on scheme, host, port and path. The platform KAS and owner KASs share platform.arkavo.net.
  4. An extension member in requestBody. Let the caller add one top-level member (arkavo-ios uses "arkavo": {v, attempt_id, nonce, tdf_digest}), covered by the request signature. A KAS that doesn't know it ignores it.
  5. Return what the KAS sent. Alongside the unwrapped key (or share), return each result's metadata, its kasWrappedKey, the sessionPublicKey and the signed request token's digest. The receiver verifies the owner's signed decision in metadata["arkavo.decision"] before it decrypts anything.

Also

  1. Encrypt with an ec-wrapped KAO. Confirm (or add) that the TDF builder can wrap to a caller-supplied P-256 KAS public key with a caller-supplied KAO URL and policy.
  2. A tagged release. arkavo-ios pins exact tags (ADR-0026).

Tests

  • Round trip: build → KAS rewrap → client unwrap gives the same DEK; another client key fails; a tampered policy fails the binding check before any rewrap.
  • A Rewrap whose JWT is signed by another key, or whose body was changed after signing, fails verification.
  • The client polls a 202 → 202 → 200 sequence with Retry-After, stops at its deadline, and reports 410 as expired.
  • With the platform KAS and an owner KAS both on one host, each client selects only its own KAO.

Tracking epic: https://github.com/arkavo-org/arkavo-ios/issues/77

Activity

  1. changed the title [-]KAS-side standard-TDF EC rewrap for an on-device KAS, and an exposed client unwrap[/-] [+]Owner KAS: KAS-side standard-TDF EC rewrap, and Rewrap client support for a KAS that answers later (202 polling, request-token lifetime, path-aware KAO matching, extension, metadata)[/+] on Nov 9, 2026
  2. arkavo-com commented on Nov 9, 2026

    @arkavo-com
    ContributorAuthor

    Done in #68 and released as 5.2.0 (tag 5.2.0 → 3f9f0f3). Items 1–9 are in the PR; item 10 is the tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions