src/crypto/key/dto/key-import.dto.ts
JWK
Properties |
| alg |
Type : string
|
Decorators :
@IsString()
|
|
Defined in src/crypto/key/dto/key-import.dto.ts:25
|
| crv |
Type : string
|
Decorators :
@IsString()
|
|
Defined in src/crypto/key/dto/key-import.dto.ts:21
|
| d |
Type : string
|
Decorators :
@IsString()
|
|
Defined in src/crypto/key/dto/key-import.dto.ts:23
|
| kty |
Type : string
|
Decorators :
@IsEnum(['EC'])
|
|
Defined in src/crypto/key/dto/key-import.dto.ts:15
|
| x |
Type : string
|
Decorators :
@IsString()
|
|
Defined in src/crypto/key/dto/key-import.dto.ts:17
|
| y |
Type : string
|
Decorators :
@IsString()
|
|
Defined in src/crypto/key/dto/key-import.dto.ts:19
|
import { ApiPropertyOptional, OmitType } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsEnum,
IsObject,
IsOptional,
IsString,
ValidateNested,
} from "class-validator";
import { JWK } from "jose";
import { KeyEntity } from "../entities/keys.entity";
class Key implements JWK {
@IsEnum(["EC"])
kty!: string; // Key Type
@IsString()
x!: string; // X coordinate for EC keys
@IsString()
y!: string; // Y coordinate for EC keys
@IsString()
crv!: string; // Curve name for EC keys
@IsString()
d!: string; // Private key value for EC keys
@IsString()
alg!: string; // Algorithm used with the key
}
/**
* DTO for importing a key.
*/
export class KeyImportDto extends OmitType(KeyEntity, [
"tenantId",
"tenant",
"certificates",
"createdAt",
"updatedAt",
"usage",
"kmsProvider",
] as const) {
/**
* The private key in JWK format.
*/
@IsObject()
@ValidateNested()
@Type(() => Key)
key!: Key;
/**
* Optional KMS provider name to use for this key.
* If not specified, the default KMS provider will be used.
*/
@ApiPropertyOptional({
description:
"KMS provider name to use for this key. Defaults to the configured default.",
example: "db",
})
@IsString()
@IsOptional()
kmsProvider?: string;
}