identity capa

identity-identifiers

External identifiers for parties (passport, SSN, microchip, tax ID, etc.)

External identifiers for parties (passport, SSN, microchip, tax ID, etc.)

Tieridentity
Roleunclassified (baselined)
Pathcrates/identity/identifiers
Edition2021
Targetsidentity_identifiers, integration_tests
Public items7 across 1 module
Tests28

What it is for

# identity-identifiers

External identifier library crates for attaching IDs to any party.

Core Concepts

Example

use identity_identifiers::{Identifier, IdentifierType, PartyId, PartyType};

// Create a microchip identifier for an animal
let microchip = Identifier::new(
PartyType::Animal,
PartyId::new_v4(),
IdentifierType::Microchip,
"985141404123456",
)
.with_issuer("AVID")
.verified();

// Create a passport for a person
let passport = Identifier::new(
PartyType::Person,
PartyId::new_v4(),
IdentifierType::Passport,
"AB1234567",
)
.with_issuer("US Department of State")
.with_country("US")
.with_expiry(chrono::Utc::now() + chrono::Duration::days(3650));

Capabilities

repo (other)

Repository functions for identifier models.

Item
async fn create_identifier(pool : & PgPool, identifier : & Identifier,) -> Result <Identifier, IdentifierError>
async fn find_identifier_by_id(pool : & PgPool, id : Uuid,) -> Result <Option <Identifier>, IdentifierError>
async fn find_identifiers_for_party(pool : & PgPool, party_type : PartyType, party_id : PartyId,) -> Result <Vec <Identifier>, IdentifierError>
async fn find_identifier_by_value(pool : & PgPool, identifier_type : IdentifierType, value : & str,) -> Result <Option <Identifier>, IdentifierError>
async fn find_primary_identifier(pool : & PgPool, party_type : PartyType, party_id : PartyId, identifier_type : IdentifierType,) -> Result <Option <Identifier>, IdentifierError>
async fn verify_identifier(pool : & PgPool, id : Uuid, verified_by : Option <Uuid>,) -> Result <(), IdentifierError>
async fn soft_delete_identifier(pool : & PgPool, id : Uuid) -> Result <(), IdentifierError>

How to use it

From this crate's own rustdoc:

use identity_identifiers::{Identifier, IdentifierType, PartyId, PartyType};

// Create a microchip identifier for an animal
let microchip = Identifier::new(
    PartyType::Animal,
    PartyId::new_v4(),
    IdentifierType::Microchip,
    "985141404123456",
)
.with_issuer("AVID")
.verified();

// Create a passport for a person
let passport = Identifier::new(
    PartyType::Person,
    PartyId::new_v4(),
    IdentifierType::Passport,
    "AB1234567",
)
.with_issuer("US Department of State")
.with_country("US")
.with_expiry(chrono::Utc::now() + chrono::Duration::days(3650));

Module structure

identity_identifiers

Public surface

`repo`

ItemWhat it is
async fn create_identifier(pool : & PgPool, identifier : & Identifier,) -> Result <Identifier, IdentifierError>Create a new identifier in the database
async fn find_identifier_by_id(pool : & PgPool, id : Uuid,) -> Result <Option <Identifier>, IdentifierError>Find an identifier by ID
async fn find_identifiers_for_party(pool : & PgPool, party_type : PartyType, party_id : PartyId,) -> Result <Vec <Identifier>, IdentifierError>Find all identifiers for a party
async fn find_identifier_by_value(pool : & PgPool, identifier_type : IdentifierType, value : & str,) -> Result <Option <Identifier>, IdentifierError>Find identifier by type and value (for uniqueness checks)
async fn find_primary_identifier(pool : & PgPool, party_type : PartyType, party_id : PartyId, identifier_type : IdentifierType,) -> Result <Option <Identifier>, IdentifierError>Find the primary identifier of a given type for a party
async fn verify_identifier(pool : & PgPool, id : Uuid, verified_by : Option <Uuid>,) -> Result <(), IdentifierError>Mark an identifier as verified
async fn soft_delete_identifier(pool : & PgPool, id : Uuid) -> Result <(), IdentifierError>Soft delete an identifier

Re-exports. Exported here, defined elsewhere.

ExportDefined in
IdentifierErrorerror::IdentifierError
{HasId,SoftDeletable,Timestamped}foundation_basemodels::{HasId,SoftDeletable,Timestamped}
{Identifier,IdentifierType}identifier::{Identifier,IdentifierType}
{PartyId,PartyType}identity_parties::{PartyId,PartyType}

Boundary

Reaches into foundation.

Shares tier identity with 7 other crates: identity-auth, identity-impersonation, identity-parties, identity-party-places, identity-rbac, identity-tenant, identity-user-prefs.

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)identity
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/identity/identifiers
Vocabulary in force (lexicon)current

Tier flow. Which tiers this crate's own edges cross.

flowchart LR
  n_identity["identity"] --> n_foundation["foundation"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`foundation-basemodels`foundationnoalways
`identity-parties`identitynoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
chrono^0.4serdenoalways
serde^1derivenoalways
serde_json^1noalways
sqlx^0.8runtime-tokio, postgres, chrono, uuid, jsonnoalways
thiserror^2noalways
uuid^1v4, v7, serde, jsnoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
dotenvy^0.15noalways
tokio^1fullnoalways
tokio-test^0.4noalways

Build. None.

Depended on by. 1 workspace crate.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_application_identifiers["application-identifiers"] -->|uses| SELF
  SELF["identity-identifiers"]
  SELF -->|runtime| n_foundation_basemodels["foundation-basemodels"]
  SELF -->|runtime| n_identity_parties["identity-parties"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

FeatureEnablesOn by default
postgresno
flowchart LR
  n_postgres["postgres"]

Targets

KindNameSource
libidentity_identifiers`src/lib.rs`
testintegration_tests`tests/integration_tests.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfaceyes
async runtimenone detected
database accessyes
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

1 workspace crate depends on this one: application-identifiers.

Verification

KindCount
Unit tests21
Integration tests7
Examples0
Doctests1

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
repo700

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc77
Public modules with a //! block11
pie showData
    title Public items with rustdoc
    "Documented" : 7
    "No rustdoc detected" : 0

Metrics

MetricValue
Rust source files4
Source lines1083
Code lines763
Public API items7
Public modules1
Tests28
Examples0
Cargo features1
Direct runtime dependencies8
Workspace reverse dependencies1
pie showData
    title Public API by kind
    "function" : 7
pie showData
    title Rust source composition
    "Code" : 763
    "Blank or comment" : 320

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

Todas las identity · Manual