URISchemeValidator

public final class URISchemeValidator : Sendable

Validates and signs SEP-0007 compliant Stellar URIs.

This class provides functionality for signing URI scheme requests and verifying their authenticity by validating signatures against the origin domain’s stellar.toml file. It ensures URI requests come from legitimate sources by checking cryptographic signatures.

See: https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0007.md

  • Undocumented

    Declaration

    Swift

    public init()
  • Signs a SEP-0007 compliant URL with the signer’s key pair.

    Generates a signature for the URI and appends it as the signature parameter.

    Declaration

    Swift

    public func signURI(url: String, signerKeyPair: KeyPair) -> SignURLEnum

    Parameters

    url

    The SEP-0007 compliant URI to be signed

    signerKeyPair

    The key pair used to generate the signature

    Return Value

    SignURLEnum with the signed URL on success, or an error on failure

  • Validates a SEP-0007 URI by verifying its signature against the origin domain’s stellar.toml.

    Checks that:

    1. The origin_domain parameter is present and is a valid fully qualified domain name
    2. The domain’s stellar.toml contains a URI_REQUEST_SIGNING_KEY
    3. The signature parameter is present and valid for the signing key

    Declaration

    Swift

    public func checkURISchemeIsValid(url: String) async -> URISchemeIsValidEnum

    Parameters

    url

    The SEP-0007 compliant URI to validate

    Return Value

    URISchemeIsValidEnum indicating success or the specific validation error