CompositeKey.Builder
Keywords: net.corda.core.crypto.CompositeKey.Builder class
Date: 2023-09-18

net.corda.core.crypto

## Class CompositeKey.Builder

- net.corda.core.crypto.CompositeKey.Builder

- Enclosing class:
    CompositeKey

      public static class CompositeKey.Builder

  A helper class for building a `class CompositeKey`.

  See Also:
    `class CompositeKey`

- - ### Constructor Detail

    - #### Builder

          public Builder()

      A helper class for building a `class CompositeKey`.

      See Also:
        `class CompositeKey`

  - ### Method Detail

    - #### addKey

          @NotNull
          public net.corda.core.crypto.CompositeKey.Builder addKey(@NotNull
                                                                            java.security.PublicKey key,
                                                                            int weight)

      Adds a child `class CompositeKey` node. Specifying a `weight` for the child is optional and will default to 1.

      See Also:
        `class CompositeKey`, `weight`

    - #### addKeys

          @NotNull
          public net.corda.core.crypto.CompositeKey.Builder addKeys(@NotNull
                                                                             java.security.PublicKey... keys)

    - #### addKeys

          @NotNull
          public net.corda.core.crypto.CompositeKey.Builder addKeys(@NotNull
                                                                             java.util.List<? extends java.security.PublicKey> keys)

    - #### build

          @NotNull
          public java.security.PublicKey build(@Nullable
                                                        java.lang.Integer threshold)

      Builds the `class CompositeKey`. If `threshold` is not specified, it will default to the total (aggregated) weight of the children, effectively generating an "N of N" requirement. During process removes single keys wrapped in `class CompositeKey` and enforces ordering on child nodes.

      Parameters:
        `threshold` - specifies the minimum total weight required (in the simple case – the minimum number of childsignatures required) to satisfy the sub-tree rooted at this node.
      Throws:
        `IllegalArgumentException` - if the threshold value is invalid.
        `IllegalStateException` - if the composite key that would be generated from the current state of the builder is invalid (for example it would contain no keys).
      See Also:
        `class CompositeKey`, `threshold`, `class CompositeKey`