summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/assertion/generateAssertionOptions.test.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2021-02-05 09:12:23 -0800
committerGitHub <noreply@github.com>2021-02-05 09:12:23 -0800
commit432ff68bab6b11f6ccbf549d8be397fd71da29f9 (patch)
tree9dc17be10efa4545a0b5a5a86236cf34405d133f /packages/server/src/assertion/generateAssertionOptions.test.ts
parent70c1360339d0e63dafd4a04fa1824d9453f0a802 (diff)
parent897291381dd45a94daf322cf533626fe7e235349 (diff)
Merge pull request #97 from MasterKale/feature/better-passwordless-usernameless
feature/better-passwordless-usernameless
Diffstat (limited to 'packages/server/src/assertion/generateAssertionOptions.test.ts')
-rw-r--r--packages/server/src/assertion/generateAssertionOptions.test.ts28
1 files changed, 14 insertions, 14 deletions
diff --git a/packages/server/src/assertion/generateAssertionOptions.test.ts b/packages/server/src/assertion/generateAssertionOptions.test.ts
index 24253bf..0208d9d 100644
--- a/packages/server/src/assertion/generateAssertionOptions.test.ts
+++ b/packages/server/src/assertion/generateAssertionOptions.test.ts
@@ -8,12 +8,12 @@ test('should generate credential request options suitable for sending via JSON',
const options = generateAssertionOptions({
allowCredentials: [
{
- id: Buffer.from('1234', 'ascii').toString('base64'),
+ id: Buffer.from('1234', 'ascii'),
type: 'public-key',
transports: ['usb', 'nfc'],
},
{
- id: Buffer.from('5678', 'ascii').toString('base64'),
+ id: Buffer.from('5678', 'ascii'),
type: 'public-key',
transports: ['internal'],
},
@@ -27,12 +27,12 @@ test('should generate credential request options suitable for sending via JSON',
challenge: 'dG90YWxseXJhbmRvbXZhbHVl',
allowCredentials: [
{
- id: 'MTIzNA==',
+ id: 'MTIzNA',
type: 'public-key',
transports: ['usb', 'nfc'],
},
{
- id: 'NTY3OA==',
+ id: 'NTY3OA',
type: 'public-key',
transports: ['internal'],
},
@@ -45,8 +45,8 @@ test('defaults to 60 seconds if no timeout is specified', () => {
const options = generateAssertionOptions({
challenge: 'totallyrandomvalue',
allowCredentials: [
- { id: Buffer.from('1234', 'ascii').toString('base64'), type: 'public-key' },
- { id: Buffer.from('5678', 'ascii').toString('base64'), type: 'public-key' },
+ { id: Buffer.from('1234', 'ascii'), type: 'public-key' },
+ { id: Buffer.from('5678', 'ascii'), type: 'public-key' },
],
});
@@ -57,8 +57,8 @@ test('should not set userVerification if not specified', () => {
const options = generateAssertionOptions({
challenge: 'totallyrandomvalue',
allowCredentials: [
- { id: Buffer.from('1234', 'ascii').toString('base64'), type: 'public-key' },
- { id: Buffer.from('5678', 'ascii').toString('base64'), type: 'public-key' },
+ { id: Buffer.from('1234', 'ascii'), type: 'public-key' },
+ { id: Buffer.from('5678', 'ascii'), type: 'public-key' },
],
});
@@ -88,8 +88,8 @@ test('should set userVerification if specified', () => {
const options = generateAssertionOptions({
challenge: 'totallyrandomvalue',
allowCredentials: [
- { id: Buffer.from('1234', 'ascii').toString('base64'), type: 'public-key' },
- { id: Buffer.from('5678', 'ascii').toString('base64'), type: 'public-key' },
+ { id: Buffer.from('1234', 'ascii'), type: 'public-key' },
+ { id: Buffer.from('5678', 'ascii'), type: 'public-key' },
],
userVerification: 'required',
});
@@ -101,8 +101,8 @@ test('should set extensions if specified', () => {
const options = generateAssertionOptions({
challenge: 'totallyrandomvalue',
allowCredentials: [
- { id: Buffer.from('1234', 'ascii').toString('base64'), type: 'public-key' },
- { id: Buffer.from('5678', 'ascii').toString('base64'), type: 'public-key' },
+ { id: Buffer.from('1234', 'ascii'), type: 'public-key' },
+ { id: Buffer.from('5678', 'ascii'), type: 'public-key' },
],
extensions: { appid: 'simplewebauthn' },
});
@@ -115,8 +115,8 @@ test('should set extensions if specified', () => {
test('should generate a challenge if one is not provided', () => {
const opts = {
allowCredentials: [
- { id: Buffer.from('1234', 'ascii').toString('base64'), type: 'public-key' },
- { id: Buffer.from('5678', 'ascii').toString('base64'), type: 'public-key' },
+ { id: Buffer.from('1234', 'ascii'), type: 'public-key' },
+ { id: Buffer.from('5678', 'ascii'), type: 'public-key' },
],
};