UNPKG

@c8y/client

Version:

Client application programming interface to access the Cumulocity IoT-Platform REST services.

176 lines 6.12 kB
import { IResult, Service } from '../core/index.js'; import { ITrustedCertificate } from './ITrustedCertificate.js'; /** * This class allows for managing trusted certificates. */ export declare class TrustedCertificateService extends Service<ITrustedCertificate> { protected get baseUrl(): string; protected listUrl: string; protected proofOfPossessionUrl: string; protected certificateAuthorityUrl: string; protected propertyName: string; /** * Gets a list of trusted certificates. * * @returns Response wrapped in [[IResultList]]. * * **Example** * ```typescript * * (async () => { * const {data, res} = await trustedCertificateService.list(); * })(); * ``` */ list(filter?: object): Promise<import("../core/IResultList.js").IResultList<ITrustedCertificate>>; /** * Gets the details of trusted certificate * * @param entityOrId Trusted certificate object or trusted certificate fingerprint. * * @returns Response wrapped in [[IResult]] * * **Example** * ```typescript * * const fingerprint: string = 'abc'; * * (async () => { * const {data, res} = await trustedCertificateService.detail(fingerprint); * })(); * ``` */ detail(entityOrId: string | ITrustedCertificate): Promise<IResult<ITrustedCertificate>>; /** * Removes a trusted certificate with given fingerprint. * * @returns Response wrapped in [[IResult]] * * @param entityOrId Trusted certificate object or trusted certificate fingerprint. * * **Example** * ```typescript * * const fingerprint: string = 'abc'; * * (async () => { * const {data, res} = await trustedCertificateService.delete(fingerprint); * })(); * ``` */ delete(entityOrId: string | ITrustedCertificate): Promise<IResult<null>>; /** * Updates trusted certificate data. * * @param entity Trusted certificate partial object. * * @returns Response wrapped in [[IResult]] * * **Example** * ```typescript * * const certificate: Partial<ITrustedCertificate> = { * name: 'Name' * }; * * (async () => { * const {data, res} = await trustedCertificateService.update(certificate); * })(); * ``` */ update(entity: Partial<ITrustedCertificate>): Promise<IResult<ITrustedCertificate>>; /** * Creates a new trusted certificate. * * @param entity Trusted certificate object. * * @returns Response wrapped in [[IResult]] * * **Example** * ```typescript * * const certificate: Partial<ITrustedCertificate> = { * name: 'Name', * certInPemFormat: 'MIID+DCCAuCgAwIBAgIJAO1Q9t/M9gYlMA0GC...', * status: 'ENABLED' * }; * * (async () => { * const {data, res} = await trustedCertificateService.create(certificate); * })(); * ``` */ create(entity: Partial<ITrustedCertificate>): Promise<IResult<ITrustedCertificate>>; /** * Regenerates unsigned verification code for trusted certificate. * * * @param entityOrId Trusted certificate object or finger print. * * @returns Certificate object with new verification code (wrapped in [[IResult]]) * * **Example** * ```typescript * * (async () => { * const fingerPrint = '00a360973e3e8d61e05aedb32c72438e2442279e'; * const {data, res} = await trustedCertificateService.regeneratePoPVerificationCode(fingerPrint); * const newProofOfPossessionUnsignedVerificationCode = data.proofOfPossessionUnsignedVerificationCode; * })(); * ``` */ regeneratePoPVerificationCode(entityOrId: string | ITrustedCertificate): Promise<IResult<ITrustedCertificate>>; /** * Verifies signed verification code for trusted certificate. * * * @param entityOrId Trusted certificate object or finger print. * @param proofOfPossessionSignedVerificationCode Unsigned verification code encrypted by the private key. * * @returns Certificate object with the result of verification (wrapped in [[IResult]]). * * **Example** * ```typescript * * (async () => { * const fingerPrint = '00a360973e3e8d61e05aedb32c72438e2442279e'; * const encryptedVerificationCode ='fuvlVWLfXG3V3bJWAdEhPD0HFCrYo5'; * const {data, res} = await trustedCertificateService.verifySignedVerificationCode(fingerPrint, encryptedVerificationCode); * const isCertificateVerified = data.proofOfPossessionValid; * })(); * ``` */ verifySignedVerificationCode(entityOrId: string | ITrustedCertificate, proofOfPossessionSignedVerificationCode: string): Promise<IResult<ITrustedCertificate>>; /** * Create cetificate authority for tenant. Only one certificate authority can be created for tenant. * * @returns Certificate authority object (wrapped in [[IResult]]). * * **Example** * ```typescript * * (async () => { * const {data, res} = await trustedCertificateService.generateCertificateAuthority(); * const certificateAuthority = data; * })(); * ``` */ generateCertificateAuthority(): Promise<IResult<ITrustedCertificate>>; /** * Renews the certificate authority for the tenant. * * @returns The renewed certificate authority object (wrapped in [[IResult]]). * * **Example** * ```typescript * (async () => { * const { data, res } = await trustedCertificateService.renewCertificateAuthority(); * const renewedCertificateAuthority = data; * })(); * ``` */ renewCertificateAuthority(): Promise<IResult<ITrustedCertificate>>; protected getDetailUrl(entityOrId: string | ITrustedCertificate): string; protected getEntityId(entityOrId: string | ITrustedCertificate): string; } //# sourceMappingURL=TrustedCertificateService.d.ts.map