public class Darc extends Object
| Constructor and Description |
|---|
Darc(byte[] buf) |
Darc(DarcProto.Darc proto) |
Darc(List<Identity> owners,
List<Identity> signers,
byte[] desc)
Convenience constructor
|
Darc(Map<String,byte[]> rules,
byte[] desc)
The Darc constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Darc |
copy() |
Darc |
copyEvolve() |
DarcId |
getBaseId()
Gets the base-ID of the darc, i.e.
|
DarcId |
getId()
Calculate the getId of the darc by calculating the sha-256 of the invariant
parts which excludes the delegation-signature.
|
DarcId |
getPrevID() |
long |
getVersion() |
void |
increaseVersion()
Updates the version of the darc and clears any eventual signatures from previous
evolutions.
|
static Map<String,byte[]> |
initRules(List<Identity> owners,
List<Identity> signers)
This is a convenience function that initialise a set of rules with the default actions "_evolve" and "_sign".
|
void |
setBaseId(DarcId id) |
void |
setPrevId(Darc d) |
void |
setPrevId(DarcId id) |
void |
setRule(String action,
byte[] expression)
Sets a rule to be the action/expression pair.
|
DarcProto.Darc |
toProto()
Creates the protobuf representation of the darc.
|
String |
toString() |
public Darc(Map<String,byte[]> rules, byte[] desc)
rules - The initial set of rules, consider using initRules to create them.desc - The description.public Darc(List<Identity> owners, List<Identity> signers, byte[] desc)
owners - a list of owners that are allowed to evolve the darcsigners - a list of signers on behalf of that darcdesc - free form description of the darcpublic Darc(DarcProto.Darc proto) throws CothorityCryptoException
CothorityCryptoExceptionpublic Darc(byte[] buf)
throws com.google.protobuf.InvalidProtocolBufferException,
CothorityCryptoException
com.google.protobuf.InvalidProtocolBufferExceptionCothorityCryptoExceptionpublic void setRule(String action, byte[] expression)
action - expression - public void increaseVersion()
throws CothorityCryptoException
CothorityCryptoExceptionpublic DarcProto.Darc toProto()
public DarcId getId() throws CothorityCryptoException
CothorityCryptoExceptionpublic void setPrevId(DarcId id)
id - the id of the previous darc.public void setBaseId(DarcId id)
id - the base-id to setpublic void setPrevId(Darc d) throws CothorityCryptoException
d - the previous darcCothorityCryptoExceptionpublic DarcId getBaseId() throws CothorityCryptoException
CothorityCryptoExceptionpublic DarcId getPrevID()
public long getVersion()
public Darc copy() throws CothorityCryptoException
CothorityCryptoExceptionpublic Darc copyEvolve() throws CothorityCryptoException
CothorityCryptoExceptionpublic static Map<String,byte[]> initRules(List<Identity> owners, List<Identity> signers)
owners - A list of owners.signers - A list of signers.Copyright © 2018. All rights reserved.