feat(registry): add declarative protocol routing and request-scoped storage hook context across registries
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import type { SmartRegistry } from '../../ts/classes.smartregistry.js';
|
||||
|
||||
/**
|
||||
* Helper to create test authentication tokens.
|
||||
*/
|
||||
export async function createTestTokens(registry: SmartRegistry) {
|
||||
const authManager = registry.getAuthManager();
|
||||
|
||||
const userId = await authManager.authenticate({
|
||||
username: 'testuser',
|
||||
password: 'testpass',
|
||||
});
|
||||
|
||||
if (!userId) {
|
||||
throw new Error('Failed to authenticate test user');
|
||||
}
|
||||
|
||||
const npmToken = await authManager.createNpmToken(userId, false);
|
||||
const ociToken = await authManager.createOciToken(userId, ['oci:repository:*:*'], 3600);
|
||||
const mavenToken = await authManager.createMavenToken(userId, false);
|
||||
const composerToken = await authManager.createComposerToken(userId, false);
|
||||
const cargoToken = await authManager.createCargoToken(userId, false);
|
||||
const pypiToken = await authManager.createPypiToken(userId, false);
|
||||
const rubygemsToken = await authManager.createRubyGemsToken(userId, false);
|
||||
|
||||
return { npmToken, ociToken, mavenToken, composerToken, cargoToken, pypiToken, rubygemsToken, userId };
|
||||
}
|
||||
Reference in New Issue
Block a user