Class: Privy::Resources::KeyQuorums

Inherits:
Object
  • Object
show all
Defined in:
lib/privy/resources/key_quorums.rb

Overview

Operations related to key quorums

Direct Known Subclasses

Services::KeyQuorums

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ KeyQuorums

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of KeyQuorums.

Parameters:



140
141
142
# File 'lib/privy/resources/key_quorums.rb', line 140

def initialize(client:)
  @client = client
end

Instance Method Details

#create(authorization_threshold: nil, display_name: nil, key_quorum_ids: nil, public_keys: nil, user_ids: nil, request_options: {}) ⇒ Privy::Models::KeyQuorum

Some parameter documentations has been truncated, see Models::KeyQuorumCreateParams for more details.

Create a new key quorum.

Parameters:

  • authorization_threshold (Float)

    The number of keys that must sign for an action to be valid. Must be less than o

  • display_name (String)
  • key_quorum_ids (Array<String>)

    List of key quorum IDs that should be members of this key quorum. Key quorums ca

  • public_keys (Array<String>)

    List of P-256 public keys of the keys that should be authorized to sign on the k

  • user_ids (Array<String>)

    List of user IDs of the users that should be authorized to sign on the key quoru

  • request_options (Privy::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



29
30
31
32
33
34
35
36
37
38
# File 'lib/privy/resources/key_quorums.rb', line 29

def create(params = {})
  parsed, options = Privy::KeyQuorumCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/key_quorums",
    body: parsed,
    model: Privy::KeyQuorum,
    options: options
  )
end

#delete(key_quorum_id, privy_authorization_signature: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::SuccessResponse

Some parameter documentations has been truncated, see Models::KeyQuorumDeleteParams for more details.

Delete a key quorum by key quorum ID.

Parameters:

  • key_quorum_id (String)

    A unique identifier for a key quorum.

  • privy_authorization_signature (String)

    Request authorization signature. If multiple signatures are required, they shoul

  • privy_request_expiry (String)

    Request expiry. Value is a Unix timestamp in milliseconds representing the deadl

  • request_options (Privy::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/privy/resources/key_quorums.rb', line 103

def delete(key_quorum_id, params = {})
  parsed, options = Privy::KeyQuorumDeleteParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["v1/key_quorums/%1$s", key_quorum_id],
    headers: parsed.transform_keys(
      privy_authorization_signature: "privy-authorization-signature",
      privy_request_expiry: "privy-request-expiry"
    ),
    model: Privy::SuccessResponse,
    options: options
  )
end

#get(key_quorum_id, request_options: {}) ⇒ Privy::Models::KeyQuorum

Get a key quorum by ID.

Parameters:

  • key_quorum_id (String)

    A unique identifier for a key quorum.

  • request_options (Privy::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



128
129
130
131
132
133
134
135
# File 'lib/privy/resources/key_quorums.rb', line 128

def get(key_quorum_id, params = {})
  @client.request(
    method: :get,
    path: ["v1/key_quorums/%1$s", key_quorum_id],
    model: Privy::KeyQuorum,
    options: params[:request_options]
  )
end

#update(key_quorum_id, authorization_threshold: nil, display_name: nil, key_quorum_ids: nil, public_keys: nil, user_ids: nil, privy_authorization_signature: nil, privy_request_expiry: nil, request_options: {}) ⇒ Privy::Models::KeyQuorum

Some parameter documentations has been truncated, see Models::KeyQuorumUpdateParams for more details.

Update a key quorum by key quorum ID.

Parameters:

  • key_quorum_id (String)

    Path param: A unique identifier for a key quorum.

  • authorization_threshold (Float)

    Body param: The number of keys that must sign for an action to be valid. Must be

  • display_name (String)

    Body param

  • key_quorum_ids (Array<String>)

    Body param: List of key quorum IDs that should be members of this key quorum. Ke

  • public_keys (Array<String>)

    Body param: List of P-256 public keys of the keys that should be authorized to s

  • user_ids (Array<String>)

    Body param: List of user IDs of the users that should be authorized to sign on t

  • privy_authorization_signature (String)

    Header param: Request authorization signature. If multiple signatures are requir

  • privy_request_expiry (String)

    Header param: Request expiry. Value is a Unix timestamp in milliseconds represen

  • request_options (Privy::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/privy/resources/key_quorums.rb', line 68

def update(key_quorum_id, params = {})
  parsed, options = Privy::KeyQuorumUpdateParams.dump_request(params)
  header_params =
    {
      privy_authorization_signature: "privy-authorization-signature",
      privy_request_expiry: "privy-request-expiry"
    }
  @client.request(
    method: :patch,
    path: ["v1/key_quorums/%1$s", key_quorum_id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Privy::KeyQuorum,
    options: options
  )
end