Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implementation of DID document for did web method #601

Merged
merged 4 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/agent-service/src/agent-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,7 @@ export class AgentServiceService {

const storeOrgAgentData: IStoreOrgAgentDetails = {
did: tenantDetails.DIDCreationOption.did,
didDoc: tenantDetails.DIDCreationOption.didDocument || tenantDetails.DIDCreationOption.didDoc, //changed the didDoc into didDocument
isDidPublic: true,
agentSpinUpStatus: AgentSpinUpStatus.COMPLETED,
agentsTypeId: agentTypeId,
Expand Down Expand Up @@ -906,7 +907,7 @@ export class AgentServiceService {


const walletResponseDetails = await this._createTenantWallet(walletLabel, platformAdminSpinnedUp.org_agents[0].agentEndPoint, platformAdminSpinnedUp.org_agents[0].apiKey);
if (!walletResponseDetails && !walletResponseDetails.id) {
if (!walletResponseDetails && !walletResponseDetails.id) {
throw new InternalServerErrorException('Error while creating the wallet');
}
const didCreateOption = {
Expand Down Expand Up @@ -1268,7 +1269,6 @@ export class AgentServiceService {

// Get organization agent details
const orgAgentDetails: org_agents = await this.agentServiceRepository.getOrgAgentDetails(orgId);

let agentApiKey;
if (orgAgentDetails) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export interface IStoreOrgAgentDetails {
network?: string;
role?: string;
did?: string;
didDoc?: string;
verkey?: string;
isDidPublic?: boolean;
agentSpinUpStatus?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export class AgentServiceRepository {
},
data: {
orgDid: storeOrgAgentDetails.did,
didDocument: storeOrgAgentDetails.didDoc,
verkey: storeOrgAgentDetails.verkey,
isDidPublic: storeOrgAgentDetails.isDidPublic,
agentSpinUpStatus: storeOrgAgentDetails.agentSpinUpStatus,
Expand Down
7 changes: 1 addition & 6 deletions apps/api-gateway/src/agent-service/dto/create-tenant.dto.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import { trim } from '@credebl/common/cast.helper';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { MaxLength, IsString, MinLength, Matches, IsOptional } from 'class-validator';
import { MaxLength, IsString, MinLength, IsOptional } from 'class-validator';
import { CreateDidDto } from './create-did.dto';
const labelRegex = /^[a-zA-Z0-9 ]*$/;
export class CreateTenantDto extends CreateDidDto {
@ApiProperty()
@MaxLength(25, { message: 'Maximum length for label must be 25 characters.' })
@IsString({ message: 'label must be in string format.' })
@Transform(({ value }) => trim(value))
@MinLength(2, { message: 'Minimum length for label must be 2 characters.' })
@Matches(labelRegex, { message: 'Label must not contain special characters.' })
@Matches(/^\S*$/, {
message: 'Spaces are not allowed in label'
})
label: string;

@ApiProperty({ example: 'ojIckSD2jqNzOqIrAGzL' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable camelcase */
import {
BadRequestException,
ConflictException,
HttpException,
Inject,
Expand Down
1 change: 1 addition & 0 deletions apps/organization/repositories/organization.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ export class OrganizationRepository {
select: {
id: true,
orgDid: true,
didDocument: true,
walletName: true,
agentEndPoint: true,
agentSpinUpStatus: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "org_agents" ADD COLUMN "didDocument" JSONB;
1 change: 1 addition & 0 deletions libs/prisma-service/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ model org_agents {
orgId String? @unique @db.Uuid
orgAgentTypeId String? @db.Uuid
ledgerId String? @db.Uuid
didDocument Json?
agent_invitations agent_invitations[]
agents agents? @relation(fields: [agentId], references: [id])
agents_type agents_type? @relation(fields: [agentsTypeId], references: [id])
Expand Down