Skip to content

Commit 910372c

Browse files
authored
Merge pull request #571 from twilio-labs/passkeys-env-variables
(passkeys-backend) Change RELYING_PARTY to DOMAIN_NAME to use build in function context
2 parents 8bc9426 + 2082499 commit 910372c

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

passkeys-backend/.env.example

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@
33
# required: true
44
API_URL=
55

6-
# description: The domain of the relying party
7-
# format: url
8-
# required: true
9-
RELYING_PARTY=
10-
116
# description: The domain of the adroid identity provider
127
# format: list(text)
138
# required: false

passkeys-backend/functions/authentication/start.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const axios = require('axios');
22

33
// eslint-disable-next-line consistent-return
44
exports.handler = async (context, _, callback) => {
5-
const { RELYING_PARTY, API_URL } = context;
5+
const { DOMAIN_NAME, API_URL } = context;
66

77
const response = new Twilio.Response();
88
response.appendHeader('Content-Type', 'application/json');
@@ -12,7 +12,7 @@ exports.handler = async (context, _, callback) => {
1212
const requestBody = {
1313
content: {
1414
// eslint-disable-next-line camelcase
15-
rp_id: RELYING_PARTY,
15+
rp_id: DOMAIN_NAME,
1616
},
1717
};
1818

passkeys-backend/functions/registration/start.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const assets = Runtime.getAssets();
44
const { detectMissingParams } = require(assets['/services/helpers.js'].path);
55

66
exports.handler = async (context, event, callback) => {
7-
const { RELYING_PARTY, API_URL, ANDROID_APP_KEYS } = context;
7+
const { DOMAIN_NAME, API_URL, ANDROID_APP_KEYS } = context;
88

99
const response = new Twilio.Response();
1010
response.appendHeader('Content-Type', 'application/json');
@@ -31,10 +31,10 @@ exports.handler = async (context, event, callback) => {
3131
},
3232
content: {
3333
relying_party: {
34-
id: RELYING_PARTY,
34+
id: DOMAIN_NAME,
3535
name: 'PasskeySample',
3636
origins: [
37-
`https://${RELYING_PARTY}`,
37+
`https://${DOMAIN_NAME}`,
3838
...(ANDROID_APP_KEYS?.split(',') ?? []),
3939
],
4040
},

passkeys-backend/tests/registration-start.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jest.mock('axios');
77

88
const mockContext = {
99
API_URL: 'https://api.com',
10-
RELYING_PARTY: 'example.com',
10+
DOMAIN_NAME: 'example.com',
1111
ANDROID_APP_KEYS: 'key1,key2,key3',
1212
getTwilioClient: () => ({
1313
username: 'mockUsername',
@@ -93,7 +93,7 @@ describe('registration/start', () => {
9393

9494
const mockContextWithoutAndroidKeys = {
9595
API_URL: 'https://api.com',
96-
RELYING_PARTY: 'example.com',
96+
DOMAIN_NAME: 'example.com',
9797
getTwilioClient: () => ({
9898
username: 'mockUsername',
9999
password: 'mockPassword',

0 commit comments

Comments
 (0)