Distributed Access Right Controls

### Hierarchy

- Message<Darc>
  - Darc

## Index

### Constructors

- constructor

### Properties

- $type
- baseID
- description
- prevID
- rules
- version
- $type
- ruleSign

### Accessors

- id

### Methods

- addIdentity
- copy
- evolve
- getBaseID
- ruleMatch
- toBytes
- toJSON
- toString
- create
- createBasic
- decode
- decodeDelimited
- encode
- encodeDelimited
- fromObject
- initRules
- register
- toObject
- verify

## Constructors

### constructor

- new Darc(properties?: Properties<Darc>): Darc

- Overrides Message.__constructor

  - Defined in src/darc/darc.ts:94

  #### Parameters

  - ##### Optional properties: Properties<Darc>

  #### Returns Darc

## Properties

### $type

$type: Type

Inherited from Message.$type

- Defined in node_modules/protobufjs/index.d.ts:524

Reference to the reflected type.

### baseID

baseID: Buffer

- Defined in src/darc/darc.ts:92

### description

description: Buffer

- Defined in src/darc/darc.ts:91

### prevID

prevID: Buffer

- Defined in src/darc/darc.ts:93

### rules

rules: Rules

- Defined in src/darc/darc.ts:94

### version

version: Long

- Defined in src/darc/darc.ts:90

### Static $type

$type: Type

Inherited from Message.$type

- Defined in node_modules/protobufjs/index.d.ts:521

Reference to the reflected type.

### Static ruleSign

ruleSign: "_sign" = "_sign"

- Defined in src/darc/darc.ts:38

## Accessors

### id

- get id(): Buffer

- - Defined in src/darc/darc.ts:17

  Get the id of the darc

  #### Returns Buffer

  the id as a buffer

## Methods

### addIdentity

- addIdentity(rule: string, identity: IIdentity, op: string): void

- - Defined in src/darc/darc.ts:144

  Append an identity to a rule using the given operator when it already exists

  #### Parameters

  - ##### rule: string

    the name of the rule

  - ##### identity: IIdentity

    the identity to append to the rule

  - ##### op: string

    the operator to use if necessary

  #### Returns void

### copy

- copy(): Darc

- - Defined in src/darc/darc.ts:186

  Returns a deep copy of the darc.

  #### Returns Darc

### evolve

- evolve(): Darc

- - Defined in src/darc/darc.ts:153

  Copy and evolve the darc to the next version so that it can be changed and proposed to byzcoin.

  #### Returns Darc

  a new darc

### getBaseID

- getBaseID(): Buffer

- - Defined in src/darc/darc.ts:129

  Get the id of the genesis darc

  #### Returns Buffer

  the id as a buffer

### ruleMatch

- ruleMatch(action: string, signers: IIdentity[], getDarc: function): Promise<IIdentity[]>

- - Defined in src/darc/darc.ts:202

  Checks whether the given rule can be matched by a multi-signature created by all signers. If the rule doesn't exist, it throws an error. Currently restrictions:

  - only Rule.OR are supported. A Rule.AND or "(" will return an error.
  - only one identity can be checked. If more identities are given, the function returns an error.

  #### Parameters

  - ##### action: string

    the action to match

  - ##### signers: IIdentity[]

    all supposed signers for this action.

  - ##### getDarc: function

    - - (id: Buffer): Promise<Darc>

      - #### Parameters

        - ##### id: Buffer

        #### Returns Promise<Darc>

  #### Returns Promise<IIdentity[]>

  the set of identities that match the rule.

### toBytes

- toBytes(): Buffer

- - Defined in src/darc/darc.ts:179

  Helper to encode the darc using protobuf

  #### Returns Buffer

  encoded darc as a buffer

### toJSON

- toJSON(): object

- Inherited from Message.toJSON

  - Defined in node_modules/protobufjs/index.d.ts:589

  Converts this message to JSON.

  #### Returns object

  JSON object

  - ##### [k: string]: any

### toString

- toString(): string

- - Defined in src/darc/darc.ts:167

  Get a string representation of the darc

  #### Returns string

  the string representation

### Static create

- create<T>(this: Constructor<T>, properties?: object): Message<T>

- Inherited from Message.create

  - Defined in node_modules/protobufjs/index.d.ts:531

  Creates a new message of this type using the specified properties.

  #### Type parameters

  - #### T: Message<Darc>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### Optional properties: object

    - ##### [k: string]: any

  #### Returns Message<T>

  Message instance

### Static createBasic

- createBasic(owners: IIdentity[], signers: IIdentity[], desc?: Buffer, rules?: string[]): Darc

- - Defined in src/darc/darc.ts:62

  Creates a basic darc using the owners and signers to populate the rules.

  #### Parameters

  - ##### owners: IIdentity[]

    those you can evolve the darc

  - ##### signers: IIdentity[]

    those you can sign

  - ##### Optional desc: Buffer

    the description of the darc

  - ##### Optional rules: string[]

  #### Returns Darc

  the new darc

### Static decode

- decode<T>(this: Constructor<T>, reader: Reader | Uint8Array): T

- Inherited from Message.decode

  - Defined in node_modules/protobufjs/index.d.ts:554

  Decodes a message of this type.

  #### Type parameters

  - #### T: Message<Darc>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### reader: Reader | Uint8Array

    Reader or buffer to decode

  #### Returns T

  Decoded message

### Static decodeDelimited

- decodeDelimited<T>(this: Constructor<T>, reader: Reader | Uint8Array): T

- Inherited from Message.decodeDelimited

  - Defined in node_modules/protobufjs/index.d.ts:561

  Decodes a message of this type preceeded by its length as a varint.

  #### Type parameters

  - #### T: Message<Darc>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### reader: Reader | Uint8Array

    Reader or buffer to decode

  #### Returns T

  Decoded message

### Static encode

- encode<T>(this: Constructor<T>, message: T | object, writer?: Writer): Writer

- Inherited from Message.encode

  - Defined in node_modules/protobufjs/index.d.ts:539

  Encodes a message of this type.

  #### Type parameters

  - #### T: Message<Darc>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### message: T | object

    Message to encode

  - ##### Optional writer: Writer

  #### Returns Writer

  Writer

### Static encodeDelimited

- encodeDelimited<T>(this: Constructor<T>, message: T | object, writer?: Writer): Writer

- Inherited from Message.encodeDelimited

  - Defined in node_modules/protobufjs/index.d.ts:547

  Encodes a message of this type preceeded by its length as a varint.

  #### Type parameters

  - #### T: Message<Darc>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### message: T | object

    Message to encode

  - ##### Optional writer: Writer

  #### Returns Writer

  Writer

### Static fromObject

- fromObject<T>(this: Constructor<T>, object: object): T

- Inherited from Message.fromObject

  - Defined in node_modules/protobufjs/index.d.ts:575

  Creates a new message of this type from a plain object. Also converts values to their respective internal types.

  #### Type parameters

  - #### T: Message<Darc>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### object: object

    Plain object

    - ##### [k: string]: any

  #### Returns T

  Message instance

### Static initRules

- initRules(owners: IIdentity[], signers: IIdentity[]): Rules

- - Defined in src/darc/darc.ts:45

  Create a list of rules with basic permissions for owners and signers

  #### Parameters

  - ##### owners: IIdentity[]

    those allow to evolve the darc

  - ##### signers: IIdentity[]

    those allow to sign

  #### Returns Rules

  the list of rules

### Static register

- register(): void

- - Defined in src/darc/darc.ts:86
  see

    README#Message classes

  #### Returns void

### Static toObject

- toObject<T>(this: Constructor<T>, message: T, options?: IConversionOptions): object

- Inherited from Message.toObject

  - Defined in node_modules/protobufjs/index.d.ts:583

  Creates a plain object from a message of this type. Also converts values to other types if specified.

  #### Type parameters

  - #### T: Message<Darc>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### message: T

    Message instance

  - ##### Optional options: IConversionOptions

  #### Returns object

  Plain object

  - ##### [k: string]: any

### Static verify

- verify(message: object): string

- Inherited from Message.verify

  - Defined in node_modules/protobufjs/index.d.ts:568

  Verifies a message of this type.

  #### Parameters

  - ##### message: object

    Plain object to verify

    - ##### [k: string]: any

  #### Returns string

  `null` if valid, otherwise the reason why it is not

Generated using TypeDoc