@cookiemunch/sdk 0.32.0 → 0.33.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.ts CHANGED
@@ -20,7 +20,7 @@ import type { ConformanceReport } from './executor-conformance.js';
20
20
  * This package's version, sent in the default User-Agent. Cloudflare answers a request with
21
21
  * no recognisable User-Agent with `403 error code: 1010`; a test pins this to package.json.
22
22
  */
23
- export declare const SDK_VERSION = "0.32.0";
23
+ export declare const SDK_VERSION = "0.33.0";
24
24
  export interface CookieMunchOptions {
25
25
  apiKey: string;
26
26
  /** "https://api.cookiemunch.net" — the /v1 prefix is appended automatically. */
@@ -4090,3 +4090,12 @@ export interface CookieMunchClient {
4090
4090
  };
4091
4091
  }
4092
4092
  export declare function createCookieMunch(opts: CookieMunchOptions): CookieMunchClient;
4093
+ /**
4094
+ * The account-link URL for a person your server has verified is signed in (CM-14): wraps
4095
+ * `rightsLinks.create` (POST /v1/sites/{cbid}/rights-links) and answers just the `url`. Pass a client,
4096
+ * or the options to build one with a `dsar:rights-links` (or `dsar:write`) key. Call it from a route
4097
+ * that reads the subject from your own session, never from the browser's input.
4098
+ */
4099
+ export declare function rightsLink(clientOrOptions: Pick<CookieMunchClient, 'rightsLinks'> | CookieMunchOptions, input: RightsLinkInput & {
4100
+ cbid: string;
4101
+ }): Promise<string>;
package/dist/index.js CHANGED
@@ -89,7 +89,7 @@ async function exchangeOperatorToken(input) {
89
89
  }
90
90
 
91
91
  // src/index.ts
92
- var SDK_VERSION = "0.32.0";
92
+ var SDK_VERSION = "0.33.0";
93
93
  var CookieMunchApiError = class extends Error {
94
94
  constructor(status, message, code, body) {
95
95
  super(message);
@@ -631,6 +631,11 @@ function createCookieMunch(opts) {
631
631
  }
632
632
  };
633
633
  }
634
+ async function rightsLink(clientOrOptions, input) {
635
+ const client = "rightsLinks" in clientOrOptions ? clientOrOptions : createCookieMunch(clientOrOptions);
636
+ const { cbid, ...body } = input;
637
+ return (await client.rightsLinks.create(cbid, body)).url;
638
+ }
634
639
  export {
635
640
  CANARY_ISSUER,
636
641
  CONFORMANCE_RULES,
@@ -648,6 +653,7 @@ export {
648
653
  mintConsentSyncToken,
649
654
  parseConsentValue,
650
655
  readConsent,
656
+ rightsLink,
651
657
  runExecutorConformance,
652
658
  secretPaths,
653
659
  verifyDecisionSignature,