net.sergeych.biserializer.BiSerializable
public class SimpleRole extends Role
IMPORTANT, This class express "all_of" logic, e.g. if all of the presented keys are listed, then the role is allowed.
Role.RequiredMode
requiredAllReferences, requiredAnyReferences
Constructor | Description |
---|---|
SimpleRole(java.lang.String name) |
Deprecated.
|
SimpleRole(java.lang.String name,
@NonNull KeyRecord keyRecord) |
Deprecated.
use
SimpleRole(String, Contract, KeyRecord) instead |
SimpleRole(java.lang.String name,
@NonNull java.util.Collection records) |
Deprecated.
use
SimpleRole(String, Contract, Collection) instead |
SimpleRole(java.lang.String name,
Contract contract) |
Create new empty
SimpleRole . |
SimpleRole(java.lang.String name,
Contract contract,
@NonNull KeyRecord keyRecord) |
Create new
SimpleRole and add one KeyRecord associated with role. |
SimpleRole(java.lang.String name,
Contract contract,
@NonNull java.util.Collection records) |
Create new
SimpleRole . |
Modifier and Type | Method | Description |
---|---|---|
void |
addKeyRecord(KeyRecord keyRecord) |
Adds
KeyRecord to role. |
void |
anonymize() |
If this role has public keys, they will be replaced with
AnonymousId . |
SimpleRole |
cloneAs(java.lang.String name) |
Deprecated.
|
SimpleRole |
cloneAs(java.lang.String name,
Contract contract) |
Clone the role with a different names, using the same (not copied) key records, in the new copy of the container.
|
void |
deserialize(net.sergeych.tools.Binder data,
net.sergeych.biserializer.BiDeserializer deserializer) |
|
protected boolean |
equalsIgnoreNameAndRefs(Role role) |
|
java.util.Set<AnonymousId> |
getAnonymousIds() |
Deprecated.
|
java.util.Set<com.icodici.crypto.KeyAddress> |
getKeyAddresses() |
Deprecated.
|
KeyRecord |
getKeyRecord() |
Deprecated.
|
java.util.Set<KeyRecord> |
getKeyRecords() |
Deprecated.
|
java.util.Set<com.icodici.crypto.PublicKey> |
getKeys() |
Deprecated.
|
java.util.Set<AnonymousId> |
getSimpleAnonymousIds() |
Get set of all anonymous identifiers in role.
|
java.util.Set<com.icodici.crypto.KeyAddress> |
getSimpleKeyAddresses() |
Get set of all key addresses in role.
|
java.util.Set<KeyRecord> |
getSimpleKeyRecords() |
Get set of all key records in role.
|
java.util.Set<com.icodici.crypto.PublicKey> |
getSimpleKeys() |
Get set of all keys in role.
|
void |
initWithDsl(net.sergeych.tools.Binder serializedRole) |
Initializes role from dsl.
|
boolean |
isAllowedForKeys(SimpleRole anotherRole) |
Check role is allowed to keys from other
SimpleRole |
boolean |
isAllowedForKeysQuantized(java.util.Set<? extends com.icodici.crypto.AbstractKey> keys) |
Check role is allowed to keys
|
boolean |
isValid() |
Check validity of role.
|
net.sergeych.tools.Binder |
serialize(net.sergeych.biserializer.BiSerializer s) |
|
java.lang.String |
toString() |
Get role as string.
|
addAllRequiredReferences, addRequiredReference, addRequiredReference, containReference, equalAddresses, equalAnonIds, equalKeys, equals, equalsIgnoreName, fromDslBinder, getAllAddresses, getComment, getContract, getName, getReferences, getSimpleAddress, getSpecialReferences, hashCode, isAllowedFor, isAllowedForKeys, isMatchingKeyAddress, isMatchingRole, linkAs, resolve, setComment, setContract
@Deprecated public SimpleRole(java.lang.String name, @NonNull KeyRecord keyRecord)
SimpleRole(String, Contract, KeyRecord)
insteadSimpleRole
and add one KeyRecord
associated with role.name
- is name of rolekeyRecord
- is KeyRecord
associated with rolepublic SimpleRole(java.lang.String name, Contract contract, @NonNull KeyRecord keyRecord)
SimpleRole
and add one KeyRecord
associated with role.name
- is name of rolekeyRecord
- is KeyRecord
associated with role@Deprecated public SimpleRole(java.lang.String name)
SimpleRole
. Keys or records to role may be added with addKeyRecord(KeyRecord)
.name
- is name of rolepublic SimpleRole(java.lang.String name, Contract contract)
SimpleRole
. Keys or records to role may be added with addKeyRecord(KeyRecord)
.name
- is name of role@Deprecated public SimpleRole(java.lang.String name, @NonNull java.util.Collection records)
SimpleRole(String, Contract, Collection)
insteadSimpleRole
. Records are initialized from the collection and can have the following types:
PublicKey
, PrivateKey
, KeyRecord
, KeyAddress
, AnonymousId
.name
- is name of rolerecords
- is collection of records to initialize rolepublic SimpleRole(java.lang.String name, Contract contract, @NonNull java.util.Collection records)
SimpleRole
. Records are initialized from the collection and can have the following types:
PublicKey
, PrivateKey
, KeyRecord
, KeyAddress
, AnonymousId
.name
- is name of rolerecords
- is collection of records to initialize rolepublic void addKeyRecord(KeyRecord keyRecord)
KeyRecord
to role.keyRecord
- is KeyRecord
@Deprecated public KeyRecord getKeyRecord()
getKeyRecord
in class Role
KeyRecord
@Deprecated public java.util.Set<KeyRecord> getKeyRecords()
getKeyRecords
in class Role
KeyRecord
)@Deprecated public java.util.Set<com.icodici.crypto.PublicKey> getKeys()
@Deprecated public java.util.Set<AnonymousId> getAnonymousIds()
getAnonymousIds
in class Role
AnonymousId
)@Deprecated public java.util.Set<com.icodici.crypto.KeyAddress> getKeyAddresses()
getKeyAddresses
in class Role
KeyAddress
)public java.util.Set<KeyRecord> getSimpleKeyRecords()
KeyRecord
)public java.util.Set<com.icodici.crypto.PublicKey> getSimpleKeys()
PublicKey
)public java.util.Set<AnonymousId> getSimpleAnonymousIds()
AnonymousId
)public java.util.Set<com.icodici.crypto.KeyAddress> getSimpleKeyAddresses()
KeyAddress
)public boolean isAllowedForKeysQuantized(java.util.Set<? extends com.icodici.crypto.AbstractKey> keys) throws Quantiser.QuantiserException
isAllowedForKeysQuantized
in class Role
keys
- is set of keysQuantiser.QuantiserException
public boolean isValid()
SimpleRole
contains keys, addresses or anonymous identifiers.protected boolean equalsIgnoreNameAndRefs(Role role)
equalsIgnoreNameAndRefs
in class Role
public void initWithDsl(net.sergeych.tools.Binder serializedRole)
initWithDsl
in class Role
serializedRole
- is Binder
from dsl with data of rolepublic SimpleRole cloneAs(java.lang.String name, Contract contract)
name
- is new name for the rolecontract
- is contract role will be cloned forSimpleRole
@Deprecated public SimpleRole cloneAs(java.lang.String name)
name
- is new name for the roleSimpleRole
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isAllowedForKeys(SimpleRole anotherRole) throws Quantiser.QuantiserException
SimpleRole
anotherRole
- is other SimpleRole
with keysSimpleRole
Quantiser.QuantiserException
public void deserialize(net.sergeych.tools.Binder data, net.sergeych.biserializer.BiDeserializer deserializer)
deserialize
in interface net.sergeych.biserializer.BiSerializable
deserialize
in class Role
public net.sergeych.tools.Binder serialize(net.sergeych.biserializer.BiSerializer s)
public void anonymize()
AnonymousId
.