public class Darc extends Object
| Constructor and Description |
|---|
Darc()
Overloaded function to create an empty darc.
|
Darc(DarcOCSProto.Darc proto)
Returns a darc from a protobuf representation.
|
Darc(Identity owner,
List<Identity> users,
byte[] data)
Initialize a darc by giving an owner that is allowed to evolve the darc
and a list of users allowed to sign actions on behalf of that darc.
|
Darc(List<Identity> owners,
List<Identity> users,
byte[] data)
Initialize a darc by giving an owner that is allowed to evolve the darc
and a list of users allowed to sign actions on behalf of that darc.
|
Darc(Signer owner,
List<Signer> users,
byte[] data)
Overloaded function for convenience.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOwner(Darc darc)
Adds an owner to the list of allowed signers.
|
void |
addOwner(Identity identity)
Adds a owner to the list of allowed signers.
|
void |
addOwner(Signer signer)
Adds a owner to the list of allowed signers.
|
void |
addUser(Darc darc)
Adds a user to the list of allowed signers.
|
void |
addUser(Identity identity)
Adds a user to the list of allowed signers.
|
void |
addUser(Signer signer)
Adds a user to the list of allowed signers.
|
Darc |
copy()
Creates a copy of the current darc and increases the version-number
by 1.
|
boolean |
equals(Darc d) |
DarcId |
getBaseId()
Returns the id of the darc with version == 0.
|
byte[] |
getData() |
DarcId |
getId()
Calculate the getId of the darc by calculating the sha-256 of the invariant
parts which excludes the delegation-signature.
|
List<Identity> |
getOwners()
Retrun copy of current owners of DARC
|
List<Identity> |
getUsers()
Return copy of current users of DARC (users/dacs who can execute this DARC)
|
int |
getVersion()
Returns the current version
|
void |
incVersion()
Increments the version of this Darc by 1.
|
void |
removeOwner(Darc darc) |
void |
removeOwner(Identity identity) |
void |
removeOwner(Signer signer) |
void |
removeUser(Darc darc) |
void |
removeUser(Identity identity) |
void |
removeUser(Signer signer) |
void |
setEvolution(Darc previous,
Signer previousOwner)
To evolve a darc, the latest valid darc needs to sign the new darc.
|
void |
setEvolutionOffline(Darc previous,
SignaturePath path,
Signer previousOwner)
To evolve a darc, the latest valid darc needs to sign the new darc.
|
DarcOCSProto.Darc |
toProto()
Creates a protobuf representation of the darc.
|
String |
toString() |
boolean |
verifyEvolution(Darc previous)
Returns true if the current darc has correctly been evolved from the previous darc.
|
public Darc(List<Identity> owners, List<Identity> users, byte[] data) throws CothorityCryptoException
owners - defines who will be allowed to evolve that darcusers - defines who can sign on behalf of that darcCothorityCryptoExceptionpublic Darc(Identity owner, List<Identity> users, byte[] data) throws CothorityException
owner - defines who will be allowed to evolve that darcusers - defines who can sign on behalf of that darcCothorityExceptionpublic Darc(Signer owner, List<Signer> users, byte[] data) throws CothorityCryptoException
owner - users - data - CothorityCryptoExceptionpublic Darc()
public Darc(DarcOCSProto.Darc proto) throws CothorityCryptoException
proto - CothorityCryptoExceptionpublic Darc copy() throws CothorityCryptoException
CothorityCryptoExceptionpublic DarcId getId() throws CothorityCryptoException
CothorityCryptoExceptionpublic void setEvolution(Darc previous, Signer previousOwner) throws CothorityCryptoException
If a new darc is signed with this method, it will only be verifiable in a setting where the verifier has access to the previous darc. This is OK in the case of OCS, but might not be OK if you would want to verify it without having access to the previous darc.
The verification will have to be done on the OCS skipchain.
previous - previousOwner - CothorityCryptoExceptionpublic void setEvolutionOffline(Darc previous, SignaturePath path, Signer previousOwner) throws CothorityCryptoException
previous - path - previousOwner - CothorityCryptoExceptionpublic DarcId getBaseId() throws CothorityCryptoException
CothorityCryptoExceptionpublic boolean verifyEvolution(Darc previous) throws CothorityCryptoException
previous - CothorityCryptoExceptionpublic DarcOCSProto.Darc toProto()
public void addUser(Identity identity)
identity - public void addUser(Darc darc) throws CothorityCryptoException
darc - CothorityCryptoExceptionpublic void addUser(Signer signer) throws CothorityCryptoException
signer - CothorityCryptoExceptionpublic void removeOwner(Identity identity)
public void removeOwner(Darc darc) throws CothorityCryptoException
CothorityCryptoExceptionpublic void removeOwner(Signer signer) throws CothorityCryptoException
CothorityCryptoExceptionpublic void removeUser(Identity identity)
public void removeUser(Darc darc) throws CothorityCryptoException
CothorityCryptoExceptionpublic void removeUser(Signer signer) throws CothorityCryptoException
CothorityCryptoExceptionpublic void addOwner(Identity identity)
identity - public void addOwner(Darc darc) throws CothorityCryptoException
darc - CothorityCryptoExceptionpublic void addOwner(Signer signer) throws CothorityCryptoException
signer - CothorityCryptoExceptionpublic void incVersion()
public int getVersion()
public List<Identity> getOwners()
public List<Identity> getUsers()
public byte[] getData()
public boolean equals(Darc d)
Copyright © 2018. All rights reserved.