Meshpocalypse Semantic
    Preparing search index...

    Class IdentityProvider

    JWT IdentityProvider — manages ES256 signing key pairs.

    const provider = new IdentityProvider();
    await provider.initialize();
    const { privateKey } = provider.activeKeyPair ?? {};
    With persistence
    import { JsonFileKeyPersistenceAdapter } from './JsonFileKeyPersistenceAdapter.js';
    const adapter = new JsonFileKeyPersistenceAdapter({ filePath: '/data/jwt-keys.json' });
    const provider = new IdentityProvider({ keyPersistenceAdapter: adapter });
    await provider.initialize();
    Index

    Constructors

    Accessors

    Methods

    • Initialise the provider.

      If a KeyPersistenceAdapter was provided and a persisted key set exists, those keys are loaded. Otherwise, a fresh key pair is generated and (if an adapter is configured) saved immediately.

      Returns Promise<void>

    • Rotate the signing key.

      The current active key becomes the previous key (grace period). A new key pair is generated and becomes the active key. If a KeyPersistenceAdapter is configured, the new key set is saved.

      Returns Promise<void>