summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/authentication/generateAuthenticationOptions.test.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2024-01-19 22:34:37 -0800
committerGitHub <noreply@github.com>2024-01-19 22:34:37 -0800
commitdd387e656c4877f188f1e5fe83202ac5e1782664 (patch)
tree9ca5925a1ffff6f755ca436598e3b72f3f117167 /packages/server/src/authentication/generateAuthenticationOptions.test.ts
parent2f4d01b6a1831bfeb22befe220995a2c4f01c905 (diff)
parent65ec8a1f8a83657ab1609e9bc631dc6c3062dd85 (diff)
Merge pull request #507 from MasterKale/fix/503-consistent-utf8-challenge-strings
fix/503-consistent-utf8-challenge-strings
Diffstat (limited to 'packages/server/src/authentication/generateAuthenticationOptions.test.ts')
-rw-r--r--packages/server/src/authentication/generateAuthenticationOptions.test.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/server/src/authentication/generateAuthenticationOptions.test.ts b/packages/server/src/authentication/generateAuthenticationOptions.test.ts
index f8ed0ca..8d55580 100644
--- a/packages/server/src/authentication/generateAuthenticationOptions.test.ts
+++ b/packages/server/src/authentication/generateAuthenticationOptions.test.ts
@@ -132,6 +132,17 @@ Deno.test('should generate a challenge if one is not provided', async () => {
assert(isoBase64URL.isBase64url(options.challenge));
});
+Deno.test('should treat string challenges as UTF-8 strings', async () => {
+ const options = await generateAuthenticationOptions({
+ challenge: 'こんにちは',
+ });
+
+ assertEquals(
+ options.challenge,
+ '44GT44KT44Gr44Gh44Gv',
+ );
+});
+
Deno.test('should set rpId if specified', async () => {
const rpID = 'simplewebauthn.dev';