Skip to content

Commit 16398e6

Browse files
documentation.
1 parent e2cec3a commit 16398e6

File tree

1 file changed

+16
-0
lines changed
  • onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract

1 file changed

+16
-0
lines changed

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/SignatureData.kt

+16
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,27 @@ import java.util.*
2020
data class SignatureData(private val content: ByteArray, private val signature: DigitalSignature) {
2121

2222
companion object {
23+
24+
/**
25+
* Creates a signature from the specified content and private key.
26+
*
27+
* @param content The content to sign.
28+
* @param privateKey The private key to sign the content.
29+
* @return Returns a new signature containing the content and signed data.
30+
*/
2331
fun create(content: ByteArray, privateKey: PrivateKey): SignatureData {
2432
val signature = privateKey.sign(content)
2533
return SignatureData(content, signature)
2634
}
2735

36+
/**
37+
* Creates a signature from the specified content by resolving the signing key from the service hub.
38+
*
39+
* @param content The content to sign.
40+
* @param publicKey The public key to resolve from the service hub.
41+
* @param serviceHub The service hub to resolve the public key.
42+
* @return Returns a new signature containing the content and signed data.
43+
*/
2844
fun create(content: ByteArray, publicKey: PublicKey, serviceHub: ServiceHub): SignatureData {
2945
val signature = serviceHub.keyManagementService.sign(content, publicKey)
3046
return SignatureData(content, signature.withoutKey())

0 commit comments

Comments
 (0)