@sphereon/ssi-sdk.public-key-hosting
Version:
59 lines (52 loc) • 2.26 kB
TypeScript
import * as _sphereon_ssi_types from '@sphereon/ssi-types';
import { JWK } from '@sphereon/ssi-types';
import { GenericAuthArgs, ISingleEndpointOpts, ExpressSupport } from '@sphereon/ssi-express-support';
import { IDIDManager, IKeyManager, IAgentContext, TAgent, IKey, IIdentifier } from '@veramo/core';
import express, { Express, Router } from 'express';
import { IIdentifierResolution } from '@sphereon/ssi-sdk-ext.identifier-resolution';
type IRequiredPlugins = IDIDManager & IKeyManager & IIdentifierResolution;
type IRequiredContext = IAgentContext<IRequiredPlugins>;
interface IPublicKeyHostingOpts {
endpointOpts?: IPKHostingAPIEndpointOpts;
hostingOpts?: IHostingOpts;
}
interface IPKHostingAPIEndpointOpts {
basePath?: string;
globalAuth?: GenericAuthArgs;
allJWKS?: ISingleEndpointOpts;
DIDJWKS?: ISingleEndpointOpts;
}
type publicKeyHostingFeatures = 'all-jwks' | 'did-jwks';
interface IHostingOpts {
enableFeatures?: publicKeyHostingFeatures[];
}
declare class PublicKeyHosting {
get router(): express.Router;
private readonly _express;
private readonly _agent;
private readonly _opts?;
private readonly _router;
constructor(args: {
agent: TAgent<IRequiredPlugins>;
expressSupport: ExpressSupport;
opts?: IPublicKeyHostingOpts;
});
get agent(): TAgent<IRequiredPlugins>;
get opts(): IPublicKeyHostingOpts | undefined;
get express(): Express;
}
declare const toJWKS: (args: {
keys: IKey | IKey[];
}) => {
keys: Array<JWK>;
};
declare const jwksURIFromIdentifier: (args: {
identifier: IIdentifier;
basePath?: string;
baseURL?: string;
onlyEncodeDid?: boolean;
}) => string;
declare function getAllJWKSEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
declare function getDIDJWKSEndpoint(router: Router, context: IRequiredContext, opts?: ISingleEndpointOpts): void;
declare const logger: _sphereon_ssi_types.ISimpleLogger<unknown>;
export { type IHostingOpts, type IPKHostingAPIEndpointOpts, type IPublicKeyHostingOpts, type IRequiredContext, type IRequiredPlugins, PublicKeyHosting, getAllJWKSEndpoint, getDIDJWKSEndpoint, jwksURIFromIdentifier, logger, type publicKeyHostingFeatures, toJWKS };