UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

507 lines • 11.8 kB
import { APIResource } from "../../../core/resource.mjs"; import { APIPromise } from "../../../core/api-promise.mjs"; import { RequestOptions } from "../../../internal/request-options.mjs"; export declare class BaseCredentials extends APIResource { static readonly _key: readonly ['tokenValidation', 'configuration', 'credentials']; /** * Replaces the configuration's complete key set. Symmetric keys must include their * key material. * * @example * ```ts * const credential = * await client.tokenValidation.configuration.credentials.update( * '4a7ee8d3-dd63-4ceb-9d5f-c27831854ce7', * { * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * keys: [ * { * alg: 'RS256', * e: 'e', * kid: 'kid', * kty: 'RSA', * n: 'n', * }, * ], * }, * ); * ``` */ update(configID: string, params: CredentialUpdateParams, options?: RequestOptions): APIPromise<CredentialUpdateResponse>; /** * Updates the configuration's complete key set while allowing omitted fields on * existing keys to retain stored values. Omitted key identities are removed. * * @example * ```ts * const response = * await client.tokenValidation.configuration.credentials.edit( * '4a7ee8d3-dd63-4ceb-9d5f-c27831854ce7', * { * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * keys: [ * { * alg: 'RS256', * e: 'e', * kid: 'kid', * kty: 'RSA', * n: 'n', * }, * ], * }, * ); * ``` */ edit(configID: string, params: CredentialEditParams, options?: RequestOptions): APIPromise<CredentialEditResponse>; } export declare class Credentials extends BaseCredentials { } export interface CredentialUpdateResponse { keys: Array<CredentialUpdateResponse.APIShieldCredentialsJWTKeyRSA | CredentialUpdateResponse.APIShieldCredentialsJWTKeyEcEs256 | CredentialUpdateResponse.APIShieldCredentialsJWTKeyEcEs384 | CredentialUpdateResponse.APIShieldCredentialsJWTKeyOctResponse>; } export declare namespace CredentialUpdateResponse { /** * JSON representation of an RSA key. */ interface APIShieldCredentialsJWTKeyRSA { /** * Algorithm */ alg: 'RS256' | 'RS384' | 'RS512' | 'PS256' | 'PS384' | 'PS512'; /** * RSA exponent */ e: string; /** * Key ID */ kid: string; /** * Key Type */ kty: 'RSA'; /** * RSA modulus */ n: string; } /** * JSON representation of an ES256 key */ interface APIShieldCredentialsJWTKeyEcEs256 { /** * Algorithm */ alg: 'ES256'; /** * Curve */ crv: 'P-256'; /** * Key ID */ kid: string; /** * Key Type */ kty: 'EC'; /** * X EC coordinate */ x: string; /** * Y EC coordinate */ y: string; } /** * JSON representation of an ES384 key */ interface APIShieldCredentialsJWTKeyEcEs384 { /** * Algorithm */ alg: 'ES384'; /** * Curve */ crv: 'P-384'; /** * Key ID */ kid: string; /** * Key Type */ kty: 'EC'; /** * X EC coordinate */ x: string; /** * Y EC coordinate */ y: string; } /** * JSON representation of a symmetric verification key in API responses (secret * material is redacted). */ interface APIShieldCredentialsJWTKeyOctResponse { /** * Algorithm */ alg: 'HS256' | 'HS384' | 'HS512'; /** * Key ID */ kid: string; /** * Key Type */ kty: 'oct'; } } export interface CredentialEditResponse { keys: Array<CredentialEditResponse.APIShieldCredentialsJWTKeyRSA | CredentialEditResponse.APIShieldCredentialsJWTKeyEcEs256 | CredentialEditResponse.APIShieldCredentialsJWTKeyEcEs384 | CredentialEditResponse.APIShieldCredentialsJWTKeyOctResponse>; } export declare namespace CredentialEditResponse { /** * JSON representation of an RSA key. */ interface APIShieldCredentialsJWTKeyRSA { /** * Algorithm */ alg: 'RS256' | 'RS384' | 'RS512' | 'PS256' | 'PS384' | 'PS512'; /** * RSA exponent */ e: string; /** * Key ID */ kid: string; /** * Key Type */ kty: 'RSA'; /** * RSA modulus */ n: string; } /** * JSON representation of an ES256 key */ interface APIShieldCredentialsJWTKeyEcEs256 { /** * Algorithm */ alg: 'ES256'; /** * Curve */ crv: 'P-256'; /** * Key ID */ kid: string; /** * Key Type */ kty: 'EC'; /** * X EC coordinate */ x: string; /** * Y EC coordinate */ y: string; } /** * JSON representation of an ES384 key */ interface APIShieldCredentialsJWTKeyEcEs384 { /** * Algorithm */ alg: 'ES384'; /** * Curve */ crv: 'P-384'; /** * Key ID */ kid: string; /** * Key Type */ kty: 'EC'; /** * X EC coordinate */ x: string; /** * Y EC coordinate */ y: string; } /** * JSON representation of a symmetric verification key in API responses (secret * material is redacted). */ interface APIShieldCredentialsJWTKeyOctResponse { /** * Algorithm */ alg: 'HS256' | 'HS384' | 'HS512'; /** * Key ID */ kid: string; /** * Key Type */ kty: 'oct'; } } export interface CredentialUpdateParams { /** * Path param: Identifier. */ zone_id: string; /** * Body param */ keys: Array<CredentialUpdateParams.APIShieldCredentialsJWTKeyRSA | CredentialUpdateParams.APIShieldCredentialsJWTKeyEcEs256 | CredentialUpdateParams.APIShieldCredentialsJWTKeyEcEs384 | CredentialUpdateParams.APIShieldCredentialsJWTKeyOctRequest>; } export declare namespace CredentialUpdateParams { /** * JSON representation of an RSA key. */ interface APIShieldCredentialsJWTKeyRSA { /** * Algorithm */ alg: 'RS256' | 'RS384' | 'RS512' | 'PS256' | 'PS384' | 'PS512'; /** * RSA exponent */ e: string; /** * Key ID */ kid: string; /** * Key Type */ kty: 'RSA'; /** * RSA modulus */ n: string; } /** * JSON representation of an ES256 key */ interface APIShieldCredentialsJWTKeyEcEs256 { /** * Algorithm */ alg: 'ES256'; /** * Curve */ crv: 'P-256'; /** * Key ID */ kid: string; /** * Key Type */ kty: 'EC'; /** * X EC coordinate */ x: string; /** * Y EC coordinate */ y: string; } /** * JSON representation of an ES384 key */ interface APIShieldCredentialsJWTKeyEcEs384 { /** * Algorithm */ alg: 'ES384'; /** * Curve */ crv: 'P-384'; /** * Key ID */ kid: string; /** * Key Type */ kty: 'EC'; /** * X EC coordinate */ x: string; /** * Y EC coordinate */ y: string; } /** * JSON representation of a symmetric key for create/PUT requests. */ interface APIShieldCredentialsJWTKeyOctRequest { /** * Algorithm */ alg: 'HS256' | 'HS384' | 'HS512'; /** * Symmetric key material. Required for create and PUT update requests. */ k: string; /** * Key ID */ kid: string; /** * Key Type */ kty: 'oct'; } } export interface CredentialEditParams { /** * Path param: Identifier. */ zone_id: string; /** * Body param */ keys: Array<CredentialEditParams.APIShieldCredentialsJWTKeyRSA | CredentialEditParams.APIShieldCredentialsJWTKeyEcEs256 | CredentialEditParams.APIShieldCredentialsJWTKeyEcEs384 | CredentialEditParams.APIShieldCredentialsJWTKeyOctPatchRequest>; } export declare namespace CredentialEditParams { /** * JSON representation of an RSA key. */ interface APIShieldCredentialsJWTKeyRSA { /** * Algorithm */ alg: 'RS256' | 'RS384' | 'RS512' | 'PS256' | 'PS384' | 'PS512'; /** * RSA exponent */ e: string; /** * Key ID */ kid: string; /** * Key Type */ kty: 'RSA'; /** * RSA modulus */ n: string; } /** * JSON representation of an ES256 key */ interface APIShieldCredentialsJWTKeyEcEs256 { /** * Algorithm */ alg: 'ES256'; /** * Curve */ crv: 'P-256'; /** * Key ID */ kid: string; /** * Key Type */ kty: 'EC'; /** * X EC coordinate */ x: string; /** * Y EC coordinate */ y: string; } /** * JSON representation of an ES384 key */ interface APIShieldCredentialsJWTKeyEcEs384 { /** * Algorithm */ alg: 'ES384'; /** * Curve */ crv: 'P-384'; /** * Key ID */ kid: string; /** * Key Type */ kty: 'EC'; /** * X EC coordinate */ x: string; /** * Y EC coordinate */ y: string; } /** * JSON representation of a symmetric key for PATCH requests. */ interface APIShieldCredentialsJWTKeyOctPatchRequest { /** * Algorithm */ alg: 'HS256' | 'HS384' | 'HS512'; /** * Key ID */ kid: string; /** * Key Type */ kty: 'oct'; /** * Symmetric key material. Optional for PATCH: omit to preserve existing secret for * matching `{alg,kid}`; send a string to rotate. `k: null` is invalid. */ k?: string; } } export declare namespace Credentials { export { type CredentialUpdateResponse as CredentialUpdateResponse, type CredentialEditResponse as CredentialEditResponse, type CredentialUpdateParams as CredentialUpdateParams, type CredentialEditParams as CredentialEditParams, }; } //# sourceMappingURL=credentials.d.mts.map