diff --git a/src/controllers/api/accreditation.ts b/src/controllers/api/accreditation.ts index 442fad62..b5a60e67 100644 --- a/src/controllers/api/accreditation.ts +++ b/src/controllers/api/accreditation.ts @@ -35,7 +35,7 @@ export class AccreditationController { query('accreditationType') .exists() .isIn([ - AccreditationRequestType.authorize, + AccreditationRequestType.authorise, AccreditationRequestType.accredit, AccreditationRequestType.attest, ]) @@ -49,32 +49,32 @@ export class AccreditationController { .custom((value) => typeof value === 'string' || (Array.isArray(value) && typeof value[0] === 'string')) .withMessage('schema type must be a string'), body('parentAccreditation').optional().isString().withMessage('parentAccreditation must be a string').bail(), - body('rootAuthorization').optional().isString().withMessage('rootAuthorization must be a string').bail(), + body('rootAuthorisation').optional().isString().withMessage('rootAuthorisation must be a string').bail(), body('trustFramework').optional().isString().withMessage('trustFramework must be a string').bail(), body('trustFrameworkId').optional().isString().withMessage('trustFrameworkId must be a string').bail(), query('accreditationType') .custom((value, { req }) => { - const { parentAccreditation, rootAuthorization, trustFramework, trustFrameworkId } = req.body; + const { parentAccreditation, rootAuthorisation, trustFramework, trustFrameworkId } = req.body; - const hasParentOrRoot = parentAccreditation || rootAuthorization; + const hasParentOrRoot = parentAccreditation || rootAuthorisation; if ( !hasParentOrRoot && (value === AccreditationRequestType.accredit || value === AccreditationRequestType.attest) ) { - throw new Error('parentAccreditation or rootAuthorization is required'); + throw new Error('parentAccreditation or rootAuthorisation is required'); } - if (hasParentOrRoot && value === AccreditationRequestType.authorize) { + if (hasParentOrRoot && value === AccreditationRequestType.authorise) { throw new Error( - 'parentAccreditation or rootAuthorization is not required for an authorize operation' + 'parentAccreditation or rootAuthorisation is not required for an authorise operation' ); } const hasTrustFramework = trustFramework && trustFrameworkId; - if (!hasTrustFramework && value === AccreditationRequestType.authorize) { - throw new Error('trustFramework and trustFrameworkId are required for an authorize operation'); + if (!hasTrustFramework && value === AccreditationRequestType.authorise) { + throw new Error('trustFramework and trustFrameworkId are required for an authorise operation'); } return true; @@ -149,7 +149,7 @@ export class AccreditationController { * schema: * type: string * enum: - * - authorize + * - authorise * - accredit * - attest * required: true @@ -196,7 +196,7 @@ export class AccreditationController { schemas, type, parentAccreditation, - rootAuthorization, + rootAuthorisation, trustFramework, trustFrameworkId, attributes, @@ -259,7 +259,7 @@ export class AccreditationController { let resourceType: string; switch (accreditationType) { - case AccreditationRequestType.authorize: + case AccreditationRequestType.authorise: resourceType = DIDAccreditationTypes.VerifiableAuthorisationForTrustChain; credentialRequest.type = [...(type || []), resourceType]; credentialRequest.termsOfUse = { @@ -274,7 +274,7 @@ export class AccreditationController { credentialRequest.termsOfUse = { type: resourceType, parentAccreditation, - rootAuthorization, + rootAuthorisation, }; break; case AccreditationRequestType.attest: @@ -283,7 +283,7 @@ export class AccreditationController { credentialRequest.termsOfUse = { type: resourceType, parentAccreditation, - rootAuthorization, + rootAuthorisation, }; break; } @@ -300,7 +300,7 @@ export class AccreditationController { true, false, response.locals.customer, - rootAuthorization + rootAuthorisation ); if (result.success === false) { diff --git a/src/services/api/accreditation.ts b/src/services/api/accreditation.ts index 49e83594..2a374407 100644 --- a/src/services/api/accreditation.ts +++ b/src/services/api/accreditation.ts @@ -17,7 +17,7 @@ export class AccreditationService { verifyStatus: boolean, allowDeactivatedDid: boolean, customer: CustomerEntity, - rootAuthorization?: string, + rootAuthorisation?: string, policies?: VerificationPolicies ): Promise> { // Get strategy e.g. postgres or local @@ -96,7 +96,7 @@ export class AccreditationService { ); if (!initialVerifyResult) { - initialVerifyResult = { ...verifyResult, rootAuthorization }; + initialVerifyResult = { ...verifyResult, rootAuthorisation }; } if (verifyResult.error) { @@ -134,12 +134,12 @@ export class AccreditationService { isTypeAccreditation === DIDAccreditationTypes.VerifiableAccreditationToAttest ) { const termsOfUse = accreditation.termsOfUse; - if (!termsOfUse || !termsOfUse.parentAccreditation || !termsOfUse.rootAuthorization) { + if (!termsOfUse || !termsOfUse.parentAccreditation || !termsOfUse.rootAuthorisation) { return { success: false, status: StatusCodes.BAD_REQUEST, data: initialVerifyResult, - error: `Error on verifying accreditation ${accreditationUrl}: Missing parentAccreditaiton and rootAuthorization in termsOfUse for accreditation: ${accreditationUrl}`, + error: `Error on verifying accreditation ${accreditationUrl}: Missing parentAccreditaiton and rootAuthorisation in termsOfUse for accreditation: ${accreditationUrl}`, }; } @@ -150,16 +150,16 @@ export class AccreditationService { accreditedSubject = accreditorDid; accreditedFor = accreditation.credentialSubject.accreditedFor; - if (rootAuthorization && rootAuthorization !== termsOfUse.rootAuthorization) { + if (rootAuthorisation && rootAuthorisation !== termsOfUse.rootAuthorisation) { return { status: StatusCodes.OK, success: false, data: initialVerifyResult, - error: `Error on verifying accreditation ${accreditationUrl}: Expected accreditation to be linked to root accreditation ${rootAuthorization}, but found it linked to DID ${termsOfUse.rootAuthorization} instead`, + error: `Error on verifying accreditation ${accreditationUrl}: Expected accreditation to be linked to root accreditation ${rootAuthorisation}, but found it linked to DID ${termsOfUse.rootAuthorisation} instead`, }; } - rootAuthorization = termsOfUse.rootAuthorization; + rootAuthorisation = termsOfUse.rootAuthorisation; } else { return { status: StatusCodes.OK, diff --git a/src/static/swagger-api.json b/src/static/swagger-api.json index 6585a131..a2512eed 100644 --- a/src/static/swagger-api.json +++ b/src/static/swagger-api.json @@ -557,16 +557,16 @@ "description": "DID URL of the parent Verifiable Accreditation, required for accredit/attest operation.", "type": "string" }, - "rootAuthorization": { + "rootAuthorisation": { "description": "DID URL of the root Verifiable Accreditation, required for accredit/attest operation.", "type": "string" }, "trustFramework": { - "description": "Name or Type of the Trust Framework, required for authorize operation.", + "description": "Name or Type of the Trust Framework, required for authorise operation.", "type": "string" }, "trustFrameworkId": { - "description": "Url of the Trust Framework, required for authorize operation.", + "description": "Url of the Trust Framework, required for authorise operation.", "type": "string" }, "type": { @@ -702,11 +702,11 @@ } ], "format": "jwt", - "accreditationName": "authorizeAccreditation", + "accreditationName": "authoriseAccreditation", "trustFramework": "https://learn.cheqd.io/governance/start", "trustFrameworkId": "cheqd Governance Framework", "parentAccreditation": "did:cheqd:testnet:15b74787-6e48-4fd5-8020-eab24e990578?resourceName=accreditAccreditation&resourceType=VerifiableAccreditationToAccredit", - "rootAuthorization": "did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authorizeAccreditation&resourceType=VerifiableAuthorisationForTrustChain", + "rootAuthorisation": "did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authoriseAccreditation&resourceType=VerifiableAuthorisationForTrustChain", "credentialStatus": { "statusPurpose": "revocation", "statusListName": "employee-credentials", @@ -2517,7 +2517,7 @@ "schema": { "type": "string", "enum": [ - "authorize", + "authorise", "accredit", "attest" ] diff --git a/src/types/accreditation.ts b/src/types/accreditation.ts index d025306e..8f1973d2 100644 --- a/src/types/accreditation.ts +++ b/src/types/accreditation.ts @@ -17,7 +17,7 @@ export enum DIDAccreditationTypes { } export enum AccreditationRequestType { - authorize = 'authorize', + authorise = 'authorise', accredit = 'accredit', attest = 'attest', } @@ -40,14 +40,14 @@ export type DIDAccreditationRequestBody = Omit< accreditationName: string; attributes?: Record; type: string[] | undefined; - rootAuthorization?: string; + rootAuthorisation?: string; parentAccreditation?: string; trustFramework?: string; trustFrameworkId?: string; }; export type DIDAccreditationRequestParams = { - accreditationType: 'authorize' | 'accredit' | 'attest'; + accreditationType: 'authorise' | 'accredit' | 'attest'; }; export interface DIDUrlParams { diff --git a/src/types/swagger-api-types.ts b/src/types/swagger-api-types.ts index 88a8eb6f..81368d93 100644 --- a/src/types/swagger-api-types.ts +++ b/src/types/swagger-api-types.ts @@ -360,14 +360,14 @@ * parentAccreditation: * description: DID URL of the parent Verifiable Accreditation, required for accredit/attest operation. * type: string - * rootAuthorization: + * rootAuthorisation: * description: DID URL of the root Verifiable Accreditation, required for accredit/attest operation. * type: string * trustFramework: - * description: Name or Type of the Trust Framework, required for authorize operation. + * description: Name or Type of the Trust Framework, required for authorise operation. * type: string * trustFrameworkId: - * description: Url of the Trust Framework, required for authorize operation. + * description: Url of the Trust Framework, required for authorise operation. * type: string * type: * description: Optional properties to be included in the `type` property of the Accreditation. @@ -466,11 +466,11 @@ * - type: MuseumPassCredential * url: https://resolver.cheqd.net/1.0/identifiers/did:cheqd:testnet:0a5b94d0-a417-48ed-a6f5-4abc9e95888d?resourceName=MuseumPassCredentialSchema&resourceType=JsonSchemaValidator2018 * format: jwt - * accreditationName: authorizeAccreditation + * accreditationName: authoriseAccreditation * trustFramework: https://learn.cheqd.io/governance/start * trustFrameworkId: cheqd Governance Framework * parentAccreditation: did:cheqd:testnet:15b74787-6e48-4fd5-8020-eab24e990578?resourceName=accreditAccreditation&resourceType=VerifiableAccreditationToAccredit - * rootAuthorization: did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authorizeAccreditation&resourceType=VerifiableAuthorisationForTrustChain + * rootAuthorisation: did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authoriseAccreditation&resourceType=VerifiableAuthorisationForTrustChain * credentialStatus: * statusPurpose: revocation * statusListName: employee-credentials diff --git a/tests/e2e/parallel/accreditation/negative-flow.spec.ts b/tests/e2e/parallel/accreditation/negative-flow.spec.ts index 293907ab..cfe5228a 100644 --- a/tests/e2e/parallel/accreditation/negative-flow.spec.ts +++ b/tests/e2e/parallel/accreditation/negative-flow.spec.ts @@ -6,7 +6,7 @@ import { CONTENT_TYPE, PAYLOADS_PATH } from '../../constants'; test.use({ storageState: 'playwright/.auth/user.json' }); test(' Issue accreditation [Negative]: Missing query parameters', async ({ request }) => { - const credentialData = JSON.parse(fs.readFileSync(`${PAYLOADS_PATH.ACCREDITATION}/authorize-jwt.json`, 'utf-8')); + const credentialData = JSON.parse(fs.readFileSync(`${PAYLOADS_PATH.ACCREDITATION}/authorise-jwt.json`, 'utf-8')); const issueResponse = await request.post(`/trust-registry/accreditation/issue`, { data: JSON.stringify(credentialData), headers: { diff --git a/tests/e2e/payloads/accreditation/accredit-jwt.json b/tests/e2e/payloads/accreditation/accredit-jwt.json index 6bec9a90..2fa5965e 100644 --- a/tests/e2e/payloads/accreditation/accredit-jwt.json +++ b/tests/e2e/payloads/accreditation/accredit-jwt.json @@ -10,5 +10,5 @@ "format": "jwt", "accreditationName": "accreditAccreditation", "parentAccreditation": "did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authorizeAccreditation&resourceType=VerifiableAuthorisationForTrustChain", - "rootAuthorization": "did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authorizeAccreditation&resourceType=VerifiableAuthorisationForTrustChain" + "rootAuthorisation": "did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authorizeAccreditation&resourceType=VerifiableAuthorisationForTrustChain" } diff --git a/tests/e2e/payloads/accreditation/attest-jwt.json b/tests/e2e/payloads/accreditation/attest-jwt.json index e745b407..c8ee70ed 100644 --- a/tests/e2e/payloads/accreditation/attest-jwt.json +++ b/tests/e2e/payloads/accreditation/attest-jwt.json @@ -10,5 +10,5 @@ "format": "jwt", "accreditationName": "attestAccreditation", "parentAccreditation": "did:cheqd:testnet:15b74787-6e48-4fd5-8020-eab24e990578?resourceName=accreditAccreditation&resourceType=VerifiableAccreditationToAccredit", - "rootAuthorization": "did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authorizeAccreditation&resourceType=VerifiableAuthorisationForTrustChain" + "rootAuthorisation": "did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authorizeAccreditation&resourceType=VerifiableAuthorisationForTrustChain" } diff --git a/tests/e2e/payloads/accreditation/authorize-jwt-revocation.json b/tests/e2e/payloads/accreditation/authorise-jwt-revocation.json similarity index 100% rename from tests/e2e/payloads/accreditation/authorize-jwt-revocation.json rename to tests/e2e/payloads/accreditation/authorise-jwt-revocation.json diff --git a/tests/e2e/payloads/accreditation/authorize-jwt.json b/tests/e2e/payloads/accreditation/authorise-jwt.json similarity index 100% rename from tests/e2e/payloads/accreditation/authorize-jwt.json rename to tests/e2e/payloads/accreditation/authorise-jwt.json diff --git a/tests/e2e/payloads/accreditation/child-accredit-jwt.json b/tests/e2e/payloads/accreditation/child-accredit-jwt.json index f52bdbe7..050bc224 100644 --- a/tests/e2e/payloads/accreditation/child-accredit-jwt.json +++ b/tests/e2e/payloads/accreditation/child-accredit-jwt.json @@ -10,5 +10,5 @@ "format": "jwt", "accreditationName": "accreditAccreditation", "parentAccreditation": "did:cheqd:testnet:15b74787-6e48-4fd5-8020-eab24e990578?resourceName=accreditAccreditation&resourceType=VerifiableAccreditationToAccredit", - "rootAuthorization": "did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authorizeAccreditation&resourceType=VerifiableAuthorisationForTrustChain" + "rootAuthorisation": "did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authorizeAccreditation&resourceType=VerifiableAuthorisationForTrustChain" } diff --git a/tests/e2e/payloads/accreditation/invalid-schema-accredit.json b/tests/e2e/payloads/accreditation/invalid-schema-accredit.json index 56b2b906..dd25cc92 100644 --- a/tests/e2e/payloads/accreditation/invalid-schema-accredit.json +++ b/tests/e2e/payloads/accreditation/invalid-schema-accredit.json @@ -10,5 +10,5 @@ "format": "jwt", "accreditationName": "childAccreditAccreditation", "parentAccreditation": "did:cheqd:testnet:15b74787-6e48-4fd5-8020-eab24e990578?resourceName=accreditAccreditation&resourceType=VerifiableAccreditationToAccredit", - "rootAuthorization": "did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authorizeAccreditation&resourceType=VerifiableAuthorisationForTrustChain" + "rootAuthorisation": "did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=authorizeAccreditation&resourceType=VerifiableAuthorisationForTrustChain" } diff --git a/tests/e2e/sequential/accreditation/issue-verify-flow.spec.ts b/tests/e2e/sequential/accreditation/issue-verify-flow.spec.ts index c1d45ebf..9a416fb2 100644 --- a/tests/e2e/sequential/accreditation/issue-verify-flow.spec.ts +++ b/tests/e2e/sequential/accreditation/issue-verify-flow.spec.ts @@ -5,9 +5,9 @@ import { CONTENT_TYPE, PAYLOADS_PATH } from '../../constants'; test.use({ storageState: 'playwright/.auth/user.json' }); -test(' Issue and verify a authorize accreditation', async ({ request }) => { - const credentialData = JSON.parse(fs.readFileSync(`${PAYLOADS_PATH.ACCREDITATION}/authorize-jwt.json`, 'utf-8')); - const issueResponse = await request.post(`/trust-registry/accreditation/issue?accreditationType=authorize`, { +test(' Issue and verify a authorise accreditation', async ({ request }) => { + const credentialData = JSON.parse(fs.readFileSync(`${PAYLOADS_PATH.ACCREDITATION}/authorise-jwt.json`, 'utf-8')); + const issueResponse = await request.post(`/trust-registry/accreditation/issue?accreditationType=authorise`, { data: JSON.stringify(credentialData), headers: { 'Content-Type': CONTENT_TYPE.APPLICATION_JSON, diff --git a/tests/e2e/sequential/accreditation/revocation-flow.spec.ts b/tests/e2e/sequential/accreditation/revocation-flow.spec.ts index 47c9b4f7..0a3709a0 100644 --- a/tests/e2e/sequential/accreditation/revocation-flow.spec.ts +++ b/tests/e2e/sequential/accreditation/revocation-flow.spec.ts @@ -9,9 +9,9 @@ const didUrl: string = `did:cheqd:testnet:5RpEg66jhhbmASWPXJRWrA?resourceName=re const subjectDid: string = 'did:cheqd:testnet:15b74787-6e48-4fd5-8020-eab24e990578'; test(' Issue an Accreditation with revocation statuslist', async ({ request }) => { const payload = JSON.parse( - fs.readFileSync(`${PAYLOADS_PATH.ACCREDITATION}/authorize-jwt-revocation.json`, 'utf-8') + fs.readFileSync(`${PAYLOADS_PATH.ACCREDITATION}/authorise-jwt-revocation.json`, 'utf-8') ); - const issueResponse = await request.post(`/trust-registry/accreditation/issue?accreditationType=authorize`, { + const issueResponse = await request.post(`/trust-registry/accreditation/issue?accreditationType=authorise`, { data: JSON.stringify(payload), headers: { 'Content-Type': CONTENT_TYPE.APPLICATION_JSON, diff --git a/tests/e2e/sequential/accreditation/suspension-flow.spec.ts b/tests/e2e/sequential/accreditation/suspension-flow.spec.ts index aa8ea188..f7f2ba22 100644 --- a/tests/e2e/sequential/accreditation/suspension-flow.spec.ts +++ b/tests/e2e/sequential/accreditation/suspension-flow.spec.ts @@ -10,11 +10,11 @@ const subjectDid: string = 'did:cheqd:testnet:15b74787-6e48-4fd5-8020-eab24e9905 test(' Issue a jwt accreditation with suspension statuslist', async ({ request }) => { const payload = JSON.parse( - fs.readFileSync(`${PAYLOADS_PATH.ACCREDITATION}/authorize-jwt-revocation.json`, 'utf-8') + fs.readFileSync(`${PAYLOADS_PATH.ACCREDITATION}/authorise-jwt-revocation.json`, 'utf-8') ); payload.credentialStatus.statusPurpose = 'suspension'; payload.accreditationName = 'suspensionAccreditation'; - const issueResponse = await request.post(`/trust-registry/accreditation/issue?accreditationType=authorize`, { + const issueResponse = await request.post(`/trust-registry/accreditation/issue?accreditationType=authorise`, { data: JSON.stringify(payload), headers: { 'Content-Type': CONTENT_TYPE.APPLICATION_JSON,