Verifiable claim.

TODO: override verify to add claim proof verification.

### Hierarchy

- Message
  - Claim

## Index

### Constructors

- constructor

### Properties

- content
- context
- metadata
- proof
- revocation
- signature
- useProof
- version

### Methods

- attest
- getStatus
- payloadFromJSON
- payloadToJSON
- revoke
- serialize
- serializeHeader
- serializeProof
- serializeUnsigned
- sign
- verify
- deserialize
- deserializeInternal

## Constructors

### constructor

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

- Overrides Message.constructor

  - Defined in claim/claim.ts:78

  #### Parameters

  - ##### metadata: Metadata

  - ##### Optional signature: Signature | undefined

  - ##### Optional useProof: undefined | true | false

  #### Returns Claim

## Properties

### content

content: any

- Defined in claim/claim.ts:74

### context

context: string

- Defined in claim/claim.ts:73

### metadata

metadata: Metadata

Inherited from Message.metadata

- Defined in claim/message.ts:141

### Optional proof

proof: ClaimProof

- Defined in claim/claim.ts:78

### Optional revocation

revocation: Revocation

- Defined in claim/claim.ts:75

### Optional signature

signature: Signature

Inherited from Message.signature

- Defined in claim/message.ts:142

### useProof

useProof: boolean

- Defined in claim/claim.ts:77

### version

version: string

- Defined in claim/claim.ts:72

## Methods

### attest

- attest(url: string, gasPrice: string, gasLimit: string, payer: Address, privateKey: PrivateKey): Promise<boolean>

- - Defined in claim/claim.ts:140

  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>

- - Defined in claim/claim.ts:193

  Gets status of the claim attest.

  #### Parameters

  - ##### url: string

    Restful endpoint of Ontology node

  #### Returns Promise<boolean>

### Protected payloadFromJSON

- payloadFromJSON(json: any): void

- Overrides Message.payloadFromJSON

  - Defined in claim/claim.ts:221

  #### Parameters

  - ##### json: any

  #### Returns void

### Protected payloadToJSON

- payloadToJSON(): any

- Overrides Message.payloadToJSON

  - Defined in claim/claim.ts:212

  #### Returns any

### revoke

- revoke(url: string, gasPrice: string, gasLimit: string, payer: Address, privateKey: PrivateKey): Promise<boolean>

- - Defined in claim/claim.ts:171

  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

- Overrides Message.serialize

  - Defined in claim/claim.ts:118

  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

- Overrides Message.serializeHeader

  - Defined in claim/claim.ts:236

  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

- - Defined in claim/claim.ts:258

  Serializes the proof into JWT-X.

  #### Returns string

### serializeUnsigned

- serializeUnsigned(algorithm?: SignatureScheme, publicKeyId?: undefined | string): string

- Inherited from Message.serializeUnsigned

  - Defined in claim/message.ts:223

  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

- sign(url: string, publicKeyId: string, privateKey: PrivateKey, algorithm?: SignatureScheme): Promise<void>

- Inherited from Message.sign

  - Defined in claim/message.ts:163

  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 Message.verify

  - Defined in claim/claim.ts:103

  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

- - Defined in claim/claim.ts:68

  #### Parameters

  - ##### jwt: string

  #### Returns Claim

### Static Protected deserializeInternal

- deserializeInternal<T>(jwt: string, creator: MessageFactory<T>): T

- Inherited from Message.deserializeInternal

  - Defined in claim/message.ts:81

  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

  - #### T: Message

  #### Parameters

  - ##### jwt: string

    Encoded message

  - ##### creator: MessageFactory<T>

    Factory method

  #### Returns T

Generated using TypeDoc