@credenza3/partner-sdk 0.0.0-alpha.3 → 0.0.1-alpha.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/README.md CHANGED
@@ -21,7 +21,9 @@ useAuth({
21
21
 
22
22
  ## MODULES
23
23
 
24
- [common](./src/common/README.md)
24
+ [api](./src/api/README.md)
25
+
26
+ [accounts](./src/accounts/README.md)
25
27
 
26
28
  [evm](./src/evm/README.md)
27
29
 
@@ -0,0 +1 @@
1
+ export declare function getOAuthApiUrl(): "https://accounts.credenza3.com" | "https://accounts.staging.credenza.com" | "http://localhost:8081";
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOAuthApiUrl = getOAuthApiUrl;
4
+ const sdk_env_1 = require("../lib/sdk-env");
5
+ function getOAuthApiUrl() {
6
+ switch ((0, sdk_env_1.getSdkEnv)()) {
7
+ case sdk_env_1.SDK_ENV.PROD:
8
+ return 'https://accounts.credenza3.com';
9
+ case sdk_env_1.SDK_ENV.STAGING:
10
+ return 'https://accounts.staging.credenza.com';
11
+ case sdk_env_1.SDK_ENV.LOCAL:
12
+ return 'http://localhost:8081';
13
+ }
14
+ }
@@ -0,0 +1,2 @@
1
+ export * from './accounts';
2
+ export * from './oauth-account';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./accounts"), exports);
18
+ __exportStar(require("./oauth-account"), exports);
@@ -0,0 +1 @@
1
+ export * from './oauth-account';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./oauth-account"), exports);
@@ -0,0 +1,8 @@
1
+ export declare function getAccountInfo(sub: string): Promise<{
2
+ id: string;
3
+ name: string;
4
+ login_type: string;
5
+ picture?: string;
6
+ email?: string;
7
+ phone?: string;
8
+ }>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAccountInfo = getAccountInfo;
4
+ const credentials_1 = require("../../lib/credentials");
5
+ const accounts_1 = require("../../accounts");
6
+ const logging_1 = require("../../lib/logging");
7
+ async function getAccountInfo(sub) {
8
+ const response = await fetch(`${(0, accounts_1.getOAuthApiUrl)()}/accounts/${sub}`, {
9
+ headers: {
10
+ Authorization: (0, credentials_1.getBasicToken)(),
11
+ 'Content-Type': 'application/json',
12
+ },
13
+ });
14
+ const json = await response.json();
15
+ (0, logging_1.log)(getAccountInfo.name, json);
16
+ return json;
17
+ }
@@ -1,2 +1,2 @@
1
- export * from './common';
1
+ export * from './api';
2
2
  export * from './passport-id';
@@ -14,5 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./common"), exports);
17
+ __exportStar(require("./api"), exports);
18
18
  __exportStar(require("./passport-id"), exports);
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.requestPassportIdSignature = requestPassportIdSignature;
4
- const common_1 = require("../../common");
4
+ const api_1 = require("../../api");
5
5
  const logging_1 = require("../../lib/logging");
6
6
  async function requestPassportIdSignature(sub, message) {
7
7
  if (!sub)
8
8
  throw new Error('"Sub is required"');
9
9
  if (!message)
10
10
  throw new Error('"Message is required"');
11
- const socket = await (0, common_1.getWsConnection)();
11
+ const socket = await (0, api_1.getWsConnection)();
12
12
  return new Promise((resolve, reject) => {
13
13
  socket.once(`passport_id/signed/${sub}`, (data) => {
14
14
  (0, logging_1.log)(requestPassportIdSignature.name, 'Received', data);
@@ -6,7 +6,7 @@ let debugEnabled = false;
6
6
  function log(methodName, ...args) {
7
7
  if (!debugEnabled)
8
8
  return;
9
- console.log('[CREDENZA_PARTNER_SDK]:', `(${methodName})`, ...args);
9
+ console.log(`[CREDENZA_PARTNER_SDK#${methodName}]:`, ...args);
10
10
  }
11
11
  function enableSdkDebug(enableDebug) {
12
12
  debugEnabled = enableDebug;
@@ -1,2 +1,3 @@
1
1
  export * from './sui';
2
+ export * from './account';
2
3
  export * as zk from './zk';
package/dist/sui/index.js CHANGED
@@ -28,4 +28,5 @@ var __importStar = (this && this.__importStar) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.zk = void 0;
30
30
  __exportStar(require("./sui"), exports);
31
+ __exportStar(require("./account"), exports);
31
32
  exports.zk = __importStar(require("./zk"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credenza3/partner-sdk",
3
- "version": "0.0.0-alpha.3",
3
+ "version": "0.0.1-alpha.0",
4
4
  "description": "Credenza partner sdk",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,10 +18,14 @@
18
18
  "node": "./dist/evm/index.js",
19
19
  "types": "./dist/evm/index.d.ts"
20
20
  },
21
- "./common": {
21
+ "./api": {
22
22
  "node": "./dist/common/index.js",
23
23
  "types": "./dist/common/index.d.ts"
24
24
  },
25
+ "./accounts": {
26
+ "node": "./dist/accounts/index.js",
27
+ "types": "./dist/accounts/index.d.ts"
28
+ },
25
29
  ".": {
26
30
  "node": "./dist/index.js",
27
31
  "types": "./dist/index.d.ts"
File without changes
File without changes
File without changes
File without changes