Skip to content
Snippets Groups Projects
Verified Commit 8ade6295 authored by Konstantin Tsabolov's avatar Konstantin Tsabolov
Browse files

fix(did-manager): fix did registration dto

parent 6e174621
No related branches found
No related tags found
1 merge request!40End to end run preparation
......@@ -33,13 +33,20 @@ export class DIDsService {
public registerFromSeed(
tenantId: string,
seed: EventDidsRegisterIndyFromSeedInput['seed'],
services?: EventDidsRegisterIndyFromSeedInput['services'],
services?: Array<{ id: string; type: string; serviceEndpoint: string }>,
) {
const mappedServices: EventDidsRegisterIndyFromSeedInput['services'] =
services?.map(({ id, type, serviceEndpoint }) => ({
identifier: id,
type,
url: serviceEndpoint,
}));
return this.natsClient
.send<
EventDidsRegisterIndyFromSeed,
EventDidsRegisterIndyFromSeedInput
>(EventDidsRegisterIndyFromSeed.token, { tenantId, seed, services })
>(EventDidsRegisterIndyFromSeed.token, { tenantId, seed, services: mappedServices })
.pipe(map(({ data }) => data));
}
......
import { ApiProperty } from '@nestjs/swagger';
import { IsString, IsArray, IsOptional } from 'class-validator';
import { Type } from 'class-transformer';
import { IsArray, IsOptional, IsString, ValidateNested } from 'class-validator';
class Service {
@IsString()
@ApiProperty({
description: 'Service identifier',
example: 'did:example:123#linked-domain',
})
public id: string;
@IsString()
@ApiProperty({
description: 'Service Type',
example: 'LinkedDomains',
})
public type: string;
@IsString()
@ApiProperty({
description: 'Service Endpoint',
example: 'https://bar.example.com',
})
public serviceEndpoint: string;
}
export class RegisterFromSeedPayload {
@IsString()
......@@ -10,6 +34,8 @@ export class RegisterFromSeedPayload {
public seed: string;
@IsArray()
@ValidateNested()
@Type(() => Service)
@IsOptional()
@ApiProperty({
description: 'Services to associate with DID',
......@@ -21,9 +47,5 @@ export class RegisterFromSeedPayload {
},
],
})
public services?: Array<{
identifier: string;
url: string;
type: string;
}>;
public services?: Service[];
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment