Options
All
  • Public
  • Public/Protected
  • All
Menu

Common representation of Message in JWT form.

Hierarchy

Index

Constructors

constructor

Properties

metadata

metadata: Metadata

Optional signature

signature: Signature

Methods

Protected Abstract payloadFromJSON

  • payloadFromJSON(json: any): void
  • Retrieves data from JSON.

    Parameters

    • json: any

      JSON object with data

    Returns void

Protected Abstract payloadToJSON

  • payloadToJSON(): any

serialize

  • serialize(): string

Protected serializeHeader

  • serializeHeader(algorithm: SignatureScheme | undefined, publicKeyId: string | undefined): string
  • Serializes the header into JWT encoded header.

    Parameters

    • algorithm: SignatureScheme | undefined

      Signature algorithm used

    • publicKeyId: string | undefined

      The ID of a signature public key

    Returns string

Private serializePayload

  • serializePayload(): string

serializeUnsigned

  • serializeUnsigned(algorithm?: SignatureScheme, publicKeyId?: undefined | string): string
  • Serializes the message without signature into JWT format.

    Header might contain algorithm and public key id.

    Parameters

    • Optional algorithm: SignatureScheme

      Signature algorithm used

    • Optional publicKeyId: undefined | string

      The ID of a signature public key

    Returns string

sign

  • Signs the message and store the signature inside the request.

    If the algorithm is not specified, then default algorithm for Private key type is used.

    Parameters

    • url: string

      Restful endpoint of Ontology node

    • publicKeyId: string

      The ID of a signature public key

    • privateKey: PrivateKey

      Private key to sign the request with

    • Optional algorithm: SignatureScheme

      Signature algorithm used

    Returns Promise<void>

verify

  • verify(url: string): Promise<boolean>
  • Verifies the signature and check ownership of specified ONT ID through smart contract call.

    Parameters

    • url: string

      Restful endpoint of Ontology node

    Returns Promise<boolean>

    Boolean if the ownership is confirmed

Private verifyExpiration

  • verifyExpiration(): boolean

Private verifyKeyOwnership

  • verifyKeyOwnership(): boolean
  • Verifies if the declared public key id belongs to issuer.

    Returns boolean

Static Private deserializeHeader

  • deserializeHeader(encoded: string): object
  • Deserializes the header from JWT encoded header.

    Parameters

    • encoded: string

      JWT encoded header

    Returns object

Static Protected deserializeInternal

  • Deserializes the message from JWT format.

    A concrete instance will be creater through the message factory method. This method is called from concrete class.

    Type parameters

    Parameters

    • jwt: string

      Encoded message

    • creator: MessageFactory<T>

      Factory method

    Returns T

Static Private deserializePayload

  • deserializePayload(encoded: string): object
  • Deserializes payload part of JWT message.

    Parameters

    • encoded: string

      JWT encoded payload

    Returns object

Generated using TypeDoc