public class Darc extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
RuleEvolve |
static String |
RuleSignature |
| Constructor and Description |
|---|
Darc(byte[] buf)
Convenience constructure
|
Darc(DarcProto.Darc proto)
Convenience constructor
|
Darc(List<Identity> owners,
List<Identity> signers,
byte[] desc)
Convenience constructor
|
Darc(Rules rules,
byte[] desc)
The Darc constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addIdentity(String action,
Identity id,
String link) |
Darc |
copyEvolve() |
Darc |
copyRulesAndVersion() |
boolean |
equals(Object other)
Compares this darc with another darc.
|
List<String> |
getActions() |
DarcId |
getBaseId()
Gets the base-ID of the darc, i.e.
|
byte[] |
getExpression(String action)
Returns a copy of the expression stored in the rule.
|
DarcId |
getId()
Calculate the getId of the darc by calculating the sha-256 of the invariant
parts which excludes the delegation-signature.
|
Identity |
getIdentity() |
DarcId |
getPrevID() |
long |
getVersion() |
void |
increaseVersion()
Updates the version of the darc and clears any eventual signatures from previous
evolutions.
|
static Rules |
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".
|
byte[] |
removeAction(String action)
Removes the given action.
|
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 static final String RuleSignature
public static final String RuleEvolve
public Darc(Rules 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
proto - proto representation of the darcCothorityCryptoException - if there's a problem with the cryptographypublic Darc(byte[] buf)
throws com.google.protobuf.InvalidProtocolBufferException,
CothorityCryptoException
buf - byte representation of protobuf representationcom.google.protobuf.InvalidProtocolBufferException - if the Darc cannot be parsedCothorityCryptoException - if there's a problem with the cryptographypublic void setRule(String action, byte[] expression)
action - the actionexpression - the expressionpublic void addIdentity(String action, Identity id, String link) throws CothorityCryptoException
CothorityCryptoExceptionpublic byte[] getExpression(String action)
action - - which expression to returnpublic byte[] removeAction(String action)
action - if that action is in the set of rules, removes it.public void increaseVersion()
public DarcProto.Darc toProto()
public DarcId getId()
public 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 darcCothorityCryptoException - if there's a problem with the cryptographypublic DarcId getBaseId() throws CothorityCryptoException
CothorityCryptoException - if there's a problem with the cryptographypublic DarcId getPrevID()
public long getVersion()
public Darc copyRulesAndVersion()
CothorityCryptoException - if there's a problem with the cryptographypublic Darc copyEvolve() throws CothorityCryptoException
CothorityCryptoException - if there's a problem with the cryptographypublic Identity getIdentity() throws CothorityCryptoException
CothorityCryptoException - if there's a problem with the cryptographypublic static Rules initRules(List<Identity> owners, List<Identity> signers)
owners - A list of owners.signers - A list of signers.Copyright © 2018. All rights reserved.