calculateFideId

Core primitive: calculate a Fide ID from type codes and reference identifier. Deterministic SHA-256 hash of the reference identifier (UTF-8), then constructs `did:fide:0x` + 2 hex (entity type) + 2 hex (reference type) + first 36 hex of hash = 40 hex total.

Node Runtime Required

This function requires a Node.js runtime and is disabled in the browser docs preview.
calculateFideId(entityType, referenceType, referenceIdentifier, options)

Parameters

entityTypeFideEntityType*
The entity type.
referenceTypeFideEntityType*
The reference type.
referenceIdentifierstring*
The reference identifier string to hash (UTF-8 encoded).
optionsFideIdCalculationOptions
Invalid structured input. Switch to JSON mode to fix parse errors.

Returns

Prop

Type

import { calculateFideId } from '@fide-work/id';

const result = await calculateFideId(
  'Person',
  'NetworkResource',
  'https://x.com/alice',
  
);

Type Definitions

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 FideIdCalculationOptions

Options for Fide ID calculation helpers. Reserved for forward-compatible toggles without changing function signatures.

FideIdCalculationOptions

Properties

Prop

Type