Fide logoFIDE

buildStatement

Build a statement object with all required fields. Always computes Fide IDs from referenceIdentifier + entityType + referenceType. Properties must be canonical full URLs.

Policies Enforced

  • Statement Input Policy
    Validates the subject, property, and object input shape before any Fide IDs are calculated.
  • Statement Property Policy
    Validates property-specific input rules before any Fide IDs are calculated.
  • Statement Fide IDs Policy
    Validates the calculated subject, property, and object Fide IDs before building the final statement.
  • Nested Fide ID Policies
    Calls calculateFideId for each statement part, so reference type and reference identifier policies are also enforced.

Node Runtime Required

This function requires a Node.js runtime and is disabled in the browser docs preview.
buildStatement(input, options)

Parameters

inputStatementInput*
Statement input with subject, property, and object
subject *
Subject - reference identifier with entity type and reference type
referenceIdentifier *
entityType *
referenceType *
property *
Property - explicit reference identifier with entity type and reference type. `referenceIdentifier` must be a canonical full URL (https://...). Entity type must be DirectionalProperty or SymmetricProperty.
referenceIdentifier *
entityType *
referenceType *
object *
Object - reference identifier with entity type and reference type
referenceIdentifier *
entityType *
referenceType *
optionsStatementBuildOptions
normalizeReferenceIdentifier

Returns

Prop

Type

import { buildStatement } from '@fide-work/context-protocol';

const result = await buildStatement(
  {"subject":{"referenceIdentifier":"https://x.com/alice","entityType":"Person","referenceType":"NetworkResource"},"property":{"referenceIdentifier":"https://schema.org/knows","entityType":"DirectionalProperty","referenceType":"NetworkResource"},"object":{"referenceIdentifier":"https://x.com/bob","entityType":"Person","referenceType":"NetworkResource"}},
  {"normalizeReferenceIdentifier":true}
);

Related Constants

Statement

Complete statement object with all required fields **Important**: Both Fide IDs and reference identifiers are required because: - Fide IDs are one-way hashes - cannot be reversed to get reference identifiers - Protocol specification requires both fields - Indexers need reference identifiers for lookup tables and human-readable display - Enables mapping back to human-readable identifiers for debugging and display

export const Statement: any

Type Definitions

type StatementInput

Input for creating a statement. All triples require referenceIdentifier + entityType + referenceType. The SDK always computes Fide IDs internally to avoid trust/validation issues with pre-calculated hashes.

StatementInput

Properties

Prop

Type

type StatementBuildOptions

Statement build options.

StatementBuildOptions

Properties

Prop

Type

type Statement7 properties

Complete statement object with all required fields **Important**: Both Fide IDs and reference identifiers are required because: - Fide IDs are one-way hashes - cannot be reversed to get reference identifiers - Protocol specification requires both fields - Indexers need reference identifiers for lookup tables and human-readable display - Enables mapping back to human-readable identifiers for debugging and display

Statement

Properties

Prop

Type

type FideEntityTypeRelated docsLarge type

Valid Fide entity type names derived from `FIDE_ENTITY_TYPE_MAP`.

"Statement" | "DirectionalProperty" | "SymmetricProperty" | "Person" | "Organization" | "SoftwareAgent" | "NetworkResource" | "PlatformAccount" | "CryptographicAccount" | "CreativeWork" | "Concept" | "Place" | "Event" | "Action" | "PhysicalObject" | "TextLiteral" | "IntegerLiteral" | "DecimalLiteral" | "BoolLiteral" | "DateLiteral" | "YearMonthLiteral" | "YearLiteral" | "TimeLiteral" | "DateTimeLiteral" | "DurationLiteral" | "URILiteral" | "JSONLiteral"

type FideStatementPropertyEntityTypeRelated docs

Allowed entity types for statement properties. - `DirectionalProperty`: ordinary directed relationships - `SymmetricProperty`: relationships that canonicalize subject/object order

FideStatementPropertyEntityType

type FideStatementPropertyReferenceType

Allowed reference types for statement properties. - `NetworkResource`: property IRIs are treated as network-resource-sourced vocabulary terms

"NetworkResource"

type FideId

Full Fide ID format (with did:fide:0x prefix). Length: 11 ("did:fide:0x") + 40 hex = 51 chars.

`did:fide:0x${string}`