### Hierarchy

- Instance
  - CredentialsInstance

## Index

### Constructors

- constructor

### Properties

- contractID
- credential
- darcID
- data
- id
- inst
- rpc
- argumentCredID
- argumentCredential
- argumentDarcID
- commandUpdate
- contractID

### Methods

- getAttribute
- recoverIdentity
- sendUpdate
- setAttribute
- toBytes
- update
- calcInstID
- create
- credentialIID
- fromBytes
- fromByzcoin
- fromProof
- spawn

## Constructors

### constructor

- new CredentialsInstance(rpc: ByzCoinRPC, inst: Instance): CredentialsInstance

- Overrides Instance.constructor

  - Defined in src/personhood/credentials-instance.ts:115

  #### Parameters

  - ##### rpc: ByzCoinRPC

  - ##### inst: Instance

  #### Returns CredentialsInstance

## Properties

### contractID

contractID: string

Inherited from Instance.contractID

- Defined in src/byzcoin/instance.ts:67

### credential

credential: CredentialStruct

- Defined in src/personhood/credentials-instance.ts:115

### darcID

darcID: InstanceID

Inherited from Instance.darcID

- Defined in src/byzcoin/instance.ts:68

### data

data: Buffer

Inherited from Instance.data

- Defined in src/byzcoin/instance.ts:69

### id

id: InstanceID

Inherited from Instance.id

- Defined in src/byzcoin/instance.ts:66

### inst

inst: Instance

- Defined in src/personhood/credentials-instance.ts:117

### Private rpc

rpc: ByzCoinRPC

- Defined in src/personhood/credentials-instance.ts:117

### Static argumentCredID

argumentCredID: "credentialID" = "credentialID"

- Defined in src/personhood/credentials-instance.ts:14

### Static argumentCredential

argumentCredential: "credential" = "credential"

- Defined in src/personhood/credentials-instance.ts:13

### Static argumentDarcID

argumentDarcID: "darcIDBuf" = "darcIDBuf"

- Defined in src/personhood/credentials-instance.ts:15

### Static commandUpdate

commandUpdate: "update" = "update"

- Defined in src/personhood/credentials-instance.ts:12

### Static contractID

contractID: "credential" = "credential"

- Defined in src/personhood/credentials-instance.ts:11

## Methods

### getAttribute

- getAttribute(credential: string, attribute: string): Buffer | undefined

- - Defined in src/personhood/credentials-instance.ts:145

  Get a credential attribute

  #### Parameters

  - ##### credential: string

    The name of the credential

  - ##### attribute: string

    The name of the attribute

  #### Returns Buffer | undefined

  the value of the attribute if it exists, undefined otherwise

### recoverIdentity

- recoverIdentity(pubKey: Point, signatures: RecoverySignature[]): Promise<void>

- - Defined in src/personhood/credentials-instance.ts:193

  Recovers an identity by giving a list of signatures from trusted people.

  #### Parameters

  - ##### pubKey: Point

    the new public key for the identity. It will be stored as the new expression for the signer-rule.

  - ##### signatures: RecoverySignature[]

    a threshold list of signatures on the public key and the instanceID.

  #### Returns Promise<void>

### sendUpdate

- sendUpdate(owners: Signer[], newCred?: CredentialStruct): Promise<CredentialsInstance>

- - Defined in src/personhood/credentials-instance.ts:168

  Creates a transaction to update the credential and sends it to ByzCoin.

  #### Parameters

  - ##### owners: Signer[]

    a list of signers to fulfill the expression of the `invoke:credential.update` rule.

  - ##### Optional newCred: CredentialStruct

    the new credentialStruct to store in the instance.

  #### Returns Promise<CredentialsInstance>

  the updated CredentialInstance

### setAttribute

- setAttribute(credential: string, attribute: string, value?: Buffer): void

- - Defined in src/personhood/credentials-instance.ts:157

  Set or update a credential attribute locally. The new credential is not sent to the blockchain, for this you need to call sendUpdate.

  #### Parameters

  - ##### credential: string

    Name of the credential

  - ##### attribute: string

    Name of the attribute

  - ##### Optional value: Buffer

    The value to set

  #### Returns void

### toBytes

- toBytes(): Buffer

- Inherited from Instance.toBytes

  - Defined in src/byzcoin/instance.ts:81

  Returns a byte representation of the Instance.

  #### Returns Buffer

### update

- update(): Promise<CredentialsInstance>

- - Defined in src/personhood/credentials-instance.ts:130

  Update the data of the crendetial instance by fetching the proof

  #### Returns Promise<CredentialsInstance>

  a promise resolving with the instance on success

### Static calcInstID

- calcInstID(contractID: string, preID: Buffer): InstanceID

- Inherited from Instance.calcInstID

  - Defined in src/byzcoin/instance.ts:60

  Returns the instanceID given a contract and a preID

  #### Parameters

  - ##### contractID: string

  - ##### preID: Buffer

  #### Returns InstanceID

### Static create

- create(bc: ByzCoinRPC, darcID: InstanceID, cred: CredentialStruct, credID?: Buffer): CredentialsInstance

- - Defined in src/personhood/credentials-instance.ts:85

  Create a new credential instance from a darc

  #### Parameters

  - ##### bc: ByzCoinRPC

    The RPC to use

  - ##### darcID: InstanceID

    The darc instance ID

  - ##### cred: CredentialStruct

    The credential to store

  - ##### Optional credID: Buffer

    the instanceID will be sha256("credential" | credID)

  #### Returns CredentialsInstance

  the new instance

### Static credentialIID

- credentialIID(buf: Buffer): InstanceID

- - Defined in src/personhood/credentials-instance.ts:23

  Generate the credential instance ID for a given public key

  #### Parameters

  - ##### buf: Buffer

    the public key in marshalBinary form

  #### Returns InstanceID

  the id as a buffer

### Static fromBytes

- fromBytes(buf: Buffer): Instance

- Inherited from Instance.fromBytes

  - Defined in src/byzcoin/instance.ts:45

  Returns an instance from a previously toBytes() call.

  #### Parameters

  - ##### buf: Buffer

  #### Returns Instance

### Static fromByzcoin

- fromByzcoin(bc: ByzCoinRPC, iid: InstanceID, waitMatch?: number, interval?: number): Promise<CredentialsInstance>

- Overrides Instance.fromByzcoin

  - Defined in src/personhood/credentials-instance.ts:111

  Get an existing credential instance using its instance ID by fetching the proof.

  #### Parameters

  - ##### bc: ByzCoinRPC

    the byzcoin RPC

  - ##### iid: InstanceID

    the instance ID

  - ##### Default value waitMatch: number = 0

    how many times to wait for a match - useful if its called just after an addTransactionAndWait.

  - ##### Default value interval: number = 1000

    how long to wait between two attempts in waitMatch.

  #### Returns Promise<CredentialsInstance>

### Static fromProof

- fromProof(id: InstanceID, p: Proof): Instance

- Inherited from Instance.fromProof

  - Defined in src/byzcoin/instance.ts:18

  Create an instance from a proof

  #### Parameters

  - ##### id: InstanceID

    the instance-id to extract

  - ##### p: Proof

    The proof

  #### Returns Instance

  the instance

### Static spawn

- spawn(bc: ByzCoinRPC, darcID: InstanceID, signers: Signer[], cred: CredentialStruct, credID?: Buffer, credDarcID?: InstanceID, preID?: Buffer): Promise<CredentialsInstance>

- - Defined in src/personhood/credentials-instance.ts:42

  Spawn a new credential instance from a darc

  #### Parameters

  - ##### bc: ByzCoinRPC

    The RPC to use

  - ##### darcID: InstanceID

    The darc instance ID

  - ##### signers: Signer[]

    The list of signers for the transaction

  - ##### cred: CredentialStruct

    The credential to store

  - ##### Optional credID: Buffer

    the instanceID will be sha256("credential" | pub)

  - ##### Optional credDarcID: InstanceID

    replaces the darc stored in the new credential with credDarcID

  - ##### Optional preID: Buffer

    replaces credID for byzcoin-versions >= VersionPreID

  #### Returns Promise<CredentialsInstance>

  a promise that resolves with the new instance

Generated using TypeDoc