congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Contract.anonymizeRole
Code IndexAdd Tabnine to your IDE (free)

How to use
anonymizeRole
method
in
com.icodici.universa.contract.Contract

Best Java code snippets using com.icodici.universa.contract.Contract.anonymizeRole (Showing top 2 results out of 315)

origin: UniversaBlockchain/universa

private static void doAnonymize() throws IOException {
  List<String> sources = new ArrayList<String>((List) options.valuesOf("anonymize"));
  List<String> roles = new ArrayList<String>((List) options.valuesOf("role"));
  List<String> names = (List) options.valuesOf("output");
  List<String> nonOptions = new ArrayList<String>((List) options.nonOptionArguments());
  for (String opt : nonOptions) {
    sources.addAll(asList(opt.split(",")));
  }
  cleanNonOptionalArguments(sources);
  for (int s = 0; s < sources.size(); s++) {
    String source = sources.get(s);
    Contract contract = loadContract(source);
    if (contract != null) {
      if(roles.size() <= 0) {
        roles = new ArrayList<>(contract.getRoles().keySet());
      }
      for (String roleName : roles) {
        report("Anonymizing role " + roleName + " in " + source + "...");
        contract.anonymizeRole(roleName);
        contract.seal();
      }
      if (names.size() > s) {
        saveContract(contract, names.get(s), true, false);
      } else {
        saveContract(contract, new FilenameTool(source).addSuffixToBase("_anonymized").toString(), true, false);
      }
    }
  }
  finish();
}
origin: UniversaBlockchain/universa

  @Test
  public void checkAnonymizingRole() throws Exception {

    PrivateKey key = new PrivateKey(Do.read(PRIVATE_KEY_PATH));
    Contract contract = createCoin100apiv3();
    contract.addSignerKey(key);
    sealCheckTrace(contract, true);

    assertTrue(contract.getIssuer().getKeys().contains(key.getPublicKey()));

    contract.anonymizeRole("issuer");
    contract.anonymizeRole("owner");
    contract.seal();

    assertFalse(contract.getIssuer().getKeys().contains(key.getPublicKey()));

    Contract anonPublishedContract = new Contract(contract.getLastSealedBinary());

    assertFalse(anonPublishedContract.getIssuer().getKeys().contains(key.getPublicKey()));
//        assertFalse(anonPublishedContract.getSealedByKeys().contains(key.getPublicKey()));
  }

com.icodici.universa.contractContractanonymizeRole

Javadoc

Anonymize existing role. If role contains PublicKey it will be replaced with AnonymousId

Popular methods of Contract

  • <init>
    Extract old, deprecated v2 self-contained binary partially unpacked by the TransactionPack, and fill
  • addNewItems
    Add one or more siblings to the contract. Note that those must be sealed before calling #seal() or #
  • addSignerKey
    Add private key to keys contract binary to be signed with when sealed next time. It is called before
  • getExpiresAt
    Get contract expiration time
  • getId
    Get the id sealing self if need
  • getPackedTransaction
    Pack the contract to the most modern .unicon format, same as TransactionPack#pack(). Uses bounded Tr
  • registerRole
    Register new role. Name must be unique otherwise existing role will be overwritten
  • seal
    Seal contract to binary. This call adds signatures from #getKeysToSignWith()
  • addSignatureToSeal
    Add signature to sealed (before) contract. Do not deserializing or changing contract bytes, but will
  • check
  • createRevision
    Create new revision to be changed, signed sealed and then ready to approve. Created "revision" contr
  • fromDslFile
    Create contract importing its parameters with passed .yaml file. No signatures are added automatical
  • createRevision,
  • fromDslFile,
  • fromPackedTransaction,
  • getCreatedAt,
  • getDefinition,
  • getErrors,
  • getKeysToSignWith,
  • getLastSealedBinary,
  • getNew,
  • getNewItems

Popular in Java

  • Reactive rest calls using spring rest template
  • getApplicationContext (Context)
  • getSharedPreferences (Context)
  • getSystemService (Context)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Table (org.hibernate.mapping)
    A relational table
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now