@dynamic-labs/embedded-wallet-solana 3.0.0-alpha.67 → 3.0.0-alpha.68

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/CHANGELOG.md CHANGED
@@ -1,4 +1,13 @@
1
1
 
2
+ ## [3.0.0-alpha.68](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.67...v3.0.0-alpha.68) (2024-09-12)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * combine signing inputs for new signTransaction method in bitcoin sats connector by address ([#6882](https://github.com/dynamic-labs/DynamicAuth/issues/6882)) ([dd78923](https://github.com/dynamic-labs/DynamicAuth/commit/dd78923e84042dbd23977c595467a6d587b729fb))
8
+ * log message during v1 embedded wallet email recovery ([#6877](https://github.com/dynamic-labs/DynamicAuth/issues/6877)) ([92fd70e](https://github.com/dynamic-labs/DynamicAuth/commit/92fd70e8d685edf334cb60c61b6411441fbfe54d))
9
+ * return correct chain format for smart wallets ([#6878](https://github.com/dynamic-labs/DynamicAuth/issues/6878)) ([e26544a](https://github.com/dynamic-labs/DynamicAuth/commit/e26544ad39277fcd5e94cf70cd871f7111f7a3c2))
10
+
2
11
  ## [3.0.0-alpha.67](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.66...v3.0.0-alpha.67) (2024-09-12)
3
12
 
4
13
 
package/package.cjs CHANGED
@@ -3,12 +3,12 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "3.0.0-alpha.67";
6
+ var version = "3.0.0-alpha.68";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.529",
9
- "@dynamic-labs/utils": "3.0.0-alpha.67",
10
- "@dynamic-labs/logger": "3.0.0-alpha.67",
11
- "@dynamic-labs/types": "3.0.0-alpha.67",
9
+ "@dynamic-labs/utils": "3.0.0-alpha.68",
10
+ "@dynamic-labs/logger": "3.0.0-alpha.68",
11
+ "@dynamic-labs/types": "3.0.0-alpha.68",
12
12
  eventemitter3: "5.0.1",
13
13
  "@solana/spl-token": "0.4.6",
14
14
  "@solana/web3.js": "1.92.1",
package/package.js CHANGED
@@ -1,10 +1,10 @@
1
1
  'use client'
2
- var version = "3.0.0-alpha.67";
2
+ var version = "3.0.0-alpha.68";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.529",
5
- "@dynamic-labs/utils": "3.0.0-alpha.67",
6
- "@dynamic-labs/logger": "3.0.0-alpha.67",
7
- "@dynamic-labs/types": "3.0.0-alpha.67",
5
+ "@dynamic-labs/utils": "3.0.0-alpha.68",
6
+ "@dynamic-labs/logger": "3.0.0-alpha.68",
7
+ "@dynamic-labs/types": "3.0.0-alpha.68",
8
8
  eventemitter3: "5.0.1",
9
9
  "@solana/spl-token": "0.4.6",
10
10
  "@solana/web3.js": "1.92.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/embedded-wallet-solana",
3
- "version": "3.0.0-alpha.67",
3
+ "version": "3.0.0-alpha.68",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -27,9 +27,9 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@dynamic-labs/sdk-api-core": "0.0.529",
30
- "@dynamic-labs/utils": "3.0.0-alpha.67",
31
- "@dynamic-labs/logger": "3.0.0-alpha.67",
32
- "@dynamic-labs/types": "3.0.0-alpha.67",
30
+ "@dynamic-labs/utils": "3.0.0-alpha.68",
31
+ "@dynamic-labs/logger": "3.0.0-alpha.68",
32
+ "@dynamic-labs/types": "3.0.0-alpha.68",
33
33
  "eventemitter3": "5.0.1",
34
34
  "@solana/spl-token": "0.4.6",
35
35
  "@solana/web3.js": "1.92.1",
@@ -37,12 +37,12 @@
37
37
  "@turnkey/iframe-stamper": "2.0.0",
38
38
  "@turnkey/solana": "0.3.9",
39
39
  "@turnkey/webauthn-stamper": "0.5.0",
40
- "@dynamic-labs/embedded-wallet": "3.0.0-alpha.67",
41
- "@dynamic-labs/rpc-providers": "3.0.0-alpha.67",
42
- "@dynamic-labs/solana-core": "3.0.0-alpha.67",
43
- "@dynamic-labs/wallet-book": "3.0.0-alpha.67",
44
- "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.67",
45
- "@dynamic-labs/webauthn": "3.0.0-alpha.67",
40
+ "@dynamic-labs/embedded-wallet": "3.0.0-alpha.68",
41
+ "@dynamic-labs/rpc-providers": "3.0.0-alpha.68",
42
+ "@dynamic-labs/solana-core": "3.0.0-alpha.68",
43
+ "@dynamic-labs/wallet-book": "3.0.0-alpha.68",
44
+ "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.68",
45
+ "@dynamic-labs/webauthn": "3.0.0-alpha.68",
46
46
  "react-dom": "18.2.0",
47
47
  "viem": "2.9.25"
48
48
  },
@@ -33,8 +33,6 @@ export type AuthEvents = {
33
33
  /** Informs an auth attempt initialized, and provides insight into which auth option it is */
34
34
  authInit: (method: AuthEventPayload) => void;
35
35
  logout: () => void;
36
- /** This event is used to trigger logout to be called, DO NOT listen to it. Listen to "logout" instead */
37
- triggerLogout: () => void;
38
36
  /**
39
37
  * Emitted when the user succesfully completes an MFA challenge
40
38
  */
@@ -5,14 +5,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var sdkApiCore = require('@dynamic-labs/sdk-api-core');
7
7
  var logger$1 = require('@dynamic-labs/logger');
8
- var LocalStorage = require('./LocalStorage.cjs');
8
+ var utils = require('@dynamic-labs/utils');
9
9
 
10
10
  const logger = new logger$1.Logger('DynamicSDK');
11
11
  const AUTH_MIN_TOKEN = 'dynamic_min_authentication_token';
12
12
  const AUTH_MIN_TOKEN_DEMO = 'dynamic_min_authentication_token_demo';
13
13
  const isCookieEnabled = () => {
14
14
  var _a, _b, _c, _d;
15
- let securitySettings = (_a = LocalStorage.LocalStorage.getFromLS('dynamic_store')) !== null && _a !== void 0 ? _a : LocalStorage.LocalStorage.getFromLS('dynamic_store_demo');
15
+ let securitySettings = (_a = utils.StorageService.getItem('dynamic_store')) !== null && _a !== void 0 ? _a : utils.StorageService.getItem('dynamic_store_demo');
16
16
  securitySettings = (_b = securitySettings === null || securitySettings === void 0 ? void 0 : securitySettings.settings) === null || _b === void 0 ? void 0 : _b.security;
17
17
  if (!securitySettings)
18
18
  return false;
@@ -54,7 +54,11 @@ const getMinAuthToken = () => {
54
54
  var _a;
55
55
  if (typeof window === 'undefined')
56
56
  return undefined;
57
- const token = (_a = LocalStorage.LocalStorage.getFromLS(AUTH_MIN_TOKEN, true)) !== null && _a !== void 0 ? _a : LocalStorage.LocalStorage.getFromLS(AUTH_MIN_TOKEN_DEMO, true);
57
+ const token = (_a = utils.StorageService.getItem(AUTH_MIN_TOKEN, {
58
+ priority: ['secureStorage', 'localStorage'],
59
+ })) !== null && _a !== void 0 ? _a : utils.StorageService.getItem(AUTH_MIN_TOKEN_DEMO, {
60
+ priority: ['secureStorage', 'localStorage'],
61
+ });
58
62
  if (!token || isMinAuthTokenExpired(token))
59
63
  return undefined;
60
64
  return token;
@@ -8,5 +8,5 @@ export declare const DYNAMIC_STORE = "dynamic_store";
8
8
  export declare const isCookieEnabled: () => any;
9
9
  export declare const parseToken: (token: string | null | undefined) => any;
10
10
  export declare const decodeMinJwt: (token: string | null | undefined) => Omit<MinifiedDynamicJwt, 'jwt'> | undefined;
11
- export declare const getMinAuthToken: () => any;
11
+ export declare const getMinAuthToken: () => string | undefined;
12
12
  export declare const isMinAuthTokenExpired: (token: string) => boolean;
@@ -1,14 +1,14 @@
1
1
  'use client'
2
2
  import { AuthStorageEnum, MinifiedDynamicJwtFromJSON } from '@dynamic-labs/sdk-api-core';
3
3
  import { Logger } from '@dynamic-labs/logger';
4
- import { LocalStorage } from './LocalStorage.js';
4
+ import { StorageService } from '@dynamic-labs/utils';
5
5
 
6
6
  const logger = new Logger('DynamicSDK');
7
7
  const AUTH_MIN_TOKEN = 'dynamic_min_authentication_token';
8
8
  const AUTH_MIN_TOKEN_DEMO = 'dynamic_min_authentication_token_demo';
9
9
  const isCookieEnabled = () => {
10
10
  var _a, _b, _c, _d;
11
- let securitySettings = (_a = LocalStorage.getFromLS('dynamic_store')) !== null && _a !== void 0 ? _a : LocalStorage.getFromLS('dynamic_store_demo');
11
+ let securitySettings = (_a = StorageService.getItem('dynamic_store')) !== null && _a !== void 0 ? _a : StorageService.getItem('dynamic_store_demo');
12
12
  securitySettings = (_b = securitySettings === null || securitySettings === void 0 ? void 0 : securitySettings.settings) === null || _b === void 0 ? void 0 : _b.security;
13
13
  if (!securitySettings)
14
14
  return false;
@@ -50,7 +50,11 @@ const getMinAuthToken = () => {
50
50
  var _a;
51
51
  if (typeof window === 'undefined')
52
52
  return undefined;
53
- const token = (_a = LocalStorage.getFromLS(AUTH_MIN_TOKEN, true)) !== null && _a !== void 0 ? _a : LocalStorage.getFromLS(AUTH_MIN_TOKEN_DEMO, true);
53
+ const token = (_a = StorageService.getItem(AUTH_MIN_TOKEN, {
54
+ priority: ['secureStorage', 'localStorage'],
55
+ })) !== null && _a !== void 0 ? _a : StorageService.getItem(AUTH_MIN_TOKEN_DEMO, {
56
+ priority: ['secureStorage', 'localStorage'],
57
+ });
54
58
  if (!token || isMinAuthTokenExpired(token))
55
59
  return undefined;
56
60
  return token;
@@ -1,14 +0,0 @@
1
- 'use client'
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
- var EventEmitter = require('eventemitter3');
7
-
8
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
-
10
- var EventEmitter__default = /*#__PURE__*/_interopDefaultLegacy(EventEmitter);
11
-
12
- const dynamicEvents = new EventEmitter__default["default"]();
13
-
14
- exports.dynamicEvents = dynamicEvents;
@@ -1,6 +0,0 @@
1
- 'use client'
2
- import EventEmitter from 'eventemitter3';
3
-
4
- const dynamicEvents = new EventEmitter();
5
-
6
- export { dynamicEvents };
@@ -1,81 +0,0 @@
1
- 'use client'
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
- var DynamicEvents = require('../events/DynamicEvents.cjs');
7
- var helpers = require('./helpers.cjs');
8
-
9
- const AUTH_TOKEN = 'dynamic_authentication_token';
10
- class LocalStorage {
11
- static getDynamicLSKey(key) {
12
- return `${key}${LocalStorage.getSuffix()}`;
13
- }
14
- static validateRequest(key, fromAuxiliaryAuthFunctions) {
15
- if (key === AUTH_TOKEN && !fromAuxiliaryAuthFunctions) {
16
- throw new Error('You cannot access AUTH_TOKEN through localStorage. Use getAuthToken/ storeAuthToken helper functions instead');
17
- }
18
- }
19
- static setSuffix(localStorageSuffix) {
20
- if (!LocalStorage.__suffix__) {
21
- const suffix = (localStorageSuffix && `_${localStorageSuffix}`) || '';
22
- LocalStorage.__suffix__ = suffix;
23
- }
24
- }
25
- /**
26
- *
27
- * @param key
28
- * @param getAuth - verifies if the request to get AUTH_TOKEN is comming from getAuthToken and not directly
29
- * @returns
30
- */
31
- static getFromLS(key, getAuth = false) {
32
- if (typeof window === 'undefined') {
33
- return undefined;
34
- }
35
- LocalStorage.validateRequest(key, getAuth);
36
- const value = window.localStorage.getItem(LocalStorage.getDynamicLSKey(key));
37
- if (!value) {
38
- return undefined;
39
- }
40
- try {
41
- return JSON.parse(value);
42
- }
43
- catch (error) {
44
- helpers.logger.debug(`Error while parsing ${key} from local storage`, { value });
45
- LocalStorage.removeFromLS(key);
46
- DynamicEvents.dynamicEvents.emit('triggerLogout');
47
- }
48
- return undefined;
49
- }
50
- static removeFromLS(key) {
51
- if (typeof window === 'undefined') {
52
- return undefined;
53
- }
54
- return window.localStorage.removeItem(LocalStorage.getDynamicLSKey(key));
55
- }
56
- /**
57
- *
58
- * @param key
59
- * @param value
60
- * @param storeAuth - verifies if the request to get AUTH_TOKEN is comming from getAuthToken and not directly
61
- * @returns
62
- */
63
- static setToLS(key, value, storeAuth = false) {
64
- if (typeof window === 'undefined') {
65
- return;
66
- }
67
- LocalStorage.validateRequest(key, storeAuth);
68
- window.localStorage.setItem(LocalStorage.getDynamicLSKey(key), JSON.stringify(value));
69
- }
70
- static getKeys() {
71
- if (typeof window === 'undefined') {
72
- return [];
73
- }
74
- return Object.keys(window.localStorage);
75
- }
76
- }
77
- LocalStorage.getSuffix = () => LocalStorage.__suffix__ || '';
78
-
79
- exports.AUTH_TOKEN = AUTH_TOKEN;
80
- exports.LocalStorage = LocalStorage;
81
- exports["default"] = LocalStorage;
@@ -1,26 +0,0 @@
1
- export declare const AUTH_TOKEN = "dynamic_authentication_token";
2
- export declare class LocalStorage {
3
- private static __suffix__;
4
- static getSuffix: () => string;
5
- private static getDynamicLSKey;
6
- private static validateRequest;
7
- static setSuffix(localStorageSuffix?: string): void;
8
- /**
9
- *
10
- * @param key
11
- * @param getAuth - verifies if the request to get AUTH_TOKEN is comming from getAuthToken and not directly
12
- * @returns
13
- */
14
- static getFromLS<T = any>(key: string, getAuth?: boolean): T | undefined;
15
- static removeFromLS(key: string): void;
16
- /**
17
- *
18
- * @param key
19
- * @param value
20
- * @param storeAuth - verifies if the request to get AUTH_TOKEN is comming from getAuthToken and not directly
21
- * @returns
22
- */
23
- static setToLS<T = any>(key: string, value: T, storeAuth?: boolean): void;
24
- static getKeys(): string[];
25
- }
26
- export default LocalStorage;
@@ -1,75 +0,0 @@
1
- 'use client'
2
- import { dynamicEvents } from '../events/DynamicEvents.js';
3
- import { logger } from './helpers.js';
4
-
5
- const AUTH_TOKEN = 'dynamic_authentication_token';
6
- class LocalStorage {
7
- static getDynamicLSKey(key) {
8
- return `${key}${LocalStorage.getSuffix()}`;
9
- }
10
- static validateRequest(key, fromAuxiliaryAuthFunctions) {
11
- if (key === AUTH_TOKEN && !fromAuxiliaryAuthFunctions) {
12
- throw new Error('You cannot access AUTH_TOKEN through localStorage. Use getAuthToken/ storeAuthToken helper functions instead');
13
- }
14
- }
15
- static setSuffix(localStorageSuffix) {
16
- if (!LocalStorage.__suffix__) {
17
- const suffix = (localStorageSuffix && `_${localStorageSuffix}`) || '';
18
- LocalStorage.__suffix__ = suffix;
19
- }
20
- }
21
- /**
22
- *
23
- * @param key
24
- * @param getAuth - verifies if the request to get AUTH_TOKEN is comming from getAuthToken and not directly
25
- * @returns
26
- */
27
- static getFromLS(key, getAuth = false) {
28
- if (typeof window === 'undefined') {
29
- return undefined;
30
- }
31
- LocalStorage.validateRequest(key, getAuth);
32
- const value = window.localStorage.getItem(LocalStorage.getDynamicLSKey(key));
33
- if (!value) {
34
- return undefined;
35
- }
36
- try {
37
- return JSON.parse(value);
38
- }
39
- catch (error) {
40
- logger.debug(`Error while parsing ${key} from local storage`, { value });
41
- LocalStorage.removeFromLS(key);
42
- dynamicEvents.emit('triggerLogout');
43
- }
44
- return undefined;
45
- }
46
- static removeFromLS(key) {
47
- if (typeof window === 'undefined') {
48
- return undefined;
49
- }
50
- return window.localStorage.removeItem(LocalStorage.getDynamicLSKey(key));
51
- }
52
- /**
53
- *
54
- * @param key
55
- * @param value
56
- * @param storeAuth - verifies if the request to get AUTH_TOKEN is comming from getAuthToken and not directly
57
- * @returns
58
- */
59
- static setToLS(key, value, storeAuth = false) {
60
- if (typeof window === 'undefined') {
61
- return;
62
- }
63
- LocalStorage.validateRequest(key, storeAuth);
64
- window.localStorage.setItem(LocalStorage.getDynamicLSKey(key), JSON.stringify(value));
65
- }
66
- static getKeys() {
67
- if (typeof window === 'undefined') {
68
- return [];
69
- }
70
- return Object.keys(window.localStorage);
71
- }
72
- }
73
- LocalStorage.getSuffix = () => LocalStorage.__suffix__ || '';
74
-
75
- export { AUTH_TOKEN, LocalStorage, LocalStorage as default };