From 9b059b9a09c8d7ae15e48bf8db8c61ab3055df32 Mon Sep 17 00:00:00 2001 From: Gus Narea Date: Thu, 24 Aug 2023 16:03:53 +0200 Subject: [PATCH] fix: Change content type prefix to `application/vnd.veraid-authority.` --- docs/api-server.md | 4 ++-- docs/awala.md | 6 +++--- docs/queue-server.md | 2 +- src/awala/routes/awala.routes.spec.ts | 6 +++--- src/awala/routes/awala.routes.ts | 4 ++-- src/functionalTests/awala.test.ts | 2 +- src/memberKeyImportToken.spec.ts | 2 +- src/memberKeyImportToken.ts | 2 +- src/utilities/veraid.ts | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/api-server.md b/docs/api-server.md index dcf2f1f0..31f4cfde 100644 --- a/docs/api-server.md +++ b/docs/api-server.md @@ -77,7 +77,7 @@ Unless otherwise specified, all inputs and outputs will be JSON serialised. - HTTP response: `202 Accepted` (no content) if the input was valid and the request was successfully processed, or `400 Bad Request` if the input was invalid. - Awala service messages: - `MemberBundleRequest`. - - HTTP request body (JSON, with content type `application/vnd.veraid.member-bundle-request`): + - HTTP request body (JSON, with content type `application/vnd.veraid-authority.member-bundle-request`): - The id for the respective member public key. - The future start date of the bundle. (Bundles will be issued at that time or later, but never before) - Digital signature for the parameters above, produced with the private key associated with the public key. @@ -85,7 +85,7 @@ Unless otherwise specified, all inputs and outputs will be JSON serialised. - Successful outcome: Create new DB record to **schedule** the issuance and delivery of a member id bundle. This DB record will contain the data in the request. - Any public key must have a maximum of 1 request at any time, so if we get a duplicate, we should replace the old request with the new one. - `MemberPublicKeyImport`. - - Payload (JSON, with content type `application/vnd.veraid.member-public-key-import`): + - Payload (JSON, with content type `application/vnd.veraid-authority.member-public-key-import`): - The single-use import token. - The DER-encoded public key. - The Awala Parcel Delivery Authorisation (PDA). diff --git a/docs/awala.md b/docs/awala.md index 70e9d5d4..43b1d5bf 100644 --- a/docs/awala.md +++ b/docs/awala.md @@ -28,7 +28,7 @@ Your app MUST send a member public key import message in order to import the mem - `publicKey`: The base64-encoded, ASN.1 DER serialisation of the member's public key. - `awalaPda`: The Awala Parcel Delivery Authorisation (PDA) to be used to deliver the member bundle eventually. -This service message MUST use the content type `application/vnd.veraid.member-public-key-import`. +This service message MUST use the content type `application/vnd.veraid-authority.member-public-key-import`. ### Member bundle request @@ -39,7 +39,7 @@ Your app MUST send a member bundle request to renew the member's existing bundle - `awalaPda`: The Awala Parcel Delivery Authorisation (PDA) to be used to deliver the member bundle eventually. - `signature`: The digital signature for the request, with the input being the other fields concatenated as follows: `publicKeyId || memberBundleStartDate || awalaPda`. -This service message MUST use the content type `application/vnd.veraid.member-bundle-request`. +This service message MUST use the content type `application/vnd.veraid-authority.member-bundle-request`. ### Member bundle @@ -48,4 +48,4 @@ Your app MUST process incoming member bundle messages, which is a JSON document - `memberPublicKeyId`: The id of the public key that your app MUST use when requesting member bundles in the future. This is unique for every public key and never changes, so you only need to store it the first time you receive this message. - `memberBundle`: The base64-encoded member bundle. -This service message uses the content type `application/vnd.veraid.member-bundle`. +This service message uses the content type `application/vnd.veraid-authority.member-bundle`. diff --git a/docs/queue-server.md b/docs/queue-server.md index 1d71fd80..2d8b5f97 100644 --- a/docs/queue-server.md +++ b/docs/queue-server.md @@ -35,6 +35,6 @@ The events above are consumed by the following Knative Eventing sinks: 3. Post bundle to Awala recipient via the Awala Endpoint Middleware. - `member-public-key-import-ack`: - Event triggers: `member-public-key-import`. - - Outcome: Same as in `member-bundle-issuer`, but the payload to be posted to the Awala Endpoint Middleware should be a JSON document (content type `application/vnd.veraid.member-public-key-import-ack`) with the following fields: + - Outcome: Same as in `member-bundle-issuer`, but the payload to be posted to the Awala Endpoint Middleware should be a JSON document (content type `application/vnd.veraid-authority.member-public-key-import-ack`) with the following fields: - The id for the member public key. This is to be passed in subsequent `MemberBundleRequest` messages. - The VeraId Member Bundle (base64-encoded). diff --git a/src/awala/routes/awala.routes.spec.ts b/src/awala/routes/awala.routes.spec.ts index 82802326..8d0987be 100644 --- a/src/awala/routes/awala.routes.spec.ts +++ b/src/awala/routes/awala.routes.spec.ts @@ -112,7 +112,7 @@ describe('Awala routes', () => { source: AWALA_PEER_ID, type: 'invalid message type', subject: 'https://relaycorp.tech/awala-endpoint-internet', - datacontenttype: 'application/vnd.veraid.member-bundle-request', + datacontenttype: 'application/vnd.veraid-authority.member-bundle-request', }); const response = await postEvent(cloudEvent, server); @@ -138,7 +138,7 @@ describe('Awala routes', () => { source: AWALA_PEER_ID, type: INCOMING_SERVICE_MESSAGE_TYPE, subject: 'https://relaycorp.tech/awala-endpoint-internet', - datacontenttype: 'application/vnd.veraid.member-bundle-request', + datacontenttype: 'application/vnd.veraid-authority.member-bundle-request', expiry: formatISO(expiry), data: JSON.stringify(validMessageContent), }); @@ -249,7 +249,7 @@ describe('Awala routes', () => { source: AWALA_PEER_ID, type: INCOMING_SERVICE_MESSAGE_TYPE, subject: 'https://relaycorp.tech/awala-endpoint-internet', - datacontenttype: 'application/vnd.veraid.member-public-key-import', + datacontenttype: 'application/vnd.veraid-authority.member-public-key-import', expiry: formatISO(expiry), data: JSON.stringify(importRequest), }); diff --git a/src/awala/routes/awala.routes.ts b/src/awala/routes/awala.routes.ts index 2f9f5f86..2f8b98f5 100644 --- a/src/awala/routes/awala.routes.ts +++ b/src/awala/routes/awala.routes.ts @@ -73,8 +73,8 @@ async function processMemberKeyImportRequest( } enum AwalaRequestMessageType { - MEMBER_BUNDLE_REQUEST = 'application/vnd.veraid.member-bundle-request', - MEMBER_PUBLIC_KEY_IMPORT = 'application/vnd.veraid.member-public-key-import', + MEMBER_BUNDLE_REQUEST = 'application/vnd.veraid-authority.member-bundle-request', + MEMBER_PUBLIC_KEY_IMPORT = 'application/vnd.veraid-authority.member-public-key-import', } const awalaEventToProcessor: { diff --git a/src/functionalTests/awala.test.ts b/src/functionalTests/awala.test.ts index 0968d400..974189ed 100644 --- a/src/functionalTests/awala.test.ts +++ b/src/functionalTests/awala.test.ts @@ -110,7 +110,7 @@ async function makeKeyImportEvent(memberPublicKey: CryptoKey, publicKeyImportTok subject: 'https://relaycorp.tech/awala-endpoint-internet', time: formatISO(now), expiry: formatISO(addMinutes(now, 1)), - datacontenttype: 'application/vnd.veraid.member-public-key-import', + datacontenttype: 'application/vnd.veraid-authority.member-public-key-import', data: importRequest, }); } diff --git a/src/memberKeyImportToken.spec.ts b/src/memberKeyImportToken.spec.ts index cd56b0de..85189313 100644 --- a/src/memberKeyImportToken.spec.ts +++ b/src/memberKeyImportToken.spec.ts @@ -166,7 +166,7 @@ describe('member key import token', () => { source: 'https://veraid.net/authority/awala-member-key-import', type: BUNDLE_REQUEST_TYPE, subject: AWALA_PEER_ID, - datacontenttype: 'application/vnd.veraid.member-public-key-import', + datacontenttype: 'application/vnd.veraid-authority.member-public-key-import', data: '', }), ); diff --git a/src/memberKeyImportToken.ts b/src/memberKeyImportToken.ts index 7ced061d..0ad5c471 100644 --- a/src/memberKeyImportToken.ts +++ b/src/memberKeyImportToken.ts @@ -82,7 +82,7 @@ export async function processMemberKeyImportToken( source: 'https://veraid.net/authority/awala-member-key-import', type: BUNDLE_REQUEST_TYPE, subject: peerId, - datacontenttype: 'application/vnd.veraid.member-public-key-import', + datacontenttype: 'application/vnd.veraid-authority.member-public-key-import', data: '', }); const ceEmitter = await Emitter.init(EmitterChannel.AWALA_OUTGOING_MESSAGES); diff --git a/src/utilities/veraid.ts b/src/utilities/veraid.ts index 94dc3a54..967952e6 100644 --- a/src/utilities/veraid.ts +++ b/src/utilities/veraid.ts @@ -1,3 +1,3 @@ export enum VeraidContentType { - MEMBER_BUNDLE = 'application/vnd.veraid.member-bundle', + MEMBER_BUNDLE = 'application/vnd.veraid-authority.member-bundle', }