Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ qn.admin.delete_token("ep-123", "tok-1").await?;

Whitelists a referrer URL or domain on an endpoint.

**Parameters**: `id` (endpoint id, required); body: `referrer` (string, optional).
**Parameters**: `id` (endpoint id, required); body: `referrer` (string, required).

**Returns**: nothing.

Expand Down Expand Up @@ -599,7 +599,7 @@ qn.admin.delete_referrer("ep-123", "ref-1").await?;

Whitelists an IP address on an endpoint.

**Parameters**: `id` (endpoint id, required); body: `ip` (string, optional).
**Parameters**: `id` (endpoint id, required); body: `ip` (string, required).

**Returns**: nothing.

Expand Down Expand Up @@ -659,7 +659,7 @@ qn.admin.delete_domain_mask("ep-123", "dm-1").await?;

Configures JWT validation on an endpoint.

**Parameters**: `id` (endpoint id, required); body: `public_key` (string, optional), `kid` (string, required), `name` (string, optional).
**Parameters**: `id` (endpoint id, required); body: `public_key` (string, required), `kid` (string, required), `name` (string, required).

**Returns**: nothing.

Expand Down Expand Up @@ -692,7 +692,7 @@ Whitelist specific RPC methods on an endpoint. Requests for methods not on the l

##### `create_request_filter` / `createRequestFilter`

**Parameters**: `id` (endpoint id, required); body: `method` (string[], optional). Ruby's Hash key is `methods` (plural).
**Parameters**: `id` (endpoint id, required); body: `method` (string[], required). Ruby's Hash key is `methods` (plural).

**Returns**: `CreateRequestFilterResponse` with `data.id`.

Expand Down
13 changes: 6 additions & 7 deletions crates/core/examples/admin_e2e.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ async fn main() {
.create_referrer(
&endpoint_id,
&CreateReferrerRequest {
referrer: Some("https://example.com".to_string()),
referrer: "https://example.com".to_string(),
},
)
.await
Expand Down Expand Up @@ -378,7 +378,7 @@ async fn main() {
.create_ip(
&endpoint_id,
&CreateIpRequest {
ip: Some("192.0.2.1".to_string()),
ip: "192.0.2.1".to_string(),
},
)
.await
Expand Down Expand Up @@ -452,11 +452,10 @@ async fn main() {
.create_jwt(
&endpoint_id,
&CreateJwtRequest {
public_key: Some(
"-----BEGIN PUBLIC KEY-----\nPLACEHOLDER\n-----END PUBLIC KEY-----".to_string(),
),
public_key: "-----BEGIN PUBLIC KEY-----\nPLACEHOLDER\n-----END PUBLIC KEY-----"
.to_string(),
kid: "kid1".to_string(),
name: Some("example-jwt".to_string()),
name: "example-jwt".to_string(),
},
)
.await
Expand Down Expand Up @@ -492,7 +491,7 @@ async fn main() {
.create_request_filter(
&endpoint_id,
&CreateRequestFilterRequest {
method: Some(vec!["eth_getBalance".to_string()]),
method: vec!["eth_getBalance".to_string()],
},
)
.await
Expand Down
15 changes: 5 additions & 10 deletions crates/core/src/admin/endpoint_security.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ pub struct UpdateSecurityOptionsResponse {
#[derive(Debug, Clone, Default, Serialize)]
pub struct CreateReferrerRequest {
/// Allowed referrer URL or domain.
#[serde(skip_serializing_if = "Option::is_none")]
pub referrer: Option<String>,
pub referrer: String,
}

/// Parameters for `create_ip`.
Expand All @@ -116,8 +115,7 @@ pub struct CreateReferrerRequest {
#[derive(Debug, Clone, Default, Serialize)]
pub struct CreateIpRequest {
/// IP address to whitelist.
#[serde(skip_serializing_if = "Option::is_none")]
pub ip: Option<String>,
pub ip: String,
}

/// Parameters for `create_domain_mask`.
Expand All @@ -140,13 +138,11 @@ pub struct CreateDomainMaskRequest {
#[derive(Debug, Clone, Default, Serialize)]
pub struct CreateJwtRequest {
/// Public key used to verify signed JWTs.
#[serde(skip_serializing_if = "Option::is_none")]
pub public_key: Option<String>,
pub public_key: String,
/// Key identifier (`kid`) embedded in JWT headers.
pub kid: String,
/// Human-readable name for the JWT configuration.
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
pub name: String,
}

/// Parameters for `create_request_filter`.
Expand All @@ -157,8 +153,7 @@ pub struct CreateJwtRequest {
#[derive(Debug, Clone, Default, Serialize)]
pub struct CreateRequestFilterRequest {
/// Whitelisted RPC methods; other methods will be blocked.
#[serde(skip_serializing_if = "Option::is_none")]
pub method: Option<Vec<String>>,
pub method: Vec<String>,
}

/// Response from `create_request_filter`.
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/admin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2548,7 +2548,7 @@ mod tests {
.create_referrer(
"ep123",
&CreateReferrerRequest {
referrer: Some("example.com".to_string()),
referrer: "example.com".to_string(),
},
)
.await
Expand Down
14 changes: 5 additions & 9 deletions crates/python/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,12 @@ impl AdminApiClient {

/// Adds a referrer to an endpoint's security settings, specifying which
/// external URL or domain is permitted to call the endpoint.
#[pyo3(signature = (id, referrer=None))]
#[gen_stub(override_return_type(type_repr = "typing.Coroutine[typing.Any, typing.Any, None]"))]
fn create_referrer<'py>(
&self,
py: Python<'py>,
id: String,
referrer: Option<String>,
referrer: String,
) -> PyResult<Bound<'py, PyAny>> {
let client = self.inner.clone();
let params = core::admin::CreateReferrerRequest { referrer };
Expand Down Expand Up @@ -588,13 +587,12 @@ impl AdminApiClient {
}

/// Adds an IP address to an endpoint's security whitelist.
#[pyo3(signature = (id, ip=None))]
#[gen_stub(override_return_type(type_repr = "typing.Coroutine[typing.Any, typing.Any, None]"))]
fn create_ip<'py>(
&self,
py: Python<'py>,
id: String,
ip: Option<String>,
ip: String,
) -> PyResult<Bound<'py, PyAny>> {
let client = self.inner.clone();
let params = core::admin::CreateIpRequest { ip };
Expand Down Expand Up @@ -667,15 +665,14 @@ impl AdminApiClient {

/// Creates a new JWT for endpoint authentication. Accepts a public key,
/// key id (`kid`), and token name.
#[pyo3(signature = (id, kid, public_key=None, name=None))]
#[gen_stub(override_return_type(type_repr = "typing.Coroutine[typing.Any, typing.Any, None]"))]
fn create_jwt<'py>(
&self,
py: Python<'py>,
id: String,
kid: String,
public_key: Option<String>,
name: Option<String>,
public_key: String,
name: String,
) -> PyResult<Bound<'py, PyAny>> {
let client = self.inner.clone();
let params = core::admin::CreateJwtRequest {
Expand Down Expand Up @@ -712,15 +709,14 @@ impl AdminApiClient {
/// Creates a request filter on an endpoint — a method whitelist that
/// restricts which RPC methods may be called. Accepts an array of method
/// names; other methods are blocked.
#[pyo3(signature = (id, method=None))]
#[gen_stub(override_return_type(
type_repr = "typing.Coroutine[typing.Any, typing.Any, CreateRequestFilterResponse]"
))]
fn create_request_filter<'py>(
&self,
py: Python<'py>,
id: String,
method: Option<Vec<String>>,
method: Vec<String>,
) -> PyResult<Bound<'py, PyAny>> {
let client = self.inner.clone();
let params = core::admin::CreateRequestFilterRequest { method };
Expand Down
10 changes: 5 additions & 5 deletions crates/ruby/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ impl AdminApiClient {
let client = self.inner.clone();
let id = hash_require_string(&opts, "id")?;
let params = core::admin::CreateReferrerRequest {
referrer: hash_get_string(&opts, "referrer")?,
referrer: hash_require_string(&opts, "referrer")?,
};
runtime()
.block_on(client.create_referrer(&id, &params))
Expand All @@ -624,7 +624,7 @@ impl AdminApiClient {
let client = self.inner.clone();
let id = hash_require_string(&opts, "id")?;
let params = core::admin::CreateIpRequest {
ip: hash_get_string(&opts, "ip")?,
ip: hash_require_string(&opts, "ip")?,
};
runtime()
.block_on(client.create_ip(&id, &params))
Expand Down Expand Up @@ -670,9 +670,9 @@ impl AdminApiClient {
let client = self.inner.clone();
let id = hash_require_string(&opts, "id")?;
let params = core::admin::CreateJwtRequest {
public_key: hash_get_string(&opts, "public_key")?,
public_key: hash_require_string(&opts, "public_key")?,
kid: hash_require_string(&opts, "kid")?,
name: hash_get_string(&opts, "name")?,
name: hash_require_string(&opts, "name")?,
};
runtime()
.block_on(client.create_jwt(&id, &params))
Expand All @@ -694,7 +694,7 @@ impl AdminApiClient {
let client = self.inner.clone();
let id = hash_require_string(&opts, "id")?;
let params = core::admin::CreateRequestFilterRequest {
method: hash_get_vec_string(&opts, "methods")?,
method: hash_require_vec_string(&opts, "methods")?,
};
runtime()
.block_on(client.create_request_filter(&id, &params))
Expand Down
8 changes: 4 additions & 4 deletions npm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ await qn.admin.deleteToken("ep-123", "tok-1");

Whitelists a referrer URL or domain on an endpoint.

**Parameters**: `id` (endpoint id, required); body: `referrer` (string, optional).
**Parameters**: `id` (endpoint id, required); body: `referrer` (string, required).

**Returns**: nothing.

Expand Down Expand Up @@ -581,7 +581,7 @@ await qn.admin.deleteReferrer("ep-123", "ref-1");

Whitelists an IP address on an endpoint.

**Parameters**: `id` (endpoint id, required); body: `ip` (string, optional).
**Parameters**: `id` (endpoint id, required); body: `ip` (string, required).

**Returns**: nothing.

Expand Down Expand Up @@ -637,7 +637,7 @@ await qn.admin.deleteDomainMask("ep-123", "dm-1");

Configures JWT validation on an endpoint.

**Parameters**: `id` (endpoint id, required); body: `public_key` (string, optional), `kid` (string, required), `name` (string, optional).
**Parameters**: `id` (endpoint id, required); body: `public_key` (string, required), `kid` (string, required), `name` (string, required).

**Returns**: nothing.

Expand Down Expand Up @@ -669,7 +669,7 @@ Whitelist specific RPC methods on an endpoint. Requests for methods not on the l

##### `create_request_filter` / `createRequestFilter`

**Parameters**: `id` (endpoint id, required); body: `method` (string[], optional). Ruby's Hash key is `methods` (plural).
**Parameters**: `id` (endpoint id, required); body: `method` (string[], required). Ruby's Hash key is `methods` (plural).

**Returns**: `CreateRequestFilterResponse` with `data.id`.

Expand Down
10 changes: 5 additions & 5 deletions npm/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,17 @@ export interface CreateEndpointResponse {
/** Parameters for `create_ip`. */
export interface CreateIpRequest {
/** IP address to whitelist. */
ip?: string
ip: string
}

/** Parameters for `create_jwt`. */
export interface CreateJwtRequest {
/** Public key used to verify signed JWTs. */
publicKey?: string
publicKey: string
/** Key identifier (`kid`) embedded in JWT headers. */
kid: string
/** Human-readable name for the JWT configuration. */
name?: string
name: string
}

/** Parameters for `create_list`. */
Expand Down Expand Up @@ -290,7 +290,7 @@ export interface CreateOrUpdateIpCustomHeaderResponse {
/** Parameters for `create_referrer`. */
export interface CreateReferrerRequest {
/** Allowed referrer URL or domain. */
referrer?: string
referrer: string
}

/** Data wrapper for a created request filter. */
Expand All @@ -302,7 +302,7 @@ export interface CreateRequestFilterData {
/** Parameters for `create_request_filter`. */
export interface CreateRequestFilterRequest {
/** Whitelisted RPC methods; other methods will be blocked. */
method?: Array<string>
method: Array<string>
}

/** Response from `create_request_filter`. */
Expand Down
8 changes: 4 additions & 4 deletions python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ await qn.admin.delete_token("ep-123", "tok-1")

Whitelists a referrer URL or domain on an endpoint.

**Parameters**: `id` (endpoint id, required); body: `referrer` (string, optional).
**Parameters**: `id` (endpoint id, required); body: `referrer` (string, required).

**Returns**: nothing.

Expand Down Expand Up @@ -584,7 +584,7 @@ await qn.admin.delete_referrer("ep-123", "ref-1")

Whitelists an IP address on an endpoint.

**Parameters**: `id` (endpoint id, required); body: `ip` (string, optional).
**Parameters**: `id` (endpoint id, required); body: `ip` (string, required).

**Returns**: nothing.

Expand Down Expand Up @@ -640,7 +640,7 @@ await qn.admin.delete_domain_mask("ep-123", "dm-1")

Configures JWT validation on an endpoint.

**Parameters**: `id` (endpoint id, required); body: `public_key` (string, optional), `kid` (string, required), `name` (string, optional).
**Parameters**: `id` (endpoint id, required); body: `public_key` (string, required), `kid` (string, required), `name` (string, required).

**Returns**: nothing.

Expand Down Expand Up @@ -673,7 +673,7 @@ Whitelist specific RPC methods on an endpoint. Requests for methods not on the l

##### `create_request_filter` / `createRequestFilter`

**Parameters**: `id` (endpoint id, required); body: `method` (string[], optional). Ruby's Hash key is `methods` (plural).
**Parameters**: `id` (endpoint id, required); body: `method` (string[], required). Ruby's Hash key is `methods` (plural).

**Returns**: `CreateRequestFilterResponse` with `data.id`.

Expand Down
Loading
Loading