Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StellarUri

A base class for parsing or constructing SEP-0007 style Stellar URIs.

see

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

Hierarchy

Index

Constructors

constructor

Properties

Protected uri

uri: URL

Accessors

callback

  • get callback(): undefined | string
  • set callback(callback: undefined | string): void
  • Gets the callback for this URI.

    Note: This returns the callback without the 'url:' prefix that may be present in the callback.

    Optional.

    Returns undefined | string

  • Sets the callback for this URI.

    Note: You may set it with or without the 'url:' prefix. If the prefix is not present it will added in the final URI string.

    Optional.

    Parameters

    • callback: undefined | string

    Returns void

isPublicNetwork

  • get isPublicNetwork(): boolean
  • Returns whether or not the network_passphase for this URI indicates that it is on the public network.

    This is true if network_passphrase is not set or if it's set to the public network's passphrase.

    Returns boolean

isTestNetwork

  • get isTestNetwork(): boolean
  • Returns whether or not the network_passphase for this URI indicates that it is on the test network.

    Returns boolean

msg

  • get msg(): undefined | string
  • set msg(msg: undefined | string): void
  • Gets the message to show to the user.

    Optional.

    Returns undefined | string

  • Sets the message to show to the user. This must be 300 characters or less.

    Optional.

    Parameters

    • msg: undefined | string

    Returns void

networkPassphrase

  • get networkPassphrase(): undefined | string
  • set networkPassphrase(networkPassphrase: undefined | string): void
  • Gets the network passphrase of the Stellar network to use for this request.

    If this is not set, the Stellar public network should be assumed.

    Optional.

    Returns undefined | string

  • Sets the network passphrase of the Stellar network to use for this request.

    Optional.

    Parameters

    • networkPassphrase: undefined | string

    Returns void

operation

originDomain

  • get originDomain(): undefined | string
  • set originDomain(originDomain: undefined | string): void
  • Gets the fully qualified domain name that specifies the originating domain of the URI request.

    Wallets must validate the URI request against the included signature before they display the origin_domain to the user.

    Returns undefined | string

  • Sets the fully qualified domain name that specifies the originating domain of the URI request.

    Wallets must validate the URI request against the included signature before they display the origin_domain to the user.

    Parameters

    • originDomain: undefined | string

    Returns void

pubkey

  • get pubkey(): undefined | string
  • set pubkey(pubkey: undefined | string): void
  • Gets which public key you want the URI handler to sign for.

    Optional.

    Returns undefined | string

  • Sets which public key you want the URI handler to sign for.

    Optional.

    Parameters

    • pubkey: undefined | string

    Returns void

signature

  • get signature(): undefined | string

Methods

addReplacement

addSignature

  • addSignature(keypair: Keypair): string
  • Signs the URI with the given keypair. This should be the last step done before generating the URI string, otherwise the signature will be invalid for the URI.

    Parameters

    • keypair: Keypair

      The keypair (including secret key), used to sign the request. This should be the keypair found in the URI_REQUEST_SIGNING_KEY field of the origin domains' stellar.toml.

    Returns string

Abstract clone

Private createSignaturePayload

  • createSignaturePayload(): Buffer

Protected getParam

  • getParam(key: string): string | undefined

getReplacements

  • getReplacements(): object[]
  • Gets a list of fields in the transaction that need to be replaced.

    Returns object[]

removeReplacement

  • removeReplacement(id: string): void
  • Removes all replacements with the given identifier.

    Parameters

    • id: string

      The identifier to remove.

    Returns void

Protected setParam

  • setParam(key: string, value?: undefined | string): void

setReplacements

  • Sets the "replace" key, which is a list of fields in the transaction that needs to be replaced.

    Parameters

    • replacements: Replacement[]

      A list of replacements to set.

    Returns void

toString

  • toString(): string

usePublicNetwork

  • usePublicNetwork(): void
  • Sets the network_passphrase to be the passphrase of the public network.

    Returns void

useTestNetwork

  • useTestNetwork(): void
  • Sets the network_passphrase to be the passphrase of the test network.

    Returns void

verifySignature

  • verifySignature(): Promise<boolean>
  • Verifies a that the signature added to the URI is valid.

    Returns true if the signature is valid for the current URI and origin domain, or if there is no origin domain and signature. Returns false if signature verification fails, or if there is a problem looking up the stellar.toml associated with the origin domain.

    Returns Promise<boolean>

Generated using TypeDoc