* refactor(connection): extract peer authentication providers * test(connection): cover provider lifecycle and satisfy package gates * fix(packaging): publish authentication provider locale resources * test(auth): use runtime login output and cover gateway admission * fix(auth): preserve Worker requests and migrate Desktop fixtures * refactor(auth): centralize route admission with required policy * fix(release): align authentication providers with rc.2 * refactor(connection): keep peer lookup and source policy private * test(gateway): cover centralized upgrade rejections * fix(ci): authenticate homepage compression probe * refactor(auth): let Token own API socket lifecycle * fix(auth): prevent caching admission refusals and clarify ownership * refactor(web): collect provider entry URLs after readiness * refactor(webserver): name the shared entry URL event * refactor(connection): provide authentication as a nested service * fix(web-app): restore startup publication defaults * fix(auth): scope web events and preserve callback flows * docs(auth): record the implemented provider architecture * fix(auth): require owner access for administrative routes
45 lines
1.7 KiB
TypeScript
45 lines
1.7 KiB
TypeScript
/** Mutable credential records used by the token implementation tests. */
|
|
import { CredentialProvider, type CredentialRecord } from '@deepseek-ai/dsh-credentials'
|
|
import { Context } from '@deepseek-ai/cordis'
|
|
import { onTestFinished } from 'vitest'
|
|
|
|
export class RecordCredentials extends CredentialProvider {
|
|
constructor() {
|
|
const ctx = new Context()
|
|
super(ctx)
|
|
onTestFinished(() => ctx.fiber.dispose())
|
|
}
|
|
|
|
override resolve(): never { throw new Error('Reference resolution is outside this fixture') }
|
|
override describe(): never { throw new Error('Reference description is outside this fixture') }
|
|
override set(): never { throw new Error('Reference writes are outside this fixture') }
|
|
override unset(): never { throw new Error('Reference removal is outside this fixture') }
|
|
override describeRecord(): never { throw new Error('Record description is outside this fixture') }
|
|
override listRecords(): never { throw new Error('Record enumeration is outside this fixture') }
|
|
record: CredentialRecord | undefined
|
|
discardWrites = false
|
|
reads = 0
|
|
modifies = 0
|
|
|
|
override readRecord(): Promise<CredentialRecord | undefined> {
|
|
this.reads += 1
|
|
return Promise.resolve(this.record)
|
|
}
|
|
|
|
override async modifyRecord(
|
|
_key: unknown,
|
|
mutate: (current: CredentialRecord | undefined) => Promise<CredentialRecord | undefined>,
|
|
): Promise<CredentialRecord | undefined> {
|
|
this.modifies += 1
|
|
const next = await mutate(this.record)
|
|
if (this.discardWrites) return undefined
|
|
if (next !== undefined) this.record = next
|
|
return this.record
|
|
}
|
|
|
|
override deleteRecord(): Promise<void> {
|
|
this.record = undefined
|
|
return Promise.resolve()
|
|
}
|
|
}
|