use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.
the class GuidedTourRemoteSuite method topLevelHederaKeyMustBeActive.
private HapiApiSpec topLevelHederaKeyMustBeActive() {
KeyShape waclShape = listOf(SIMPLE, threshOf(2, 3));
SigControl updateSigControl = waclShape.signedWith(sigs(ON, sigs(ON, OFF, OFF)));
return customHapiSpec("TopLevelListBehavesAsRevocationService").withProperties(Map.of("host", "34.74.191.8")).given().when().then(fileCreate("target").waclShape(waclShape).sigControl(ControlForKey.forKey("target", updateSigControl)).hasKnownStatus(INVALID_SIGNATURE));
}
use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.
the class SubmitMessageSuite method messageSubmissionWithSubmitKey.
private HapiApiSpec messageSubmissionWithSubmitKey() {
KeyShape submitKeyShape = threshOf(2, SIMPLE, SIMPLE, listOf(2));
SigControl validSig = submitKeyShape.signedWith(sigs(ON, OFF, sigs(ON, ON)));
SigControl invalidSig = submitKeyShape.signedWith(sigs(ON, OFF, sigs(ON, OFF)));
return defaultHapiSpec("messageSubmissionWithSubmitKey").given(newKeyNamed("submitKey").shape(submitKeyShape), createTopic("testTopic").submitKeyName("submitKey")).when().then(submitMessageTo("testTopic").sigControl(forKey("testTopicSubmit", invalidSig)).hasRetryPrecheckFrom(BUSY).hasKnownStatus(INVALID_SIGNATURE), submitMessageTo("testTopic").sigControl(forKey("testTopicSubmit", validSig)).hasRetryPrecheckFrom(BUSY).hasKnownStatus(SUCCESS));
}
use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.
the class NewSpecKeyList method submitOp.
@Override
protected boolean submitOp(HapiApiSpec spec) throws Throwable {
List<Key> childKeys = keys.stream().map(spec.registry()::getKey).collect(toList());
Key newList = Key.newBuilder().setKeyList(KeyList.newBuilder().addAllKeys(childKeys)).build();
spec.registry().saveKey(name, newList);
SigControl[] childControls = childKeys.stream().map(spec.keys()::controlFor).toArray(SigControl[]::new);
spec.keys().setControl(newList, SigControl.listSigs(childControls));
return false;
}
use of com.hedera.services.bdd.spec.keys.SigControl in project hedera-services by hashgraph.
the class ValidationScenarios method novelFileIfDesired.
private static HapiSpecOperation[] novelFileIfDesired() {
if (!params.isNovelContent()) {
return new HapiSpecOperation[0];
}
KeyShape firstComplex = KeyShape.listOf(KeyShape.threshOf(2, 3), KeyShape.threshOf(1, 3));
KeyShape secondComplex = KeyShape.listOf(3);
SigControl normalDelete = secondComplex.signedWith(KeyShape.sigs(ON, ON, ON));
SigControl revocation = secondComplex.signedWith(KeyShape.sigs(ON, OFF, OFF));
return new HapiSpecOperation[] { newKeyNamed("novelFileFirstKey").shape(firstComplex), newKeyNamed("novelFileSecondKey").shape(secondComplex), fileCreate(NOVEL_FILE_NAME).payingWith(SCENARIO_PAYER_NAME).setNodeFrom(ValidationScenarios::nextNode).key("novelFileFirstKey").contents("abcdefghijklm"), fileAppend(NOVEL_FILE_NAME).payingWith(SCENARIO_PAYER_NAME).setNodeFrom(ValidationScenarios::nextNode).content("nopqrstuvwxyz"), getFileContents(NOVEL_FILE_NAME).payingWith(SCENARIO_PAYER_NAME).setNodeFrom(ValidationScenarios::nextNode).hasContents(ignore -> "abcdefghijklmnopqrstuvwxyz".getBytes()), fileUpdate(NOVEL_FILE_NAME).payingWith(SCENARIO_PAYER_NAME).setNodeFrom(ValidationScenarios::nextNode).wacl("novelFileSecondKey"), fileDelete(NOVEL_FILE_NAME).payingWith(SCENARIO_PAYER_NAME).setNodeFrom(ValidationScenarios::nextNode).sigControl(ControlForKey.forKey(NOVEL_FILE_NAME, params.isRevocationService() ? revocation : normalDelete)), withOpContext((spec, opLog) -> novelFileUsed.set(HapiPropertySource.asFileString(spec.registry().getFileId(NOVEL_FILE_NAME)))) };
}
Aggregations