Members on this page
Meshline.Sdk
Meshline.Models.Protocol
ContentReference Class
Identifies external content by location, plaintext digest, media type, and size.
public sealed record ContentReference : Meshline.Models.Protocol.ProtocolModel, System.IEquatable<Meshline.Models.Protocol.ContentReference>
Inheritance System.Object → ProtocolModel → ContentReference
Implements System.IEquatable<ContentReference>
Properties
ContentReference.ContentType Property
The media type describing the content.
public string ContentType { get; init; }
Property Value
ContentReference.Encryption Property
The attachment encryption parameters, or null for unencrypted content.
public Meshline.Models.Protocol.ContentEncryption? Encryption { get; init; }
Property Value
ContentReference.Hash Property
The plaintext SHA-256 digest in canonical sha256: base64url form.
public string Hash { get; init; }
Property Value
ContentReference.HashUri Property
The corresponding ni:///sha-256; URI used to reference this attachment in message text.
public string HashUri { get; }
Property Value
ContentReference.Size Property
The size of the plaintext attachment in bytes.
public long Size { get; init; }
Property Value
ContentReference.Uri Property
The URI from which the attachment content can be retrieved.
public string Uri { get; init; }
Property Value
Methods
ContentReference.Resolve(string, IReadOnlyList<ContentReference>) Method
Resolves a hash-based attachment URI against the supplied content references.
public static Meshline.Models.Protocol.ContentReference? Resolve(string target, System.Collections.Generic.IReadOnlyList<Meshline.Models.Protocol.ContentReference> attachments);
Parameters
target System.String
The ni:///sha-256; attachment reference to resolve.
attachments System.Collections.Generic.IReadOnlyList<ContentReference>
The attachment references to search by plaintext digest.
Returns
ContentReference
The first matching attachment, or null when the URI is unsupported or no digest matches.
Exceptions
System.ArgumentNullException
The attachments collection is null when a valid content hash is resolved.
ContentReference.Validate(NetworkContext) Method
Validates the HTTPS location, plaintext hash, media type, size, and optional AES-256-GCM parameters.
public override Meshline.Validation.ProtocolViolation? Validate(Meshline.Models.NetworkContext? context=null);
Parameters
context NetworkContext
The optional network context passed to nested validation when needed; field-only validation may ignore it.
Returns
ProtocolViolation
The first detected protocol violation, or null if the implemented checks pass.
ContentReference.Verify(ReadOnlySpan<byte>) Method
Checks the plaintext attachment's length and SHA-256 digest against this reference.
public Meshline.Validation.ProtocolViolation? Verify(System.ReadOnlySpan<byte> plaintext);
Parameters
plaintext System.ReadOnlySpan<System.Byte>
The plaintext content bytes.
Returns
ProtocolViolation
The first detected protocol violation, or null if the implemented checks pass.
Exceptions
System.FormatException
The stored digest is not valid base64url; validate the content reference before verifying bytes.
System.ArgumentOutOfRangeException
The stored hash is too short to contain its expected prefix and digest.
System.Security.Cryptography.CryptographicException
The cryptographic provider cannot compute the plaintext SHA-256 digest.