@ucanto/interface
Advanced tools
Comparing version 8.1.0 to 9.0.0
import { Ability, Capability, DID, Link, Resource } from '@ipld/dag-ucan'; | ||
import * as UCAN from '@ipld/dag-ucan'; | ||
import { Delegation, Result, Failure, PrincipalParser, PrincipalResolver, URI, UCANLink, Await, IssuedInvocationView, UCANOptions, Verifier } from './lib.js'; | ||
import { Delegation, Result, Failure, PrincipalParser, PrincipalResolver, URI, UCANLink, Await, IssuedInvocationView, UCANOptions, Verifier, Unit } from './lib.js'; | ||
export interface Source { | ||
@@ -274,2 +274,5 @@ capability: { | ||
} | ||
export interface RevocationChecker { | ||
validateAuthorization: (authorization: Authorization) => Await<Result<Unit, Revoked>>; | ||
} | ||
export interface Validator { | ||
@@ -286,6 +289,6 @@ /** | ||
} | ||
export interface ValidationOptions<C extends ParsedCapability = ParsedCapability> extends Partial<CanIssue>, Validator, PrincipalOptions, PrincipalResolver, ProofResolver { | ||
export interface ValidationOptions<C extends ParsedCapability = ParsedCapability> extends Partial<CanIssue>, Validator, PrincipalOptions, PrincipalResolver, ProofResolver, RevocationChecker { | ||
capability: CapabilityParser<Match<C, any>>; | ||
} | ||
export interface ClaimOptions extends Partial<CanIssue>, Validator, PrincipalOptions, PrincipalResolver, ProofResolver { | ||
export interface ClaimOptions extends Partial<CanIssue>, Validator, PrincipalOptions, PrincipalResolver, ProofResolver, RevocationChecker { | ||
} | ||
@@ -328,2 +331,6 @@ export interface DelegationError extends Failure { | ||
} | ||
export interface Revoked extends Failure { | ||
readonly name: 'Revoked'; | ||
readonly delegation: Delegation; | ||
} | ||
export interface NotValidBefore extends Failure { | ||
@@ -348,3 +355,3 @@ readonly name: 'NotValidBefore'; | ||
*/ | ||
export type InvalidProof = Expired | NotValidBefore | InvalidSignature | InvalidAudience | SessionEscalation | DIDKeyResolutionError | UnavailableProof; | ||
export type InvalidProof = Expired | Revoked | NotValidBefore | InvalidSignature | InvalidAudience | SessionEscalation | DIDKeyResolutionError | UnavailableProof; | ||
export interface Unauthorized extends Failure { | ||
@@ -357,2 +364,9 @@ name: 'Unauthorized'; | ||
} | ||
export interface Authorization<Capability extends ParsedCapability = ParsedCapability> { | ||
delegation: Delegation; | ||
capability: Capability; | ||
proofs: Authorization[]; | ||
issuer: UCAN.Principal; | ||
audience: UCAN.Principal; | ||
} | ||
export interface InvalidClaim extends Failure { | ||
@@ -359,0 +373,0 @@ issuer: UCAN.Principal; |
import { Ability, Block as UCANBlock, ByteView, Capabilities, Capability, DID, Fact, Link as UCANLink, MultihashHasher, MultihashDigest, MultibaseDecoder, MultibaseEncoder, Phantom, Resource, Signature, SignatureView, Principal, MulticodecCode, SigAlg, ToJSON, SignatureJSON, JSONUnknown, Crypto, JSONObject } from '@ipld/dag-ucan'; | ||
import { Link, UnknownLink, Block as IPLDBlock, ToString, BlockEncoder } from 'multiformats'; | ||
import * as UCAN from '@ipld/dag-ucan'; | ||
import { CanIssue, Match, InvalidAudience, Unauthorized, UnavailableProof, DIDKeyResolutionError, ParsedCapability, CapabilityParser, InferCapability } from './capability.js'; | ||
import { CanIssue, Match, InvalidAudience, Unauthorized, UnavailableProof, DIDKeyResolutionError, ParsedCapability, CapabilityParser, Revoked, InferCapability, Authorization } from './capability.js'; | ||
import type * as Transport from './transport.js'; | ||
@@ -608,2 +608,3 @@ import type { Tuple, Block } from './transport.js'; | ||
readonly resolve?: InvocationContext['resolve']; | ||
validateAuthorization: (proofs: Authorization) => Await<Result<Unit, Revoked>>; | ||
} | ||
@@ -610,0 +611,0 @@ export interface ServerOptions extends ValidatorOptions { |
{ | ||
"name": "@ucanto/interface", | ||
"description": "interface definitions for ucanto", | ||
"version": "8.1.0", | ||
"version": "9.0.0", | ||
"types": "./dist/src/lib.d.ts", | ||
@@ -6,0 +6,0 @@ "main": "./src/lib.js", |
@@ -15,2 +15,3 @@ import { Ability, Capability, DID, Link, Resource } from '@ipld/dag-ucan' | ||
Verifier, | ||
Unit, | ||
} from './lib.js' | ||
@@ -354,2 +355,8 @@ | ||
export interface RevocationChecker { | ||
validateAuthorization: ( | ||
authorization: Authorization | ||
) => Await<Result<Unit, Revoked>> | ||
} | ||
export interface Validator { | ||
@@ -373,3 +380,4 @@ /** | ||
PrincipalResolver, | ||
ProofResolver { | ||
ProofResolver, | ||
RevocationChecker { | ||
capability: CapabilityParser<Match<C, any>> | ||
@@ -383,3 +391,4 @@ } | ||
PrincipalResolver, | ||
ProofResolver {} | ||
ProofResolver, | ||
RevocationChecker {} | ||
@@ -432,2 +441,7 @@ export interface DelegationError extends Failure { | ||
export interface Revoked extends Failure { | ||
readonly name: 'Revoked' | ||
readonly delegation: Delegation | ||
} | ||
export interface NotValidBefore extends Failure { | ||
@@ -457,2 +471,3 @@ readonly name: 'NotValidBefore' | ||
| Expired | ||
| Revoked | ||
| NotValidBefore | ||
@@ -474,2 +489,13 @@ | InvalidSignature | ||
export interface Authorization< | ||
Capability extends ParsedCapability = ParsedCapability | ||
> { | ||
delegation: Delegation | ||
capability: Capability | ||
proofs: Authorization[] | ||
issuer: UCAN.Principal | ||
audience: UCAN.Principal | ||
} | ||
export interface InvalidClaim extends Failure { | ||
@@ -476,0 +502,0 @@ issuer: UCAN.Principal |
@@ -45,3 +45,5 @@ import { | ||
CapabilityParser, | ||
Revoked, | ||
InferCapability, | ||
Authorization, | ||
} from './capability.js' | ||
@@ -978,2 +980,3 @@ import type * as Transport from './transport.js' | ||
readonly resolve?: InvocationContext['resolve'] | ||
validateAuthorization: (proofs: Authorization) => Await<Result<Unit, Revoked>> | ||
} | ||
@@ -980,0 +983,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
142764
2923