ucan.build
Create a UCAN, User Controlled Authorization Networks, JWT. This JWT can be used for authorization.
Header
alg
, Algorithm, the type of signature.
typ
, Type, the type of this data structure, JWT.
uav
, UCAN version.
Payload
aud
, Audience, the ID of who it's intended for.
exp
, Expiry, unix timestamp of when the jwt is no longer valid.
iss
, Issuer, the ID of who sent this.
nbf
, Not Before, unix timestamp of when the jwt becomes valid.
prf
, Proof, an optional nested token with equal or greater privileges.
ptc
, Potency, which rights come with the token.
rsc
, Resource, the involved resource.
function build({ addSignature, audience, dependencies, facts, issuer, lifetimeInSeconds, expiration, potency, proof, resource }: {
addSignature?: boolean;
audience: string;
dependencies: {
crypto: Crypto.Implementation;
}; facts?: Array<Fact>;
issuer: string;
lifetimeInSeconds?: number;
expiration?: number;
potency?: Potency;
proof?: string | Ucan;
resource?: Resource;
}): Promise<Ucan>;§
build({ addSignature, audience, dependencies, facts, issuer, lifetimeInSeconds, expiration, potency, proof, resource }: {
[src]addSignature?: boolean;
audience: string;
dependencies: {
crypto: Crypto.Implementation;
}; facts?: Array<Fact>;
issuer: string;
lifetimeInSeconds?: number;
expiration?: number;
potency?: Potency;
proof?: string | Ucan;
resource?: Resource;
}): Promise<Ucan>§Parameters
§
{ addSignature, audience, dependencies, facts, issuer, lifetimeInSeconds, expiration, potency, proof, resource }: {
[src]addSignature?: boolean;
audience: string;
dependencies: {
crypto: Crypto.Implementation;
}; facts?: Array<Fact>;
issuer: string;
lifetimeInSeconds?: number;
expiration?: number;
potency?: Potency;
proof?: string | Ucan;
resource?: Resource;
}