@covia/covia-sdk 1.7.4 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1658,16 +1658,20 @@ interface UCANCapability {
1658
1658
  /** The did:key DID for a private key. */
1659
1659
  declare function didFor(privateKey: Uint8Array): string;
1660
1660
  /**
1661
- * Mint a UCAN as an EdDSA JWT: `{iss, aud, att, exp[, prf]}` signed by
1662
- * `privateKey` (iss = its did:key).
1661
+ * Mint a UCAN as an EdDSA JWT in the Convex UCAN JWT profile:
1662
+ * `{iss, aud, ucv, att, prf, exp}` signed by `privateKey` (iss = its did:key).
1663
+ * From Convex 0.8.11 venues parse only this profile: the `ucv` claim and the
1664
+ * `att`/`prf` arrays are always present, and the `exp` key is always present —
1665
+ * explicitly `null` for a non-expiring token (UCAN v0.10.0; an absent `exp`
1666
+ * is malformed).
1663
1667
  *
1664
1668
  * @param privateKey 32-byte Ed25519 private key (the issuer)
1665
1669
  * @param audienceDID who receives the token (`aud`)
1666
1670
  * @param att capabilities delegated (empty array = pure identity token)
1667
- * @param lifetimeSeconds validity window
1671
+ * @param lifetimeSeconds validity window, or `null` for a non-expiring token
1668
1672
  * @param proofs parent UCAN JWT strings (`prf`) for delegation chains
1669
1673
  */
1670
- declare function createUCANJWT(privateKey: Uint8Array, audienceDID: string, att: UCANCapability[], lifetimeSeconds: number, proofs?: string[]): string;
1674
+ declare function createUCANJWT(privateKey: Uint8Array, audienceDID: string, att: UCANCapability[], lifetimeSeconds: number | null, proofs?: string[]): string;
1671
1675
  /**
1672
1676
  * Mint an **identity token**: a UCAN with an EMPTY attenuation list, audienced
1673
1677
  * to `venueDID`. Pure proof of identity — it grants nothing, and being
package/dist/index.d.ts CHANGED
@@ -1658,16 +1658,20 @@ interface UCANCapability {
1658
1658
  /** The did:key DID for a private key. */
1659
1659
  declare function didFor(privateKey: Uint8Array): string;
1660
1660
  /**
1661
- * Mint a UCAN as an EdDSA JWT: `{iss, aud, att, exp[, prf]}` signed by
1662
- * `privateKey` (iss = its did:key).
1661
+ * Mint a UCAN as an EdDSA JWT in the Convex UCAN JWT profile:
1662
+ * `{iss, aud, ucv, att, prf, exp}` signed by `privateKey` (iss = its did:key).
1663
+ * From Convex 0.8.11 venues parse only this profile: the `ucv` claim and the
1664
+ * `att`/`prf` arrays are always present, and the `exp` key is always present —
1665
+ * explicitly `null` for a non-expiring token (UCAN v0.10.0; an absent `exp`
1666
+ * is malformed).
1663
1667
  *
1664
1668
  * @param privateKey 32-byte Ed25519 private key (the issuer)
1665
1669
  * @param audienceDID who receives the token (`aud`)
1666
1670
  * @param att capabilities delegated (empty array = pure identity token)
1667
- * @param lifetimeSeconds validity window
1671
+ * @param lifetimeSeconds validity window, or `null` for a non-expiring token
1668
1672
  * @param proofs parent UCAN JWT strings (`prf`) for delegation chains
1669
1673
  */
1670
- declare function createUCANJWT(privateKey: Uint8Array, audienceDID: string, att: UCANCapability[], lifetimeSeconds: number, proofs?: string[]): string;
1674
+ declare function createUCANJWT(privateKey: Uint8Array, audienceDID: string, att: UCANCapability[], lifetimeSeconds: number | null, proofs?: string[]): string;
1671
1675
  /**
1672
1676
  * Mint an **identity token**: a UCAN with an EMPTY attenuation list, audienced
1673
1677
  * to `venueDID`. Pure proof of identity — it grants nothing, and being
package/dist/index.js CHANGED
@@ -2913,6 +2913,7 @@ var Grid = class {
2913
2913
  // src/crypto/ucan.ts
2914
2914
  var encoder2 = new TextEncoder();
2915
2915
  var VENUE_RELAY = "venue/relay";
2916
+ var UCV_VERSION = "0.10.0";
2916
2917
  function didFor(privateKey) {
2917
2918
  return `did:key:${encodePublicKey(getPublicKey2(privateKey))}`;
2918
2919
  }
@@ -2923,10 +2924,11 @@ function createUCANJWT(privateKey, audienceDID, att, lifetimeSeconds, proofs = [
2923
2924
  const claims = {
2924
2925
  iss: `did:key:${multikey}`,
2925
2926
  aud: audienceDID,
2927
+ ucv: UCV_VERSION,
2926
2928
  att,
2927
- exp: nowSecs + lifetimeSeconds
2929
+ prf: proofs,
2930
+ exp: lifetimeSeconds === null ? null : nowSecs + lifetimeSeconds
2928
2931
  };
2929
- if (proofs.length) claims.prf = proofs;
2930
2932
  const signingInput = `${base64UrlEncode(encoder2.encode(header))}.${base64UrlEncode(encoder2.encode(JSON.stringify(claims)))}`;
2931
2933
  const signature = sign(encoder2.encode(signingInput), privateKey);
2932
2934
  return `${signingInput}.${base64UrlEncode(signature)}`;
package/dist/index.mjs CHANGED
@@ -2911,6 +2911,7 @@ var Grid = class {
2911
2911
  // src/crypto/ucan.ts
2912
2912
  var encoder2 = new TextEncoder();
2913
2913
  var VENUE_RELAY = "venue/relay";
2914
+ var UCV_VERSION = "0.10.0";
2914
2915
  function didFor(privateKey) {
2915
2916
  return `did:key:${encodePublicKey(getPublicKey2(privateKey))}`;
2916
2917
  }
@@ -2921,10 +2922,11 @@ function createUCANJWT(privateKey, audienceDID, att, lifetimeSeconds, proofs = [
2921
2922
  const claims = {
2922
2923
  iss: `did:key:${multikey}`,
2923
2924
  aud: audienceDID,
2925
+ ucv: UCV_VERSION,
2924
2926
  att,
2925
- exp: nowSecs + lifetimeSeconds
2927
+ prf: proofs,
2928
+ exp: lifetimeSeconds === null ? null : nowSecs + lifetimeSeconds
2926
2929
  };
2927
- if (proofs.length) claims.prf = proofs;
2928
2930
  const signingInput = `${base64UrlEncode(encoder2.encode(header))}.${base64UrlEncode(encoder2.encode(JSON.stringify(claims)))}`;
2929
2931
  const signature = sign(encoder2.encode(signingInput), privateKey);
2930
2932
  return `${signingInput}.${base64UrlEncode(signature)}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@covia/covia-sdk",
3
- "version": "1.7.4",
3
+ "version": "1.8.0",
4
4
  "description": "Typescript library for covia-ai",
5
5
  "packageManager": "pnpm@11.9.0",
6
6
  "main": "./dist/index.js",