Options
All
  • Public
  • Public/Protected
  • All
Menu

Verifiable claim.

TODO: override verify to add claim proof verification.

Hierarchy

Index

Constructors

constructor

  • new Claim(metadata: Metadata, signature?: Signature | undefined, useProof?: undefined | true | false): Claim

Properties

content

content: any

context

context: string

metadata

metadata: Metadata

Optional proof

proof: ClaimProof

Optional revocation

revocation: Revocation

Optional signature

signature: Signature

useProof

useProof: boolean

version

version: string

Methods

attest

  • attest(url: string, gasPrice: string, gasLimit: string, payer: Address, privateKey: PrivateKey): Promise<boolean>
  • Attests the claim onto blockchain.

    Parameters

    • url: string

      Websocket endpoint of Ontology node

    • gasPrice: string

      gasPrice

    • gasLimit: string

      gasLimit

    • payer: Address

      payer

    • privateKey: PrivateKey

      Private key to sign the transaction

    Returns Promise<boolean>

getStatus

  • getStatus(url: string): Promise<boolean>
  • Gets status of the claim attest.

    Parameters

    • url: string

      Restful endpoint of Ontology node

    Returns Promise<boolean>

Protected payloadFromJSON

  • payloadFromJSON(json: any): void

Protected payloadToJSON

  • payloadToJSON(): any

revoke

  • revoke(url: string, gasPrice: string, gasLimit: string, payer: Address, privateKey: PrivateKey): Promise<boolean>
  • Revokes claim attest from blockchain.

    Parameters

    • url: string

      Websocket endpoint of Ontology node

    • gasPrice: string

      gasPrice

    • gasLimit: string

      gasLimit

    • payer: Address

      payer

    • privateKey: PrivateKey

      Private key to sign the transaction

    Returns Promise<boolean>

serialize

  • serialize(): string
  • Serializes the claim into JWT/JWT-X format.

    Override default implementation by adding proof if available.

    Returns string

Protected serializeHeader

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

    Override default implementation by adding proof if available.

    Parameters

    • algorithm: SignatureScheme | undefined

      Signature algorithm used

    • publicKeyId: string | undefined

      The ID of a signature public key

    Returns string

Protected serializeProof

  • serializeProof(): 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, checkAttest?: boolean): Promise<boolean>
  • Overrides default message verification with added attest verification.

    TODO: return more than boolean

    const VerifyOntidClaimResult = { CLAIM_NOT_ONCHAIN : 'CLAIM_NOT_ONCHAIN', INVALID_SIGNATURE : 'INVALID_SIGNATURE', PK_IN_REVOKED : 'PK_IN_REVOKED', NO_ISSUER_PK : 'NO_ISSUER_PK', EXPIRED_CLAIM : 'EXPIRED_CLAIM', REVOKED_CLAIM : 'REVOKED_CLAIM', VALID_CLAIM : 'VALID_CLAIM' };

    Parameters

    • url: string

      Restful endpoint of Ontology node

    • Default value checkAttest: boolean = true

      Should be the attest tested

    Returns Promise<boolean>

Static deserialize

  • deserialize(jwt: string): Claim

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

Generated using TypeDoc