diff --git a/services/identity-service/src/did/did.service.ts b/services/identity-service/src/did/did.service.ts index 7bfc34311..d8e43f857 100644 --- a/services/identity-service/src/did/did.service.ts +++ b/services/identity-service/src/did/did.service.ts @@ -46,10 +46,10 @@ export class DidService { return `did:web:${baseUrl}:`; } - generateDidUri(method: string, id?: string): string { + generateDidUri(method: string, id?: string, webDidBaseUrl?: string): string { if(id) return id; if (method === 'web') { - return this.getWebDidIdForId(uuid()); + return this.getWebDidIdForId(uuid(), webDidBaseUrl); } return `did:${(method && method.trim() !== '') ? method.trim() : 'rcw'}:${uuid()}`; } @@ -65,7 +65,7 @@ export class DidService { async generateDID(doc: GenerateDidDTO): Promise { // Create a UUID for the DID using uuidv4 - const didUri: string = this.generateDidUri(doc?.method, doc?.id); + const didUri: string = this.generateDidUri(doc?.method, doc?.id, doc?.webDidBaseUrl); // Create private/public key pair let authnKeys; diff --git a/services/identity-service/src/did/dtos/GenerateDidRequest.dto.ts b/services/identity-service/src/did/dtos/GenerateDidRequest.dto.ts index 52497f235..f64537f35 100644 --- a/services/identity-service/src/did/dtos/GenerateDidRequest.dto.ts +++ b/services/identity-service/src/did/dtos/GenerateDidRequest.dto.ts @@ -29,6 +29,11 @@ export class GenerateDidDTO { description: 'Specific ID to generate DID document with.', }) id?: string; + @ApiProperty({ + required: false, + description: 'In case of method "web" the web url path to access the did document. It would be appended by generated uuid', + }) + webDidBaseUrl?: string; } export class GenerateDidRequestDTO {