Basic example of how to make a UCAN. Note that the issuer always has to be your DID, because the UCAN will be signed with your private key.
import*as wn from"webnative"// DIDsconstourDID=awaitwn.did.ucan()constotherDID="did:key:EXAMPLE"/** * This can be another UCAN which has a bigger, or equal, * set of permissions than the UCAN we're building later. */constpossibleProof=null// or, other UCAN./** * The UCAN, encoded as a string. */constucan=awaitwn.ucan.build({ audience: otherDID, issuer: ourDID, lifetimeInSeconds:60*60*24,// UCAN expires in 24 hours proof: possibleProof})