Skip to content

Expose the deployed product dotNS identifier to products #112

Closed

Description

@replghost

Products currently need to know their own DotNsIdentifier to call APIs such as host_account_get, where ProductAccountId = (DotNsIdentifier, DerivationIndex). The host already knows the calling product's identity for scoping permissions, entropy, storage, and allowances, but there does not appear to be a product-facing way for the sandbox to learn the dotNS name it was actually deployed under.

This creates a mismatch: a product bundle may be deployed under different dotNS names, but account derivation and product-scoped APIs depend on the canonical deployed name, not a hardcoded value inside the product.

Relevant references:

  • docs/design/host-api-protocol.md defines host_handshake as only returning Result<(), HandshakeErr>.
  • src/data/v02/types.ts documents host_account_get as requiring the product to provide ProductAccountId.
  • src/data/v02/types.ts defines DotNsIdentifier.

Proposal:

Add a product-facing way to get the runtime product identity, for example:

type ProductIdentity = Struct({
  dotNsId: DotNsIdentifier,
});

fn host_product_identity_get() -> Result<ProductIdentity, GenericErr>;

Alternatively, include this in the successful handshake response.

Expected behavior:

  • The value is supplied by the host from the deployed/resolved product identity.
  • It matches the identity used by the host for product-scoped permissions, entropy derivation, local storage namespacing, product accounts, and allowance scoping.
  • It is available after handshake and does not require user authentication, since it reveals the product's own identity rather than user data.
  • Product SDKs expose a simple helper, e.g. truApi.getProductIdentity() or truApi.getProductDotNsId().

Acceptance criteria:

  • Spec types and docs define how a product obtains its deployed dotNS identifier.
  • SDK exposes the value to products.
  • Host implementations return the deployed dotNS name used for scoping.
  • Product account examples no longer require hardcoding "my-product.dot" when the product wants its own account.

Activity

  1. self-assigned this
    on Sep 11, 2026
  2. filvecchiato commented on Sep 17, 2026

    @filvecchiato
    Collaborator

    @replghost this could achieved by system.getProductContext(). Is this enough or more detail is needed?

    If something different is needed, feel free to open a new issue

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

Metadata

Metadata

Assignees

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