Forge documentation
Library referenceSwift

ForgeIdentity

Swift ForgeIdentity library product.

Swift ForgeIdentity library product.

Package contract

FieldValue
Languageswift
Source versionSwift package source snapshot
Manifestforge-swift/Package.swift
Source files6
EvidenceSource reference; registry publication and runtime conformance are separate checks

Import boundary

import ForgeIdentity

Use a source checkout or your verified private registry. Manifest coordinates identify the package; they do not establish that a public registry release exists.

Source reference

Download package reference JSON. Each original source file and generated declaration artifact has its own SHA-256 digest. Function bodies and constant values are omitted from downloads. These are source declaration inventories, not compiler-resolved rustdoc, TypeDoc, DocC, or Dokka output. Private modules can contain public declarations that are not reachable through the package boundary; consult the entry point before importing.

AgentIdentity.swift

Read declaration text · 13 declaration entries

public struct ForgeAgentIdentity: Sendable

public let did: AgentDid
/// The agent's public key bytes (Ed25519, 32 bytes).
public let publicKey: [UInt8]
/// The lineage depth (0;

public let publicKey: [UInt8]
/// The lineage depth (0;

public let lineageDepth: UInt32
/// The parent's DID (nil for HMR root).
public let parentDid: AgentDid?
/// The agent's name.
public let name: String
/// The agent's namespace.
public let namespace: String
/// Creation timestamp.
public let createdAt: Timestamp

// Private key stored separately, never exposed in debug output.
private let privateKeyBytes: [UInt8]
private let document: OasDocument?

init(
did: AgentDid,
publicKey: [UInt8],
privateKeyBytes: [UInt8],
lineageDepth: UInt32,
parentDid: AgentDid?,
name: String,
namespace: String,
createdAt: Timestamp;

public let parentDid: AgentDid?
/// The agent's name.
public let name: String
/// The agent's namespace.
public let namespace: String
/// Creation timestamp.
public let createdAt: Timestamp

// Private key stored separately, never exposed in debug output.
private let privateKeyBytes: [UInt8]
private let document: OasDocument?

init(
did: AgentDid,
publicKey: [UInt8],
privateKeyBytes: [UInt8],
lineageDepth: UInt32,
parentDid: AgentDid?,
name: String,
namespace: String,
createdAt: Timestamp;

public let name: String
/// The agent's namespace.
public let namespace: String
/// Creation timestamp.
public let createdAt: Timestamp

// Private key stored separately, never exposed in debug output.
private let privateKeyBytes: [UInt8]
private let document: OasDocument?

init(
did: AgentDid,
publicKey: [UInt8],
privateKeyBytes: [UInt8],
lineageDepth: UInt32,
parentDid: AgentDid?,
name: String,
namespace: String,
createdAt: Timestamp;

public let namespace: String
/// Creation timestamp.
public let createdAt: Timestamp

// Private key stored separately, never exposed in debug output.
private let privateKeyBytes: [UInt8]
private let document: OasDocument?

init(
did: AgentDid,
publicKey: [UInt8],
privateKeyBytes: [UInt8],
lineageDepth: UInt32,
parentDid: AgentDid?,
name: String,
namespace: String,
createdAt: Timestamp;

public let createdAt: Timestamp

// Private key stored separately, never exposed in debug output.
private let privateKeyBytes: [UInt8]
private let document: OasDocument?

init(
did: AgentDid,
publicKey: [UInt8],
privateKeyBytes: [UInt8],
lineageDepth: UInt32,
parentDid: AgentDid?,
name: String,
namespace: String,
createdAt: Timestamp;

public func sign(_ data: [UInt8]) throws -> [UInt8]

public func verify(signature: [UInt8], data: [UInt8]) throws -> Bool

public var debugDescription: String

public func createHMRIdentity(namespace: String, name: String) throws -> ForgeAgentIdentity

public func deriveAgentIdentity(
parent: ForgeAgentIdentity,
name: String,
namespace: String?;

Glyph.swift

Read declaration text · 24 declaration entries

public enum GlyphEntityKind: String, Codable, Sendable, Hashable, CaseIterable

public static func parseKind(_ string: String) -> GlyphEntityKind?

public var asStr: String

public var asU8: UInt8

public static func fromU8(_ value: UInt8) -> GlyphEntityKind?

public struct GlyphColor: Codable, Sendable, Hashable

public let r: UInt8
/// Green channel (0-255).
public let g: UInt8
/// Blue channel (0-255).
public let b: UInt8

/// Create a color from RGB components.
public static func rgb(_ r: UInt8, _ g: UInt8, _ b: UInt8) -> GlyphColor

public let g: UInt8
/// Blue channel (0-255).
public let b: UInt8

/// Create a color from RGB components.
public static func rgb(_ r: UInt8, _ g: UInt8, _ b: UInt8) -> GlyphColor

public let b: UInt8

/// Create a color from RGB components.
public static func rgb(_ r: UInt8, _ g: UInt8, _ b: UInt8) -> GlyphColor

public static func rgb(_ r: UInt8, _ g: UInt8, _ b: UInt8) -> GlyphColor

public func toHex() -> String

public static func lerp(_ a: GlyphColor, _ b: GlyphColor, t: Double) -> GlyphColor

public struct GlyphPalette: Codable, Sendable

public let primary: GlyphColor
/// Secondary identity color (hue-offset from primary).
public let secondary: GlyphColor
/// Accent color for kind region and highlights.
public let accent: GlyphColor
/// Background color (dark, desaturated primary).
public let background: GlyphColor
}

// MARK: - GlyphDescriptor

/// The glyph input contract: describes what to render.
public struct GlyphDescriptor: Codable, Sendable

public let secondary: GlyphColor
/// Accent color for kind region and highlights.
public let accent: GlyphColor
/// Background color (dark, desaturated primary).
public let background: GlyphColor
}

// MARK: - GlyphDescriptor

/// The glyph input contract: describes what to render.
public struct GlyphDescriptor: Codable, Sendable

public let accent: GlyphColor
/// Background color (dark, desaturated primary).
public let background: GlyphColor
}

// MARK: - GlyphDescriptor

/// The glyph input contract: describes what to render.
public struct GlyphDescriptor: Codable, Sendable

public let background: GlyphColor
}

// MARK: - GlyphDescriptor

/// The glyph input contract: describes what to render.
public struct GlyphDescriptor: Codable, Sendable

public struct GlyphDescriptor: Codable, Sendable

public let did: String
/// The entity kind that determines the kind-region visual motif.
public let kind: GlyphEntityKind
/// Optional human-readable label rendered below the glyph.
public let label: String?

public init(did: String, kind: GlyphEntityKind, label: String?;

public let kind: GlyphEntityKind
/// Optional human-readable label rendered below the glyph.
public let label: String?

public init(did: String, kind: GlyphEntityKind, label: String?;

public let label: String?

public init(did: String, kind: GlyphEntityKind, label: String?;

public init(did: String, kind: GlyphEntityKind, label: String?;

public func derivePalette(did: String, kind: GlyphEntityKind) -> GlyphPalette

public func renderGlyph(_ descriptor: GlyphDescriptor, width: UInt32;

IdentityError.swift

Read declaration text · 2 declaration entries

public enum IdentityError: Error, Sendable, Equatable

public var errorDescription: String?

Lineage.swift

Read declaration text · 17 declaration entries

public struct LineageProof: Codable, Sendable

public let childDid: String
/// The parent's DID.
public let parentDid: String
/// The child's public key (hex-encoded).
public let childPublicKey: String
/// The parent's public key (hex-encoded).
public let parentPublicKey: String
/// The derivation path used.
public let derivationPath: String
/// The lineage depth of the child.
public let depth: UInt32
/// The parent's signature over the proof payload (hex-encoded).
public let parentSignature: String?
/// When the proof was created.
public let timestamp: Timestamp

public init(
childDid: String,
parentDid: String,
childPublicKey: String,
parentPublicKey: String,
derivationPath: String,
depth: UInt32,
parentSignature: String?;

public let parentDid: String
/// The child's public key (hex-encoded).
public let childPublicKey: String
/// The parent's public key (hex-encoded).
public let parentPublicKey: String
/// The derivation path used.
public let derivationPath: String
/// The lineage depth of the child.
public let depth: UInt32
/// The parent's signature over the proof payload (hex-encoded).
public let parentSignature: String?
/// When the proof was created.
public let timestamp: Timestamp

public init(
childDid: String,
parentDid: String,
childPublicKey: String,
parentPublicKey: String,
derivationPath: String,
depth: UInt32,
parentSignature: String?;

public let childPublicKey: String
/// The parent's public key (hex-encoded).
public let parentPublicKey: String
/// The derivation path used.
public let derivationPath: String
/// The lineage depth of the child.
public let depth: UInt32
/// The parent's signature over the proof payload (hex-encoded).
public let parentSignature: String?
/// When the proof was created.
public let timestamp: Timestamp

public init(
childDid: String,
parentDid: String,
childPublicKey: String,
parentPublicKey: String,
derivationPath: String,
depth: UInt32,
parentSignature: String?;

public let parentPublicKey: String
/// The derivation path used.
public let derivationPath: String
/// The lineage depth of the child.
public let depth: UInt32
/// The parent's signature over the proof payload (hex-encoded).
public let parentSignature: String?
/// When the proof was created.
public let timestamp: Timestamp

public init(
childDid: String,
parentDid: String,
childPublicKey: String,
parentPublicKey: String,
derivationPath: String,
depth: UInt32,
parentSignature: String?;

public let derivationPath: String
/// The lineage depth of the child.
public let depth: UInt32
/// The parent's signature over the proof payload (hex-encoded).
public let parentSignature: String?
/// When the proof was created.
public let timestamp: Timestamp

public init(
childDid: String,
parentDid: String,
childPublicKey: String,
parentPublicKey: String,
derivationPath: String,
depth: UInt32,
parentSignature: String?;

public let depth: UInt32
/// The parent's signature over the proof payload (hex-encoded).
public let parentSignature: String?
/// When the proof was created.
public let timestamp: Timestamp

public init(
childDid: String,
parentDid: String,
childPublicKey: String,
parentPublicKey: String,
derivationPath: String,
depth: UInt32,
parentSignature: String?;

public let parentSignature: String?
/// When the proof was created.
public let timestamp: Timestamp

public init(
childDid: String,
parentDid: String,
childPublicKey: String,
parentPublicKey: String,
derivationPath: String,
depth: UInt32,
parentSignature: String?;

public let timestamp: Timestamp

public init(
childDid: String,
parentDid: String,
childPublicKey: String,
parentPublicKey: String,
derivationPath: String,
depth: UInt32,
parentSignature: String?;

public init(
childDid: String,
parentDid: String,
childPublicKey: String,
parentPublicKey: String,
derivationPath: String,
depth: UInt32,
parentSignature: String?;

public struct LineageChain: Sendable

public let proofs: [LineageProof]

/// The depth of the chain (number of derivation steps).
public var depth: Int

public var depth: Int

public var isEmpty: Bool

public init(proofs: [LineageProof])

public func verifyLineageChain(_ chain: LineageChain) throws -> Bool

public func buildLineageProof(
parent: ForgeAgentIdentity,
child: ForgeAgentIdentity
) -> LineageProof

LocalDev.swift

Read declaration text · 14 declaration entries

public let forgeDevMethod: String;

public func forgeDevDid(machineId: String, kind: String, identifier: String) -> String

public func deriveMachineIdFromParts(hostname: String, username: String, profileName: String) -> String

public func deriveMachineId(profileName: String) -> String

public struct LocalDevProfile: Codable, Sendable, Hashable

public let machineId: String
/// The profile name.
public let profileName: String

/// Creates a `LocalDevProfile` from explicit parts.
///
/// - Parameters:
///   - hostname: The machine hostname.
///   - username: The OS username.
///   - profileName: The profile name.
public init(hostname: String, username: String, profileName: String)

public let profileName: String

/// Creates a `LocalDevProfile` from explicit parts.
///
/// - Parameters:
///   - hostname: The machine hostname.
///   - username: The OS username.
///   - profileName: The profile name.
public init(hostname: String, username: String, profileName: String)

public init(hostname: String, username: String, profileName: String)

public init(profileName: String;

public func agentDid(_ name: String) -> String

public func mhrDid(_ name: String) -> String

public func hmrDid(_ name: String) -> String

public func orgDid(_ name: String) -> String

public func validateForgeDevDid(_ did: String) throws

Persistence.swift

Read declaration text · 11 declaration entries

public struct PersistedIdentityMetadata: Codable, Sendable

public let did: String
/// The agent's public key (hex-encoded).
public let publicKey: String
/// The lineage depth.
public let lineageDepth: UInt32
/// The parent's DID.
public let parentDid: String?
/// The agent name.
public let name: String
/// The agent namespace.
public let namespace: String
/// When the identity was created.
public let createdAt: Timestamp
}

/// Exports identity metadata (without private key) for persistence.
///
/// - Parameter identity: The identity to export.
/// - Returns: The metadata for serialization.
public func exportIdentityMetadata(_ identity: ForgeAgentIdentity) -> PersistedIdentityMetadata

public let publicKey: String
/// The lineage depth.
public let lineageDepth: UInt32
/// The parent's DID.
public let parentDid: String?
/// The agent name.
public let name: String
/// The agent namespace.
public let namespace: String
/// When the identity was created.
public let createdAt: Timestamp
}

/// Exports identity metadata (without private key) for persistence.
///
/// - Parameter identity: The identity to export.
/// - Returns: The metadata for serialization.
public func exportIdentityMetadata(_ identity: ForgeAgentIdentity) -> PersistedIdentityMetadata

public let lineageDepth: UInt32
/// The parent's DID.
public let parentDid: String?
/// The agent name.
public let name: String
/// The agent namespace.
public let namespace: String
/// When the identity was created.
public let createdAt: Timestamp
}

/// Exports identity metadata (without private key) for persistence.
///
/// - Parameter identity: The identity to export.
/// - Returns: The metadata for serialization.
public func exportIdentityMetadata(_ identity: ForgeAgentIdentity) -> PersistedIdentityMetadata

public let parentDid: String?
/// The agent name.
public let name: String
/// The agent namespace.
public let namespace: String
/// When the identity was created.
public let createdAt: Timestamp
}

/// Exports identity metadata (without private key) for persistence.
///
/// - Parameter identity: The identity to export.
/// - Returns: The metadata for serialization.
public func exportIdentityMetadata(_ identity: ForgeAgentIdentity) -> PersistedIdentityMetadata

public let name: String
/// The agent namespace.
public let namespace: String
/// When the identity was created.
public let createdAt: Timestamp
}

/// Exports identity metadata (without private key) for persistence.
///
/// - Parameter identity: The identity to export.
/// - Returns: The metadata for serialization.
public func exportIdentityMetadata(_ identity: ForgeAgentIdentity) -> PersistedIdentityMetadata

public let namespace: String
/// When the identity was created.
public let createdAt: Timestamp
}

/// Exports identity metadata (without private key) for persistence.
///
/// - Parameter identity: The identity to export.
/// - Returns: The metadata for serialization.
public func exportIdentityMetadata(_ identity: ForgeAgentIdentity) -> PersistedIdentityMetadata

public let createdAt: Timestamp
}

/// Exports identity metadata (without private key) for persistence.
///
/// - Parameter identity: The identity to export.
/// - Returns: The metadata for serialization.
public func exportIdentityMetadata(_ identity: ForgeAgentIdentity) -> PersistedIdentityMetadata

public func exportIdentityMetadata(_ identity: ForgeAgentIdentity) -> PersistedIdentityMetadata

public func saveIdentityMetadata(_ metadata: PersistedIdentityMetadata, to url: URL) throws

public func loadIdentityMetadata(from url: URL) throws -> PersistedIdentityMetadata

Continue

On this page