@secrecy/lib 1.58.0 → 1.59.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.
@@ -2,7 +2,6 @@ import { usersCache } from './cache.js';
2
2
  import { getStorage } from './client/storage.js';
3
3
  import { createTRPCClient, } from './client.js';
4
4
  import { getPreferedEmail } from './utils.js';
5
- import { getLink } from './utils/links.js';
6
5
  async function getPublicUser(client, id) {
7
6
  let user = usersCache.get(id);
8
7
  if (user !== undefined) {
@@ -78,10 +77,9 @@ export class BaseClient {
78
77
  }
79
78
  async getSponsorshipLink({ backUrl, }) {
80
79
  const me = await this.me();
81
- return getLink({
82
- app: 'auth',
83
- path: `/sign-up?gf=${btoa(getPreferedEmail(me.account.emails)?.email)}&au=${btoa(backUrl)}`,
84
- });
80
+ const hash = btoa(getPreferedEmail(me.account.emails)?.email);
81
+ const authUrl = this.baseUrl.replace('www', 'auth');
82
+ return `${authUrl}/sign-up/gf=${hash}&au=${btoa(backUrl)}`;
85
83
  }
86
84
  static getPaymentRequest = async ({ paymentRequestId, secrecyIdSeller, opts, }) => {
87
85
  const getPaymentRequestToPay = await BaseClient.getBaseClient(opts).stripe.paymentRequestToPay.query({
@@ -34,7 +34,7 @@ export function getSecrecyClient(session) {
34
34
  }
35
35
  return new SecrecyClient(uaSession, uaKeys, uaJwt);
36
36
  }
37
- export async function login({ appId, path, redirect, scopes, backPath, session, authUrl = 'https://www.secrecy.tech/auth/login', }) {
37
+ export async function login({ appId, path, redirect, scopes, backPath, session, authUrl = 'https://auth.secrecy.tech/login', }) {
38
38
  return await new Promise((resolve, reject) => {
39
39
  const appUrl = window.location.origin;
40
40
  const client = getSecrecyClient();
@@ -26,7 +26,7 @@ export const createTRPCClient = (opts) => createTRPCProxyClient({
26
26
  httpBatchLink({
27
27
  url: opts.baseUrl
28
28
  ? `${opts.baseUrl}/api/trpc`
29
- : 'https://www.secrecy.tech/api/trpc',
29
+ : 'https://api.secrecy.tech/trpc',
30
30
  maxURLLength: 2083,
31
31
  fetch: async (input, init) => {
32
32
  const controller = new AbortController();
@@ -43,7 +43,7 @@ export const createTRPCClient = (opts) => createTRPCProxyClient({
43
43
  headers,
44
44
  signal: controller.signal,
45
45
  mode: 'cors',
46
- credentials: 'same-origin',
46
+ credentials: 'include',
47
47
  });
48
48
  void call.finally(() => {
49
49
  clearTimeout(id);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@secrecy/lib",
3
3
  "author": "Anonymize <anonymize@gmail.com>",
4
4
  "description": "Anonymize Secrecy Library",
5
- "version": "1.58.0",
5
+ "version": "1.59.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/anonymize-org/lib.git"