Skip to content

Commit

Permalink
fix: Change content type prefix to application/vnd.veraid-authority.
Browse files Browse the repository at this point in the history
  • Loading branch information
gnarea committed Aug 24, 2023
1 parent 8568d0a commit 9b059b9
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions docs/api-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ 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.
- The Awala Parcel Delivery Authorisation (PDA).
- 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).
Expand Down
6 changes: 3 additions & 3 deletions docs/awala.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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`.
2 changes: 1 addition & 1 deletion docs/queue-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
6 changes: 3 additions & 3 deletions src/awala/routes/awala.routes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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),
});
Expand Down Expand Up @@ -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),
});
Expand Down
4 changes: 2 additions & 2 deletions src/awala/routes/awala.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion src/functionalTests/awala.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/memberKeyImportToken.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
}),
);
Expand Down
2 changes: 1 addition & 1 deletion src/memberKeyImportToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/veraid.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export enum VeraidContentType {
MEMBER_BUNDLE = 'application/vnd.veraid.member-bundle',
MEMBER_BUNDLE = 'application/vnd.veraid-authority.member-bundle',
}

0 comments on commit 9b059b9

Please sign in to comment.