@ucanto/core
Version:
34 lines • 1.35 kB
TypeScript
export function principal(): PrincipalSchema<string>;
export function read(input: unknown): Schema.ReadResult<API.PrincipalView<`did:${string}:${string}` & `did:${string}` & API.Phantom<{
protocol: "did:";
}>>, API.Failure>;
export function match<Method extends string>(options?: {
method?: Method | undefined;
}): Schema.Schema<API.PrincipalView<`did:${Method}:${string}` & `did:${string}` & API.Phantom<{
protocol: "did:";
}>>, any>;
export function from(input: unknown): API.PrincipalView<`did:${string}:${string}` & `did:${string}` & API.Phantom<{
protocol: "did:";
}>>;
/**
* @template {string} Method
* @extends {Schema.API<API.PrincipalView<API.DID<Method> & API.URI<"did:">>, unknown, void|Method>}
*/
declare class PrincipalSchema<Method extends string> extends Schema.API<API.PrincipalView<`did:${Method}:${string}` & `did:${string}` & API.Phantom<{
protocol: "did:";
}>>, unknown, void | Method> {
constructor(settings: void | Method);
/**
* @param {unknown} source
* @param {void|Method} method
*/
readWith(source: unknown, method: void | Method): {
error: API.Failure;
} | {
ok: API.PrincipalView<`did:${Method}:${string}`>;
};
}
import * as API from '@ucanto/interface';
import * as Schema from './schema.js';
export {};
//# sourceMappingURL=principal.d.ts.map