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

refactor: validations for network(polygon) in DID controller #140

Closed
Closed
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
6 changes: 6 additions & 0 deletions src/controllers/did/DidController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,13 @@ export class DidController extends Controller {
public async handlePolygon(createDidOptions: DidCreate) {
// need to discuss try catch logic
const { endpoint, network, privatekey } = createDidOptions

if (!network) {
throw new BadRequestError('Network is required for Polygon method')
}

const networkName = network?.split(':')[1]

if (networkName !== 'mainnet' && networkName !== 'testnet') {
throw new BadRequestError('Invalid network type')
}
Expand Down
42 changes: 16 additions & 26 deletions src/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ const models: TsoaRoute.Models = {
"type": {"dataType":"string","validators":{}},
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"ProofExchangeRecord": {
"dataType": "refAlias",
"type": {"ref":"Record_string.unknown_","validators":{}},
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"ProofFormat": {
"dataType": "refObject",
"properties": {
Expand Down Expand Up @@ -106,6 +111,17 @@ const models: TsoaRoute.Models = {
"additionalProperties": false,
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"PlaintextMessage": {
"dataType": "refObject",
"properties": {
"@type": {"dataType":"string","required":true},
"@id": {"dataType":"string","required":true},
"~thread": {"dataType":"nestedObjectLiteral","nestedProperties":{"pthid":{"dataType":"string"},"thid":{"dataType":"string"}}},
"messageType": {"dataType":"string","required":true},
},
"additionalProperties": {"dataType":"any"},
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"CreateProofRequestOobOptions": {
"dataType": "refObject",
"properties": {
Expand All @@ -124,17 +140,6 @@ const models: TsoaRoute.Models = {
"additionalProperties": false,
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"PlaintextMessage": {
"dataType": "refObject",
"properties": {
"@type": {"dataType":"string","required":true},
"@id": {"dataType":"string","required":true},
"~thread": {"dataType":"nestedObjectLiteral","nestedProperties":{"pthid":{"dataType":"string"},"thid":{"dataType":"string"}}},
"messageType": {"dataType":"string","required":true},
},
"additionalProperties": {"dataType":"any"},
},
// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
"HandshakeProtocol": {
"dataType": "refEnum",
"enums": ["https://didcomm.org/didexchange/1.x","https://didcomm.org/connections/1.x"],
Expand Down Expand Up @@ -1188,8 +1193,6 @@ export function RegisterRoutes(app: Router) {
async function ProofController_getProofById(request: ExRequest, response: ExResponse, next: any) {
const args: Record<string, TsoaRoute.ParameterSchema> = {
proofRecordId: {"in":"path","name":"proofRecordId","required":true,"ref":"RecordId"},
notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}},
internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}},
};

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
Expand Down Expand Up @@ -1226,8 +1229,6 @@ export function RegisterRoutes(app: Router) {
async function ProofController_proposeProof(request: ExRequest, response: ExResponse, next: any) {
const args: Record<string, TsoaRoute.ParameterSchema> = {
requestProofProposalOptions: {"in":"body","name":"requestProofProposalOptions","required":true,"ref":"RequestProofProposalOptions"},
notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}},
internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}},
};

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
Expand Down Expand Up @@ -1264,8 +1265,6 @@ export function RegisterRoutes(app: Router) {
async function ProofController_acceptProposal(request: ExRequest, response: ExResponse, next: any) {
const args: Record<string, TsoaRoute.ParameterSchema> = {
acceptProposal: {"in":"body","name":"acceptProposal","required":true,"ref":"AcceptProofProposal"},
notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}},
internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}},
};

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
Expand Down Expand Up @@ -1302,8 +1301,6 @@ export function RegisterRoutes(app: Router) {
async function ProofController_requestProof(request: ExRequest, response: ExResponse, next: any) {
const args: Record<string, TsoaRoute.ParameterSchema> = {
requestProofOptions: {"in":"body","name":"requestProofOptions","required":true,"ref":"RequestProofOptions"},
notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}},
internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}},
};

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
Expand Down Expand Up @@ -1340,7 +1337,6 @@ export function RegisterRoutes(app: Router) {
async function ProofController_createRequest(request: ExRequest, response: ExResponse, next: any) {
const args: Record<string, TsoaRoute.ParameterSchema> = {
createRequestOptions: {"in":"body","name":"createRequestOptions","required":true,"ref":"CreateProofRequestOobOptions"},
internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}},
};

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
Expand Down Expand Up @@ -1378,8 +1374,6 @@ export function RegisterRoutes(app: Router) {
const args: Record<string, TsoaRoute.ParameterSchema> = {
proofRecordId: {"in":"path","name":"proofRecordId","required":true,"dataType":"string"},
request: {"in":"body","name":"request","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"comment":{"dataType":"string"},"filterByNonRevocationRequirements":{"dataType":"boolean"},"filterByPresentationPreview":{"dataType":"boolean"}}},
notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}},
internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}},
};

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
Expand Down Expand Up @@ -1416,8 +1410,6 @@ export function RegisterRoutes(app: Router) {
async function ProofController_acceptPresentation(request: ExRequest, response: ExResponse, next: any) {
const args: Record<string, TsoaRoute.ParameterSchema> = {
proofRecordId: {"in":"path","name":"proofRecordId","required":true,"dataType":"string"},
notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}},
internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}},
};

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
Expand Down Expand Up @@ -1454,8 +1446,6 @@ export function RegisterRoutes(app: Router) {
async function ProofController_proofFormData(request: ExRequest, response: ExResponse, next: any) {
const args: Record<string, TsoaRoute.ParameterSchema> = {
proofRecordId: {"in":"path","name":"proofRecordId","required":true,"dataType":"string"},
notFoundError: {"in":"res","name":"404","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"reason":{"dataType":"string","required":true}}},
internalServerError: {"in":"res","name":"500","required":true,"dataType":"nestedObjectLiteral","nestedProperties":{"message":{"dataType":"string","required":true}}},
};

// WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa
Expand Down
Loading