/** * This file was auto-generated by Fern from our API Definition. */ import * as core from '../../../../core'; import * as environments from '../../../../environments'; import * as Truvity from '../../../index'; export declare namespace Keys { interface Options { environment?: core.Supplier; /** Specify a custom URL to connect the client to. */ baseUrl?: core.Supplier; apiKey?: core.Supplier; /** Additional headers to include in requests. */ headers?: Record | undefined>; fetcher?: core.FetchFunction; } interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Additional query string parameters to include in the request. */ queryParams?: Record; /** Additional headers to include in the request. */ headers?: Record | undefined>; } } /** * The API to manage cryptographical asymmetrical keys. */ export declare class Keys { protected readonly _options: Keys.Options; constructor(_options?: Keys.Options); /** * Generate a new cryptographic key pair. * * @param {Truvity.KeyGenerateRequest} request * @param {Keys.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.UnsupportedMediaTypeError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} * * @example * await client.keys.keyGenerate({ * data: { * type: "ED25519" * } * }) */ keyGenerate(request: Truvity.KeyGenerateRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __keyGenerate; /** * You could use KeyGenerate, if you want to rely to generated by Truvity key-pairs for CredentialIssue and PresentationIssue. * Remember, that you do not have any option to get private key by Truvity API, you could only use it * * If you prefer to keep private key, then you need to generate it manually. * To use manually generated key CredentialIssue and PresentationIssue you need to import it. * * To generate key-pair you have two options * 1. OpenSSL - [OpenSSL commands](https://www.openssl.org/docs/man1.1.1/man1/index.html) * 2. JWX tool - [https://github.com/lestrrat-go/jwx/blob/main/cmd/jwx/README.md](https://github.com/lestrrat-go/jwx/blob/main/cmd/jwx/README.md) * * How to install JWX * 1. Download & Install Golang - [https://go.dev/doc/install](https://go.dev/doc/install) * 2. Clone & Build & Install [github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx) * ```bash * git clone https://github.com/lestrrat-go/jwx * cd jwx/cmd/jwx * go install -tags=jwx_es256k,jwx_secp256k1_pem . * ``` * 3. Verify that you correctly install everything * ```bash * ➜ jwx --help * NAME: * jwx - Tools for various JWE/JWK/JWS/JWT operations * * USAGE: * jwx [global options] command [command options] [arguments...] * * COMMANDS: * jwa List available algorithms and types * jwe Work with JWE messages * jwk Work with JWK and JWK sets * jws Work with JWS messages * help, h Shows a list of commands or help for one command * * GLOBAL OPTIONS: * --help, -h show help * ``` * * How generate private key by `jwx` (output format JWK) * ```bash * # ED25519 * jwx jwx generate --type OKP --curve Ed25519 * # P256 * jwx jwx generate --type EC --curve P-256 * # P384 * jwx jwx generate --type EC --curve P-384 * ``` * How to generate public key from private key by `jwx` (input format - JWK, output format - JWK) * ```bash * jwx jwk format -I json -O json - <(pathfile with private key in JWK format) * ``` * How to generate private key by OpenSSL (output format PEM - PKCS#8) * ```bash * # ED25519 * openssl genpkey -algorithm ed25519 | openssl pkcs8 -nocrypt -topk8 * # P256 * openssl ecparam -name prime256v1 -noout -genkey | openssl pkcs8 -nocrypt -topk8 * # P384 * openssl ecparam -name secp384r1 -noout -genkey | openssl pkcs8 -nocrypt -topk8 * ``` * How to transform existing private key to PKCS8 format by OpenSSL (input format PEM, output format - PEM PCKS#8) * ```bash * openssl pkcs8 -nocrypt -topk8 <(pathfile with private key in PEM format) * ``` * How to transform private key to public key by OpenSSL (input format PEM, output format - PEM PKIX) * ```bash * openssl pkey -pubout <(pathfile with private key in PKCS8 format) * ``` * Useful third-party documentation: * - [openssl-genrsa - generate an RSA private key](https://www.openssl.org/docs/manmaster/man1/openssl-genpkey.html). * - [openssl-ec, ec - EC key processing](https://www.openssl.org/docs/man1.0.2/man1/ec.html) * - [openssl-genrsa - generate an RSA private key](https://www.openssl.org/docs/man3.0/man1/openssl-genrsa.html) * - [openssl-pkcs8 - PKCS#8 format private key conversion command](https://www.openssl.org/docs/manmaster/man1/openssl-pkcs8.html) * - [JWX - github.com/lestrrat-go/jwx](https://github.com/lestrrat-go/jwx/blob/main/cmd/jwx/README.md) * - [FIPS 186-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf). * - [SEC2](https://www.secg.org/sec2-v2.pdf). * - [AWS KMS - Asymmetric key specs](https://docs.aws.amazon.com/kms/latest/developerguide/asymmetric-key-specs.html) * . * * @param {Truvity.KeyImportRequest} request * @param {Keys.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.UnsupportedMediaTypeError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} * * @example * await client.keys.keyImport({ * data: "data" * }) */ keyImport(request: Truvity.KeyImportRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __keyImport; /** * Search for Keys with extended filters capabilities. * * @param {Truvity.KeySearchRequest} request * @param {Keys.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.UnsupportedMediaTypeError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} * * @example * await client.keys.keySearch() */ keySearch(request?: Truvity.KeySearchRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __keySearch; /** * Get the latest version of Key. * * @param {string} id - The ID of the resource. * @param {Truvity.KeyLatestRequest} request * @param {Keys.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.NotFoundError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} * * @example * await client.keys.keyLatest("id") */ keyLatest(id: string, request?: Truvity.KeyLatestRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __keyLatest; /** * Delete Key's resource. * * @param {string} id - The primary and unique identifier of the resource (inside tenant) * according to [RFC 4122](https://www.rfc-editor.org/info/rfc4122). * @param {Truvity.KeyDeleteRequest} request * @param {Keys.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.NotFoundError} * @throws {@link Truvity.MethodNotAllowedError} * @throws {@link Truvity.PreconditionFailedError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} * * @example * await client.keys.keyDelete("id", { * ifMatch: "If-Match" * }) */ keyDelete(id: string, request: Truvity.KeyDeleteRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __keyDelete; /** * Update annotations of Key's resource. * * @param {string} id - The primary and unique identifier of the resource (inside tenant) * according to [RFC 4122](https://www.rfc-editor.org/info/rfc4122). * @param {Truvity.KeyUpdateAnnotationsRequest} request * @param {Keys.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.NotFoundError} * @throws {@link Truvity.MethodNotAllowedError} * @throws {@link Truvity.PreconditionFailedError} * @throws {@link Truvity.UnsupportedMediaTypeError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} * * @example * await client.keys.keyUpdateAnnotations("id", { * ifMatch: "If-Match", * annotations: { * "key": "value" * } * }) */ keyUpdateAnnotations(id: string, request: Truvity.KeyUpdateAnnotationsRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __keyUpdateAnnotations; /** * Sign a JSON-LD representation of an unsigned Credential. * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.NotFoundError} * @throws {@link Truvity.MethodNotAllowedError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} */ credentialSign(id: string, request: Truvity.CredentialSignRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __credentialSign; /** * Sign DIDComm Message Plaintext. * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.NotFoundError} * @throws {@link Truvity.MethodNotAllowedError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} */ didCommMessageSign(id: string, request: Truvity.DidCommMessageSignRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __didCommMessageSign; /** * Update labels of Key's resource. * * @param {string} id - The primary and unique identifier of the resource (inside tenant) * according to [RFC 4122](https://www.rfc-editor.org/info/rfc4122). * @param {Truvity.KeyUpdateLabelsRequest} request * @param {Keys.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.NotFoundError} * @throws {@link Truvity.MethodNotAllowedError} * @throws {@link Truvity.PreconditionFailedError} * @throws {@link Truvity.UnsupportedMediaTypeError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} * * @example * await client.keys.keyUpdateLabels("id", { * ifMatch: "If-Match", * labels: { * "key": "value" * } * }) */ keyUpdateLabels(id: string, request: Truvity.KeyUpdateLabelsRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __keyUpdateLabels; /** * Sign a JSON-LD representation of an unsigned Presentation. * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.NotFoundError} * @throws {@link Truvity.MethodNotAllowedError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} */ presentationSign(id: string, request: Truvity.PresentationSignRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __presentationSign; /** * Restore Key's resource. * * @param {string} id - The primary and unique identifier of the resource (inside tenant) * according to [RFC 4122](https://www.rfc-editor.org/info/rfc4122). * @param {Truvity.KeyRestoreRequest} request * @param {Keys.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.NotFoundError} * @throws {@link Truvity.MethodNotAllowedError} * @throws {@link Truvity.PreconditionFailedError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} * * @example * await client.keys.keyRestore("id", { * ifMatch: "If-Match" * }) */ keyRestore(id: string, request: Truvity.KeyRestoreRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __keyRestore; /** * History of the Key's resources. * * @param {string} id - The ID of the resource. * @param {Truvity.KeyHistoryRequest} request * @param {Keys.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.NotFoundError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} * * @example * await client.keys.keyHistory("id") */ keyHistory(id: string, request?: Truvity.KeyHistoryRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __keyHistory; /** * Read the specific version of the Key's resource. * * @param {string} id - The ID of the resource. * @param {number} revision - The revision of the resource. * @param {Truvity.KeyRevisionRequest} request * @param {Keys.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Truvity.BadRequestError} * @throws {@link Truvity.UnauthorizedError} * @throws {@link Truvity.ForbiddenError} * @throws {@link Truvity.NotFoundError} * @throws {@link Truvity.TooManyRequestsError} * @throws {@link Truvity.InternalServerError} * * @example * await client.keys.keyRevision("id", 1) */ keyRevision(id: string, revision: number, request?: Truvity.KeyRevisionRequest, requestOptions?: Keys.RequestOptions): core.HttpResponsePromise; private __keyRevision; protected _getCustomAuthorizationHeaders(): Promise<{ 'X-API-KEY': string | undefined; }>; } //# sourceMappingURL=Client.d.ts.map