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

Invitation Code Verification Module #32

Closed
Closed
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
19bf2f3
Impl `InvitationCodeVerifier`
MatthewTurk247 May 23, 2024
67e124b
Remove extraneous lines
MatthewTurk247 May 24, 2024
fc583c9
Merge option
MatthewTurk247 May 24, 2024
99be22a
Remove extraneous lines
MatthewTurk247 May 24, 2024
45516bd
Update license headers
MatthewTurk247 May 24, 2024
3b9d97e
Setting up linter
MatthewTurk247 May 25, 2024
deca8ff
Add JSDoc comments
MatthewTurk247 May 25, 2024
6ed977f
Minor refactoring
MatthewTurk247 May 25, 2024
7c71871
Linting
MatthewTurk247 May 25, 2024
986e24f
Update license headers
MatthewTurk247 May 25, 2024
e6ac4af
Remove `firestore` param from constructor
MatthewTurk247 May 25, 2024
14c5e6f
Skeleton test setup
MatthewTurk247 May 26, 2024
864eaab
Might need multiple invitation codes
MatthewTurk247 May 26, 2024
4cc4a1c
Reordering tests
MatthewTurk247 May 26, 2024
c8efe1a
Further reordering
MatthewTurk247 May 26, 2024
d212e43
Tests successful
MatthewTurk247 May 26, 2024
12d41ac
Remove extraneous lines
MatthewTurk247 May 26, 2024
29924ca
Add license files
MatthewTurk247 May 26, 2024
8b6ad2a
Add license for `firebase` folder
MatthewTurk247 May 26, 2024
7155f49
Fixed typo
MatthewTurk247 May 26, 2024
7c5e671
Fixed another typo
MatthewTurk247 May 26, 2024
412d5e3
Update spezi-invitation-code/firebase.json
MatthewTurk247 May 28, 2024
9fa7e76
Remove storage from Firebase configuration
MatthewTurk247 May 28, 2024
ac67738
Remove storage from Firebase rules
MatthewTurk247 May 28, 2024
54ffb7f
Update license headers
MatthewTurk247 May 28, 2024
6934a9c
Remove storage from rules
MatthewTurk247 May 30, 2024
c106269
Remove leftover files
MatthewTurk247 May 30, 2024
2dfbe80
Merge branch 'main' into invitation-codes
PSchmiedmayer May 31, 2024
ce1c46a
Separating tests
MatthewTurk247 May 31, 2024
da6ec17
More separation of tests
MatthewTurk247 May 31, 2024
91e8714
More separation of tests
MatthewTurk247 May 31, 2024
26a6519
Tests are looking good so far
MatthewTurk247 May 31, 2024
dbd53d0
Improved tests
MatthewTurk247 May 31, 2024
15c14e9
Remove leftover lines
MatthewTurk247 May 31, 2024
365b4d4
Remove unnecessary `async` markers
MatthewTurk247 May 31, 2024
6adea61
Improve teardown code
MatthewTurk247 Jun 1, 2024
d041293
Found `https.CallableRequest` definition
MatthewTurk247 Jun 3, 2024
82aa6be
Fixed typo
MatthewTurk247 Jun 3, 2024
058b1ab
GitHub Actions for JS tests
MatthewTurk247 Jun 4, 2024
06596cb
Specify working directory
MatthewTurk247 Jun 4, 2024
2ceeb21
Specify working directory
MatthewTurk247 Jun 4, 2024
a9472c1
Setting path for JS tests
MatthewTurk247 Jun 4, 2024
e0c7073
Basic steps for `testandcoverage`
MatthewTurk247 Jun 4, 2024
7dd6fb9
Fixed typos
MatthewTurk247 Jun 4, 2024
31dd937
Trying again
MatthewTurk247 Jun 4, 2024
6dc5df2
Try again to get GitHub Actions working
MatthewTurk247 Jun 4, 2024
f3be790
Trying `cd` now
MatthewTurk247 Jun 4, 2024
ae88231
Navigate to proper directory
MatthewTurk247 Jun 5, 2024
717bcc4
Try working directory again
MatthewTurk247 Jun 5, 2024
0cdfe52
Set defaults for working directory
MatthewTurk247 Jun 5, 2024
0565122
Merge branch 'main' into invitation-codes
MatthewTurk247 Jun 13, 2024
cf863d6
Pass in working directory
MatthewTurk247 Jun 13, 2024
8fbbdf0
Update build-and-test.yml
PSchmiedmayer Jun 13, 2024
22353b0
Update build-and-test.yml
PSchmiedmayer Jun 13, 2024
8e6b624
Update build-and-test.yml
PSchmiedmayer Jun 13, 2024
5c793c0
Update Setup
PSchmiedmayer Jun 13, 2024
8405eb1
New documentation, including diagram
MatthewTurk247 Jun 13, 2024
d7d0701
Adjustments to syntax
MatthewTurk247 Jun 13, 2024
6f29861
Missed a line
MatthewTurk247 Jun 13, 2024
613cc30
Additional documentation
MatthewTurk247 Jun 13, 2024
f9dd48c
More documentation
MatthewTurk247 Jun 13, 2024
f02449d
Is `admin.initializeApp()` necessary in the tests?
MatthewTurk247 Jun 13, 2024
a337b4e
`initializeApp` is back
MatthewTurk247 Jun 13, 2024
ec6a24d
Update license headers
MatthewTurk247 Jun 13, 2024
7527b0d
Update license headers
MatthewTurk247 Jun 13, 2024
1e08db5
Update license headers
MatthewTurk247 Jun 13, 2024
f812eb0
Load in credentials
MatthewTurk247 Jun 14, 2024
16f2fcd
Update build-and-test.yml
PSchmiedmayer Jun 15, 2024
ebd0a1d
Load in `GOOGLE_APPLICATION_CREDENTIALS_BASE64`
MatthewTurk247 Jun 15, 2024
cc14034
Will try loading credentials again
MatthewTurk247 Jun 15, 2024
6012cf4
Next attempt
MatthewTurk247 Jun 15, 2024
3a0dd97
Next attempt
MatthewTurk247 Jun 15, 2024
8384a19
Set env
MatthewTurk247 Jun 15, 2024
7f49d7b
Next attempt
MatthewTurk247 Jun 15, 2024
cc53296
Next attempt
MatthewTurk247 Jun 15, 2024
a85c06d
Inspect length of string
MatthewTurk247 Jun 15, 2024
b72c219
Inspect length of string
MatthewTurk247 Jun 15, 2024
0b50b2f
Does not seem like `GOOGLE_APPLICATION_CREDENTIALS_BASE64` is loading in
MatthewTurk247 Jun 15, 2024
7cdcb6e
Trying that again with modified script
MatthewTurk247 Jun 15, 2024
a52dc46
Next attempt
MatthewTurk247 Jun 15, 2024
4987d67
Next attempt
MatthewTurk247 Jun 15, 2024
fc641ce
Next attempt
MatthewTurk247 Jun 15, 2024
aeb9651
Next attempt
MatthewTurk247 Jun 15, 2024
0d4229c
Next attempt
MatthewTurk247 Jun 15, 2024
82cfa37
Next attempt
MatthewTurk247 Jun 15, 2024
ef4dccf
Require credentials
MatthewTurk247 Jun 15, 2024
3403246
Require credentials
MatthewTurk247 Jun 15, 2024
49fccef
Require credentials
MatthewTurk247 Jun 15, 2024
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
Prev Previous commit
Next Next commit
Update license headers
MatthewTurk247 committed May 24, 2024
commit 45516bd447943ecfcb6daa06057dbde2369da69f
18 changes: 16 additions & 2 deletions spezi-invitation-code/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// This source file is part of the StudyApplication based on the Stanford Spezi Template Application project
// This source file is part of the Stanford Spezi open-source project
//
// SPDX-FileCopyrightText: 2023 Stanford University
// SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
//
// SPDX-License-Identifier: MIT
//
@@ -18,6 +18,20 @@ class InvitationCodeVerifier {
}

async enrollUserInStudy(userId, invitationCode) {
if (!userId || typeof userId !== 'string') {
throw new https.HttpsError(
"invalid-argument",
"The function must be called with a valid 'userId'.",
);
}

if (!invitationCode || typeof invitationCode !== 'string') {
throw new https.HttpsError(
"invalid-argument",
"The function must be called with a valid 'invitationCode'.",
);
}

const invitationCodeRef = this.firestore.doc(`${this.invitationCodePath}/${invitationCode}`);
const invitationCodeDoc = await invitationCodeRef.get();

Loading