enhance: Set default Node.js version to v26 (#17623)

* enhance: Set default Node.js version to v26

* fix

* Update Changelog

* fix types

* drop node v22

* update changelog

* fix test

* update

* fix test

* fix test

* Revert "drop node v22"

This reverts commit bb4e011628.

* fix changelog

* attempt to fix test

* attempt to fix test

* fix: update re2 that supports node 26

* attempt to fix test

* attempt to fix test

* run pnpm dedupe

* restore 2fa e2e

* refactor

* attempt to fix test

* attempt to fix test

* run pnpm dedupe

* attempt to fix test
This commit is contained in:
かっこかり
2026-06-28 00:06:49 +09:00
committed by GitHub
parent ba3fb4aa14
commit 4f993cef1b
24 changed files with 329 additions and 436 deletions
+15 -13
View File
@@ -7,7 +7,7 @@ process.env.NODE_ENV = 'test';
import * as assert from 'assert';
import * as crypto from 'node:crypto';
import cbor from 'cbor';
import { encode as encodeToCbor } from 'cbor2';
import * as OTPAuth from 'otpauth';
import { loadConfig } from '@/config.js';
import { api, signup, sendEnvUpdateRequest } from '../utils.js';
@@ -61,7 +61,7 @@ describe('2要素認証', () => {
const keyDoneParam = (param: {
token: string,
keyName: string,
credentialId: Buffer,
credentialId: Uint8Array,
creationOptions: PublicKeyCredentialCreationOptionsJSON,
}): {
token: string,
@@ -70,10 +70,10 @@ describe('2要素認証', () => {
credential: RegistrationResponseJSON,
} => {
// A COSE encoded public key
const credentialPublicKey = cbor.encode(new Map<number, unknown>([
const credentialPublicKey = encodeToCbor(new Map<number, unknown>([
[-1, coseEc2CrvP256],
[-2, Buffer.from(coseEc2X, 'hex')],
[-3, Buffer.from(coseEc2Y, 'hex')],
[-2, Uint8Array.from(Buffer.from(coseEc2X, 'hex'))],
[-3, Uint8Array.from(Buffer.from(coseEc2Y, 'hex'))],
[1, coseKtyEc2],
[2, coseKid],
[3, coseAlgEs256],
@@ -85,21 +85,23 @@ describe('2要素認証', () => {
credentialIdLength.writeUInt16BE(param.credentialId.length, 0);
const authData = Buffer.concat([
rpIdHash(), // rpIdHash(32)
Buffer.from([0x45]), // flags(1)
Buffer.from([0x00, 0x00, 0x00, 0x00]), // signCount(4)
Buffer.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]), // AAGUID(16)
new Uint8Array([0x45]), // flags(1)
new Uint8Array(4), // signCount(4)
new Uint8Array(16), // AAGUID(16)
credentialIdLength,
param.credentialId,
credentialPublicKey,
]);
const credentialIdBase64url = Buffer.from(param.credentialId).toString('base64url');
return {
password,
token: param.token,
name: param.keyName,
credential: <RegistrationResponseJSON>{
id: param.credentialId.toString('base64url'),
rawId: param.credentialId.toString('base64url'),
id: credentialIdBase64url,
rawId: credentialIdBase64url,
response: <AuthenticatorAttestationResponseJSON>{
clientDataJSON: Buffer.from(JSON.stringify({
type: 'webauthn.create',
@@ -107,11 +109,11 @@ describe('2要素認証', () => {
origin: config.scheme + '://' + config.host,
androidPackageName: 'org.mozilla.firefox',
}), 'utf-8').toString('base64url'),
attestationObject: cbor.encode({
attestationObject: Buffer.from(encodeToCbor({
fmt: 'none',
attStmt: {},
authData,
}).toString('base64url'),
authData: new Uint8Array(authData),
})).toString('base64url'),
},
clientExtensionResults: {},
type: 'public-key',