@renown/sdk 6.0.0-staging.3 → 6.0.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 +47 -437
- package/dist/index.d.ts +77 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +173 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +136 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +305 -0
- package/dist/node.js.map +1 -0
- package/dist/renown-builder-BLM2JCDq.js +815 -0
- package/dist/renown-builder-BLM2JCDq.js.map +1 -0
- package/dist/utils-BGF8Qb5f.d.ts +689 -0
- package/dist/utils-BGF8Qb5f.d.ts.map +1 -0
- package/package.json +18 -40
- package/dist/e2e/fixtures/main.d.ts +0 -2
- package/dist/e2e/fixtures/main.d.ts.map +0 -1
- package/dist/e2e/fixtures/main.js +0 -97
- package/dist/e2e/fixtures/main.js.map +0 -1
- package/dist/e2e/fixtures/vite.config.d.ts +0 -3
- package/dist/e2e/fixtures/vite.config.d.ts.map +0 -1
- package/dist/e2e/fixtures/vite.config.js +0 -10
- package/dist/e2e/fixtures/vite.config.js.map +0 -1
- package/dist/e2e/renown-components.spec.d.ts +0 -2
- package/dist/e2e/renown-components.spec.d.ts.map +0 -1
- package/dist/e2e/renown-components.spec.js +0 -155
- package/dist/e2e/renown-components.spec.js.map +0 -1
- package/dist/playwright.config.d.ts +0 -3
- package/dist/playwright.config.d.ts.map +0 -1
- package/dist/playwright.config.js +0 -25
- package/dist/playwright.config.js.map +0 -1
- package/dist/src/assets/assets.d.ts +0 -19
- package/dist/src/assets/renown-hover.svg +0 -17
- package/dist/src/assets/renown-light.svg +0 -15
- package/dist/src/assets/renown-short-hover.png +0 -0
- package/dist/src/assets/renown-short.png +0 -0
- package/dist/src/assets/renown.svg +0 -16
- package/dist/src/common.d.ts +0 -21
- package/dist/src/common.d.ts.map +0 -1
- package/dist/src/common.js +0 -113
- package/dist/src/common.js.map +0 -1
- package/dist/src/components/RenownAuthButton.d.ts +0 -62
- package/dist/src/components/RenownAuthButton.d.ts.map +0 -1
- package/dist/src/components/RenownAuthButton.js +0 -82
- package/dist/src/components/RenownAuthButton.js.map +0 -1
- package/dist/src/components/RenownLoginButton.d.ts +0 -48
- package/dist/src/components/RenownLoginButton.d.ts.map +0 -1
- package/dist/src/components/RenownLoginButton.js +0 -175
- package/dist/src/components/RenownLoginButton.js.map +0 -1
- package/dist/src/components/RenownUserButton.d.ts +0 -66
- package/dist/src/components/RenownUserButton.d.ts.map +0 -1
- package/dist/src/components/RenownUserButton.js +0 -216
- package/dist/src/components/RenownUserButton.js.map +0 -1
- package/dist/src/components/icons.d.ts +0 -25
- package/dist/src/components/icons.d.ts.map +0 -1
- package/dist/src/components/icons.js +0 -24
- package/dist/src/components/icons.js.map +0 -1
- package/dist/src/components/image-data.d.ts +0 -3
- package/dist/src/components/image-data.d.ts.map +0 -1
- package/dist/src/components/image-data.js +0 -4
- package/dist/src/components/image-data.js.map +0 -1
- package/dist/src/components/index.d.ts +0 -8
- package/dist/src/components/index.d.ts.map +0 -1
- package/dist/src/components/index.js +0 -5
- package/dist/src/components/index.js.map +0 -1
- package/dist/src/constants.d.ts +0 -130
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -40
- package/dist/src/constants.js.map +0 -1
- package/dist/src/crypto/browser-key-storage.d.ts +0 -10
- package/dist/src/crypto/browser-key-storage.d.ts.map +0 -1
- package/dist/src/crypto/browser-key-storage.js +0 -76
- package/dist/src/crypto/browser-key-storage.js.map +0 -1
- package/dist/src/crypto/index.d.ts +0 -7
- package/dist/src/crypto/index.d.ts.map +0 -1
- package/dist/src/crypto/index.js +0 -9
- package/dist/src/crypto/index.js.map +0 -1
- package/dist/src/crypto/memory-key-storage.d.ts +0 -9
- package/dist/src/crypto/memory-key-storage.d.ts.map +0 -1
- package/dist/src/crypto/memory-key-storage.js +0 -18
- package/dist/src/crypto/memory-key-storage.js.map +0 -1
- package/dist/src/crypto/node-key-storage.d.ts +0 -21
- package/dist/src/crypto/node-key-storage.d.ts.map +0 -1
- package/dist/src/crypto/node-key-storage.js +0 -107
- package/dist/src/crypto/node-key-storage.js.map +0 -1
- package/dist/src/crypto/node.d.ts +0 -2
- package/dist/src/crypto/node.d.ts.map +0 -1
- package/dist/src/crypto/node.js +0 -3
- package/dist/src/crypto/node.js.map +0 -1
- package/dist/src/crypto/renown-crypto-builder.d.ts +0 -11
- package/dist/src/crypto/renown-crypto-builder.d.ts.map +0 -1
- package/dist/src/crypto/renown-crypto-builder.js +0 -34
- package/dist/src/crypto/renown-crypto-builder.js.map +0 -1
- package/dist/src/crypto/renown-crypto.d.ts +0 -26
- package/dist/src/crypto/renown-crypto.d.ts.map +0 -1
- package/dist/src/crypto/renown-crypto.js +0 -56
- package/dist/src/crypto/renown-crypto.js.map +0 -1
- package/dist/src/crypto/signer.d.ts +0 -74
- package/dist/src/crypto/signer.d.ts.map +0 -1
- package/dist/src/crypto/signer.js +0 -306
- package/dist/src/crypto/signer.js.map +0 -1
- package/dist/src/crypto/types.d.ts +0 -27
- package/dist/src/crypto/types.d.ts.map +0 -1
- package/dist/src/crypto/types.js +0 -2
- package/dist/src/crypto/types.js.map +0 -1
- package/dist/src/crypto/utils.d.ts +0 -13
- package/dist/src/crypto/utils.d.ts.map +0 -1
- package/dist/src/crypto/utils.js +0 -39
- package/dist/src/crypto/utils.js.map +0 -1
- package/dist/src/event/event.browser.d.ts +0 -10
- package/dist/src/event/event.browser.d.ts.map +0 -1
- package/dist/src/event/event.browser.js +0 -24
- package/dist/src/event/event.browser.js.map +0 -1
- package/dist/src/event/event.node.d.ts +0 -8
- package/dist/src/event/event.node.d.ts.map +0 -1
- package/dist/src/event/event.node.js +0 -17
- package/dist/src/event/event.node.js.map +0 -1
- package/dist/src/event/memory.d.ts +0 -8
- package/dist/src/event/memory.d.ts.map +0 -1
- package/dist/src/event/memory.js +0 -16
- package/dist/src/event/memory.js.map +0 -1
- package/dist/src/event/types.d.ts +0 -16
- package/dist/src/event/types.d.ts.map +0 -1
- package/dist/src/event/types.js +0 -2
- package/dist/src/event/types.js.map +0 -1
- package/dist/src/hooks/index.d.ts +0 -2
- package/dist/src/hooks/index.d.ts.map +0 -1
- package/dist/src/hooks/index.js +0 -2
- package/dist/src/hooks/index.js.map +0 -1
- package/dist/src/hooks/use-user.d.ts +0 -21
- package/dist/src/hooks/use-user.d.ts.map +0 -1
- package/dist/src/hooks/use-user.js +0 -30
- package/dist/src/hooks/use-user.js.map +0 -1
- package/dist/src/index.browser.d.ts +0 -4
- package/dist/src/index.browser.d.ts.map +0 -1
- package/dist/src/index.browser.js +0 -4
- package/dist/src/index.browser.js.map +0 -1
- package/dist/src/index.d.ts +0 -15
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -15
- package/dist/src/index.js.map +0 -1
- package/dist/src/index.node.d.ts +0 -4
- package/dist/src/index.node.d.ts.map +0 -1
- package/dist/src/index.node.js +0 -4
- package/dist/src/index.node.js.map +0 -1
- package/dist/src/init.browser.d.ts +0 -52
- package/dist/src/init.browser.d.ts.map +0 -1
- package/dist/src/init.browser.js +0 -66
- package/dist/src/init.browser.js.map +0 -1
- package/dist/src/init.node.d.ts +0 -29
- package/dist/src/init.node.d.ts.map +0 -1
- package/dist/src/init.node.js +0 -30
- package/dist/src/init.node.js.map +0 -1
- package/dist/src/lib/renown/constants.d.ts +0 -130
- package/dist/src/lib/renown/constants.d.ts.map +0 -1
- package/dist/src/lib/renown/constants.js +0 -40
- package/dist/src/lib/renown/constants.js.map +0 -1
- package/dist/src/lib/renown/credential.d.ts +0 -2
- package/dist/src/lib/renown/credential.d.ts.map +0 -1
- package/dist/src/lib/renown/credential.js +0 -68
- package/dist/src/lib/renown/credential.js.map +0 -1
- package/dist/src/lib/renown/did-parser.d.ts +0 -28
- package/dist/src/lib/renown/did-parser.d.ts.map +0 -1
- package/dist/src/lib/renown/did-parser.js +0 -57
- package/dist/src/lib/renown/did-parser.js.map +0 -1
- package/dist/src/lib/renown/index.d.ts +0 -4
- package/dist/src/lib/renown/index.d.ts.map +0 -1
- package/dist/src/lib/renown/index.js +0 -4
- package/dist/src/lib/renown/index.js.map +0 -1
- package/dist/src/lib/renown/utils.d.ts +0 -33
- package/dist/src/lib/renown/utils.d.ts.map +0 -1
- package/dist/src/lib/renown/utils.js +0 -188
- package/dist/src/lib/renown/utils.js.map +0 -1
- package/dist/src/lib/session-storage.d.ts +0 -40
- package/dist/src/lib/session-storage.d.ts.map +0 -1
- package/dist/src/lib/session-storage.js +0 -107
- package/dist/src/lib/session-storage.js.map +0 -1
- package/dist/src/node.d.ts +0 -10
- package/dist/src/node.d.ts.map +0 -1
- package/dist/src/node.js +0 -10
- package/dist/src/node.js.map +0 -1
- package/dist/src/providers/index.d.ts +0 -3
- package/dist/src/providers/index.d.ts.map +0 -1
- package/dist/src/providers/index.js +0 -2
- package/dist/src/providers/index.js.map +0 -1
- package/dist/src/providers/renown-user-provider.d.ts +0 -76
- package/dist/src/providers/renown-user-provider.d.ts.map +0 -1
- package/dist/src/providers/renown-user-provider.js +0 -166
- package/dist/src/providers/renown-user-provider.js.map +0 -1
- package/dist/src/renown-builder.d.ts +0 -60
- package/dist/src/renown-builder.d.ts.map +0 -1
- package/dist/src/renown-builder.js +0 -115
- package/dist/src/renown-builder.js.map +0 -1
- package/dist/src/storage/common.d.ts +0 -17
- package/dist/src/storage/common.d.ts.map +0 -1
- package/dist/src/storage/common.js +0 -20
- package/dist/src/storage/common.js.map +0 -1
- package/dist/src/storage/storage.browser.d.ts +0 -10
- package/dist/src/storage/storage.browser.d.ts.map +0 -1
- package/dist/src/storage/storage.browser.js +0 -27
- package/dist/src/storage/storage.browser.js.map +0 -1
- package/dist/src/storage/storage.node.d.ts +0 -11
- package/dist/src/storage/storage.node.d.ts.map +0 -1
- package/dist/src/storage/storage.node.js +0 -42
- package/dist/src/storage/storage.node.js.map +0 -1
- package/dist/src/types.d.ts +0 -104
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -2
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils.d.ts +0 -18
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/utils.js +0 -88
- package/dist/src/utils.js.map +0 -1
- package/dist/test/auth.test.d.ts +0 -2
- package/dist/test/auth.test.d.ts.map +0 -1
- package/dist/test/auth.test.js +0 -13
- package/dist/test/auth.test.js.map +0 -1
- package/dist/test/crypto/signer.test.d.ts +0 -2
- package/dist/test/crypto/signer.test.d.ts.map +0 -1
- package/dist/test/crypto/signer.test.js +0 -184
- package/dist/test/crypto/signer.test.js.map +0 -1
- package/dist/test/script.test.d.ts +0 -2
- package/dist/test/script.test.d.ts.map +0 -1
- package/dist/test/script.test.js +0 -144
- package/dist/test/script.test.js.map +0 -1
- package/dist/test/storage.node.test.d.ts +0 -2
- package/dist/test/storage.node.test.d.ts.map +0 -1
- package/dist/test/storage.node.test.js +0 -66
- package/dist/test/storage.node.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/vitest.config.d.ts +0 -3
- package/dist/vitest.config.d.ts.map +0 -1
- package/dist/vitest.config.js +0 -7
- package/dist/vitest.config.js.map +0 -1
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { createContext, useCallback, useEffect, useState } from "react";
|
|
4
|
-
import { BrowserKeyStorage, RenownCryptoBuilder } from "../crypto/index.js";
|
|
5
|
-
import { RenownBuilder } from "../init.browser.js";
|
|
6
|
-
import { fetchProfileDataForUser, handleRenownReturn, openRenown as openRenownPortal, login as renownLogin, logout as renownLogout, } from "../lib/renown/index.js";
|
|
7
|
-
import { SessionStorageManager } from "../lib/session-storage.js";
|
|
8
|
-
export const RenownUserContext = createContext(null);
|
|
9
|
-
/**
|
|
10
|
-
* RenownUserProvider - Central user provider for Renown
|
|
11
|
-
*
|
|
12
|
-
* Automatically initializes the Renown SDK and provides user state.
|
|
13
|
-
* Handles initialization, login, logout, and session management.
|
|
14
|
-
*
|
|
15
|
-
* Usage:
|
|
16
|
-
* ```tsx
|
|
17
|
-
* // Wrap your app
|
|
18
|
-
* <RenownUserProvider renownUrl="https://www.renown.id">
|
|
19
|
-
* <YourApp />
|
|
20
|
-
* </RenownUserProvider>
|
|
21
|
-
*
|
|
22
|
-
* // In any component
|
|
23
|
-
* const { user, login, logout } = useUser()
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export function RenownUserProvider({ children, appName = "", renownUrl = "https://www.renown.id", networkId = "eip155", chainId = "1", loadingComponent, errorComponent, }) {
|
|
27
|
-
const [user, setUser] = useState(null);
|
|
28
|
-
const [loginStatus, setLoginStatus] = useState("initial");
|
|
29
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
30
|
-
const [isInitialized, setIsInitialized] = useState(false);
|
|
31
|
-
const [initError, setInitError] = useState(null);
|
|
32
|
-
const [renownCrypto, setRenownCrypto] = useState(null);
|
|
33
|
-
const [renown, setRenown] = useState(null);
|
|
34
|
-
// Initialize auth system
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
const init = async () => {
|
|
37
|
-
try {
|
|
38
|
-
if (typeof window === "undefined") {
|
|
39
|
-
setIsInitialized(true);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
// Initialize SDK if not already initialized
|
|
43
|
-
if (!window.renown || !window.renownCrypto) {
|
|
44
|
-
// Initialize RenownCrypto with browser key storage
|
|
45
|
-
const keyStorage = await BrowserKeyStorage.create();
|
|
46
|
-
const cryptoInstance = await new RenownCryptoBuilder()
|
|
47
|
-
.withKeyPairStorage(keyStorage)
|
|
48
|
-
.build();
|
|
49
|
-
const renownInstance = await new RenownBuilder(appName)
|
|
50
|
-
.withCrypto(cryptoInstance)
|
|
51
|
-
.build();
|
|
52
|
-
// Attach to window for global access
|
|
53
|
-
window.renown = renownInstance;
|
|
54
|
-
window.renownCrypto = cryptoInstance;
|
|
55
|
-
// Save to state
|
|
56
|
-
setRenownCrypto(cryptoInstance);
|
|
57
|
-
setRenown(renownInstance);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
// Use existing instances from window
|
|
61
|
-
setRenown(window.renown);
|
|
62
|
-
setRenownCrypto(window.renownCrypto);
|
|
63
|
-
}
|
|
64
|
-
// Check for stored session first
|
|
65
|
-
const storedUserData = SessionStorageManager.getUserData();
|
|
66
|
-
if (storedUserData &&
|
|
67
|
-
SessionStorageManager.isUserDataValid(storedUserData)) {
|
|
68
|
-
// Restore user from stored session
|
|
69
|
-
const userWithProfile = await fetchProfileDataForUser(storedUserData.user);
|
|
70
|
-
setUser(userWithProfile);
|
|
71
|
-
setLoginStatus("authorized");
|
|
72
|
-
setIsInitialized(true);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
// Handle return from Renown authentication
|
|
76
|
-
await handleRenownReturn();
|
|
77
|
-
const currentUser = window.renown.user;
|
|
78
|
-
if (currentUser) {
|
|
79
|
-
// Fetch profile data for the logged-in user
|
|
80
|
-
const userWithProfile = await fetchProfileDataForUser(currentUser);
|
|
81
|
-
setUser(userWithProfile);
|
|
82
|
-
setLoginStatus("authorized");
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
setLoginStatus("not-authorized");
|
|
86
|
-
}
|
|
87
|
-
setIsInitialized(true);
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
console.error("Failed to initialize authentication:", error);
|
|
91
|
-
setInitError(error);
|
|
92
|
-
setLoginStatus("not-authorized");
|
|
93
|
-
// Still set as initialized to prevent infinite loading
|
|
94
|
-
setIsInitialized(true);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
init().catch(console.error);
|
|
98
|
-
}, [renownUrl, networkId, chainId]);
|
|
99
|
-
// Login handler
|
|
100
|
-
const login = useCallback(async (userDid) => {
|
|
101
|
-
if (typeof window === "undefined")
|
|
102
|
-
return;
|
|
103
|
-
const renown = window.renown;
|
|
104
|
-
const renownCrypto = window.renownCrypto;
|
|
105
|
-
if (!renown || !renownCrypto) {
|
|
106
|
-
console.error("Renown or RenownCrypto not available");
|
|
107
|
-
setLoginStatus("not-authorized");
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
try {
|
|
111
|
-
setIsLoading(true);
|
|
112
|
-
setLoginStatus("checking");
|
|
113
|
-
const did = userDid ?? renownCrypto.did;
|
|
114
|
-
// Perform login
|
|
115
|
-
const loggedInUser = await renownLogin(did, renown, renownCrypto);
|
|
116
|
-
if (loggedInUser) {
|
|
117
|
-
// Fetch profile data and update state
|
|
118
|
-
const userWithProfile = await fetchProfileDataForUser(loggedInUser);
|
|
119
|
-
setUser(userWithProfile);
|
|
120
|
-
setLoginStatus("authorized");
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
setLoginStatus("not-authorized");
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
console.error("Login failed:", error);
|
|
128
|
-
setLoginStatus("not-authorized");
|
|
129
|
-
}
|
|
130
|
-
finally {
|
|
131
|
-
setIsLoading(false);
|
|
132
|
-
}
|
|
133
|
-
}, []);
|
|
134
|
-
// Logout handler
|
|
135
|
-
const logout = useCallback(async () => {
|
|
136
|
-
try {
|
|
137
|
-
await renownLogout();
|
|
138
|
-
setUser(null);
|
|
139
|
-
setLoginStatus("not-authorized");
|
|
140
|
-
}
|
|
141
|
-
catch (error) {
|
|
142
|
-
console.error("Logout failed:", error);
|
|
143
|
-
}
|
|
144
|
-
}, []);
|
|
145
|
-
// Show loading state while initializing
|
|
146
|
-
if (!isInitialized && loadingComponent) {
|
|
147
|
-
return _jsx(_Fragment, { children: loadingComponent });
|
|
148
|
-
}
|
|
149
|
-
// Show error state if initialization failed
|
|
150
|
-
if (initError && errorComponent) {
|
|
151
|
-
return _jsx(_Fragment, { children: errorComponent(initError, () => window.location.reload()) });
|
|
152
|
-
}
|
|
153
|
-
const value = {
|
|
154
|
-
user,
|
|
155
|
-
loginStatus,
|
|
156
|
-
isLoading,
|
|
157
|
-
isInitialized,
|
|
158
|
-
login,
|
|
159
|
-
logout,
|
|
160
|
-
openRenown: openRenownPortal,
|
|
161
|
-
renownCrypto,
|
|
162
|
-
renown,
|
|
163
|
-
};
|
|
164
|
-
return (_jsx(RenownUserContext.Provider, { value: value, children: children }));
|
|
165
|
-
}
|
|
166
|
-
//# sourceMappingURL=renown-user-provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renown-user-provider.js","sourceRoot":"","sources":["../../../src/providers/renown-user-provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,UAAU,IAAI,gBAAgB,EAC9B,KAAK,IAAI,WAAW,EACpB,MAAM,IAAI,YAAY,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAyBlE,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC5C,IAAI,CACL,CAAC;AAmCF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,QAAQ,EACR,OAAO,GAAG,EAAE,EACZ,SAAS,GAAG,uBAAuB,EACnC,SAAS,GAAG,QAAQ,EACpB,OAAO,GAAG,GAAG,EACb,gBAAgB,EAChB,cAAc,GACU;IACxB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAc,IAAI,CAAC,CAAC;IACpD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,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,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,iBAAiB;IACjB,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACpC,IAAI,CAAC;YACH,MAAM,YAAY,EAAE,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,CAAC;YACd,cAAc,CAAC,gBAAgB,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;QACzC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,wCAAwC;IACxC,IAAI,CAAC,aAAa,IAAI,gBAAgB,EAAE,CAAC;QACvC,OAAO,4BAAG,gBAAgB,GAAI,CAAC;IACjC,CAAC;IAED,4CAA4C;IAC5C,IAAI,SAAS,IAAI,cAAc,EAAE,CAAC;QAChC,OAAO,4BAAG,cAAc,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,GAAI,CAAC;IAC1E,CAAC;IAED,MAAM,KAAK,GAAG;QACZ,IAAI;QACJ,WAAW;QACX,SAAS;QACT,aAAa;QACb,KAAK;QACL,MAAM;QACN,UAAU,EAAE,gBAAgB;QAC5B,YAAY;QACZ,MAAM;KACP,CAAC;IAEF,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACrC,QAAQ,GACkB,CAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Renown } from "./common.js";
|
|
2
|
-
import type { IRenownCrypto, JsonWebKeyPairStorage } from "./crypto/types.js";
|
|
3
|
-
import type { RenownEventEmitter, RenownStorage } from "./types.js";
|
|
4
|
-
export interface RenownBuilderOptions {
|
|
5
|
-
appName: string;
|
|
6
|
-
storage?: RenownStorage;
|
|
7
|
-
eventEmitter?: RenownEventEmitter;
|
|
8
|
-
crypto?: IRenownCrypto;
|
|
9
|
-
keyPairStorage?: JsonWebKeyPairStorage;
|
|
10
|
-
baseUrl?: string;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Base builder for creating Renown instances.
|
|
14
|
-
* Use platform-specific builders (RenownBuilder from init.browser.js or init.node.js)
|
|
15
|
-
* for pre-configured defaults.
|
|
16
|
-
*/
|
|
17
|
-
export declare class BaseRenownBuilder {
|
|
18
|
-
#private;
|
|
19
|
-
/**
|
|
20
|
-
* @param appName - Application name used for signing context
|
|
21
|
-
*/
|
|
22
|
-
constructor(appName: string);
|
|
23
|
-
/**
|
|
24
|
-
* Set custom storage for user data persistence.
|
|
25
|
-
* Defaults to in-memory storage if not set.
|
|
26
|
-
*/
|
|
27
|
-
withStorage(storage: RenownStorage): this;
|
|
28
|
-
/**
|
|
29
|
-
* Set custom event emitter for user state changes.
|
|
30
|
-
* Defaults to in-memory event emitter if not set.
|
|
31
|
-
*/
|
|
32
|
-
withEventEmitter(eventEmitter: RenownEventEmitter): this;
|
|
33
|
-
/**
|
|
34
|
-
* Set a pre-built crypto instance.
|
|
35
|
-
* Either crypto or keyPairStorage must be provided.
|
|
36
|
-
*/
|
|
37
|
-
withCrypto(crypto: IRenownCrypto): this;
|
|
38
|
-
/**
|
|
39
|
-
* Set key pair storage for cryptographic keys.
|
|
40
|
-
* A crypto instance will be built from this storage.
|
|
41
|
-
* Either crypto or keyPairStorage must be provided.
|
|
42
|
-
*/
|
|
43
|
-
withKeyPairStorage(keyPairStorage: JsonWebKeyPairStorage): this;
|
|
44
|
-
/**
|
|
45
|
-
* Set the Renown server URL for credential verification.
|
|
46
|
-
* Defaults to https://www.renown.id
|
|
47
|
-
*/
|
|
48
|
-
withBaseUrl(baseUrl: string): this;
|
|
49
|
-
/**
|
|
50
|
-
* Build and initialize the Renown instance.
|
|
51
|
-
* If a user is stored, attempts to re-authenticate them.
|
|
52
|
-
* @throws Error if neither crypto nor keyPairStorage is provided
|
|
53
|
-
*/
|
|
54
|
-
build(): Promise<Renown>;
|
|
55
|
-
/**
|
|
56
|
-
* Create a BaseRenownBuilder from options object for a more concise API
|
|
57
|
-
*/
|
|
58
|
-
static from(options: RenownBuilderOptions): BaseRenownBuilder;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=renown-builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renown-builder.d.ts","sourceRoot":"","sources":["../../src/renown-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAuB,MAAM,aAAa,CAAC;AAG1D,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEpE,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,qBAAa,iBAAiB;;IAQ5B;;OAEG;gBACS,OAAO,EAAE,MAAM;IAI3B;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAKzC;;;OAGG;IACH,gBAAgB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI;IAKxD;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAKvC;;;;OAIG;IACH,kBAAkB,CAAC,cAAc,EAAE,qBAAqB,GAAG,IAAI;IAK/D;;;OAGG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAKlC;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IAqC9B;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,oBAAoB,GAAG,iBAAiB;CAqB9D"}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { Renown, RenownMemoryStorage } from "./common.js";
|
|
2
|
-
import { DEFAULT_RENOWN_URL } from "./constants.js";
|
|
3
|
-
import { RenownCryptoBuilder } from "./crypto/renown-crypto-builder.js";
|
|
4
|
-
import { MemoryEventEmitter } from "./event/memory.js";
|
|
5
|
-
/**
|
|
6
|
-
* Base builder for creating Renown instances.
|
|
7
|
-
* Use platform-specific builders (RenownBuilder from init.browser.js or init.node.js)
|
|
8
|
-
* for pre-configured defaults.
|
|
9
|
-
*/
|
|
10
|
-
export class BaseRenownBuilder {
|
|
11
|
-
#appName;
|
|
12
|
-
#storage;
|
|
13
|
-
#eventEmitter;
|
|
14
|
-
#crypto;
|
|
15
|
-
#keyPairStorage;
|
|
16
|
-
#baseUrl;
|
|
17
|
-
/**
|
|
18
|
-
* @param appName - Application name used for signing context
|
|
19
|
-
*/
|
|
20
|
-
constructor(appName) {
|
|
21
|
-
this.#appName = appName;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Set custom storage for user data persistence.
|
|
25
|
-
* Defaults to in-memory storage if not set.
|
|
26
|
-
*/
|
|
27
|
-
withStorage(storage) {
|
|
28
|
-
this.#storage = storage;
|
|
29
|
-
return this;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Set custom event emitter for user state changes.
|
|
33
|
-
* Defaults to in-memory event emitter if not set.
|
|
34
|
-
*/
|
|
35
|
-
withEventEmitter(eventEmitter) {
|
|
36
|
-
this.#eventEmitter = eventEmitter;
|
|
37
|
-
return this;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Set a pre-built crypto instance.
|
|
41
|
-
* Either crypto or keyPairStorage must be provided.
|
|
42
|
-
*/
|
|
43
|
-
withCrypto(crypto) {
|
|
44
|
-
this.#crypto = crypto;
|
|
45
|
-
return this;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Set key pair storage for cryptographic keys.
|
|
49
|
-
* A crypto instance will be built from this storage.
|
|
50
|
-
* Either crypto or keyPairStorage must be provided.
|
|
51
|
-
*/
|
|
52
|
-
withKeyPairStorage(keyPairStorage) {
|
|
53
|
-
this.#keyPairStorage = keyPairStorage;
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Set the Renown server URL for credential verification.
|
|
58
|
-
* Defaults to https://www.renown.id
|
|
59
|
-
*/
|
|
60
|
-
withBaseUrl(baseUrl) {
|
|
61
|
-
this.#baseUrl = baseUrl;
|
|
62
|
-
return this;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Build and initialize the Renown instance.
|
|
66
|
-
* If a user is stored, attempts to re-authenticate them.
|
|
67
|
-
* @throws Error if neither crypto nor keyPairStorage is provided
|
|
68
|
-
*/
|
|
69
|
-
async build() {
|
|
70
|
-
if (!this.#crypto && !this.#keyPairStorage) {
|
|
71
|
-
throw new Error("Either crypto or keyPairStorage is required. Use withCrypto() or withKeyPairStorage() to set one.");
|
|
72
|
-
}
|
|
73
|
-
const crypto = this.#crypto ??
|
|
74
|
-
(await new RenownCryptoBuilder()
|
|
75
|
-
.withKeyPairStorage(this.#keyPairStorage)
|
|
76
|
-
.build());
|
|
77
|
-
const storage = this.#storage ?? new RenownMemoryStorage();
|
|
78
|
-
const eventEmitter = this.#eventEmitter ?? new MemoryEventEmitter();
|
|
79
|
-
const baseUrl = this.#baseUrl ?? DEFAULT_RENOWN_URL;
|
|
80
|
-
const renown = new Renown(storage, eventEmitter, crypto, this.#appName, baseUrl);
|
|
81
|
-
// Re-authenticate stored user if present
|
|
82
|
-
if (renown.user) {
|
|
83
|
-
try {
|
|
84
|
-
await renown.login(renown.user.did);
|
|
85
|
-
}
|
|
86
|
-
catch (error) {
|
|
87
|
-
console.error("Failed to re-authenticate user:", error);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return renown;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Create a BaseRenownBuilder from options object for a more concise API
|
|
94
|
-
*/
|
|
95
|
-
static from(options) {
|
|
96
|
-
const builder = new BaseRenownBuilder(options.appName);
|
|
97
|
-
if (options.storage) {
|
|
98
|
-
builder.withStorage(options.storage);
|
|
99
|
-
}
|
|
100
|
-
if (options.eventEmitter) {
|
|
101
|
-
builder.withEventEmitter(options.eventEmitter);
|
|
102
|
-
}
|
|
103
|
-
if (options.crypto) {
|
|
104
|
-
builder.withCrypto(options.crypto);
|
|
105
|
-
}
|
|
106
|
-
if (options.keyPairStorage) {
|
|
107
|
-
builder.withKeyPairStorage(options.keyPairStorage);
|
|
108
|
-
}
|
|
109
|
-
if (options.baseUrl) {
|
|
110
|
-
builder.withBaseUrl(options.baseUrl);
|
|
111
|
-
}
|
|
112
|
-
return builder;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=renown-builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renown-builder.js","sourceRoot":"","sources":["../../src/renown-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAYvD;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IAC5B,QAAQ,CAAS;IACjB,QAAQ,CAAiB;IACzB,aAAa,CAAsB;IACnC,OAAO,CAAiB;IACxB,eAAe,CAAyB;IACxC,QAAQ,CAAU;IAElB;;OAEG;IACH,YAAY,OAAe;QACzB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACH,WA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F,yCAAyC;QACzC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YAChB,IAAI,CAAC;gBACH,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACtC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,OAA6B;QACvC,MAAM,OAAO,GAAG,IAAI,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAEvD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YACzB,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACrC,CAAC;QACD,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;YAC3B,OAAO,CAAC,kBAAkB,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface IStorage<T extends Record<string, unknown> = Record<string, unknown>, Key extends keyof T = keyof T> {
|
|
2
|
-
get(key: Key): T[Key] | undefined;
|
|
3
|
-
set(key: Key, value?: T[Key]): void;
|
|
4
|
-
delete(key: Key): void;
|
|
5
|
-
}
|
|
6
|
-
export declare abstract class BaseStorage<T extends Record<string, unknown> = Record<string, unknown>, Key extends keyof T = keyof T> implements IStorage<T> {
|
|
7
|
-
abstract get(key: Key): T[Key] | undefined;
|
|
8
|
-
abstract set(key: Key, value?: T[Key]): void;
|
|
9
|
-
abstract delete(key: Key): void;
|
|
10
|
-
}
|
|
11
|
-
export declare class MemoryStorage<T extends Record<string, unknown> = Record<string, unknown>, Key extends keyof T = keyof T> extends BaseStorage<T> {
|
|
12
|
-
private readonly data;
|
|
13
|
-
get(key: Key): T[Key] | undefined;
|
|
14
|
-
set(key: Key, value?: T[Key]): void;
|
|
15
|
-
delete(key: Key): void;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/storage/common.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ,CACvB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,GAAG,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC;IAE7B,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAClC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACpC,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAC;CACxB;AAED,8BAAsB,WAAW,CAC/B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,GAAG,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,CAC7B,YAAW,QAAQ,CAAC,CAAC,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS;IAC1C,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI;IAC5C,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI;CAChC;AAED,qBAAa,aAAa,CACxB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,GAAG,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,CAC7B,SAAQ,WAAW,CAAC,CAAC,CAAC;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA0B;IAE/C,GAAG,CAAC,GAAG,EAAE,GAAG;IAIZ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI;IAQnC,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI;CAGvB"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export class BaseStorage {
|
|
2
|
-
}
|
|
3
|
-
export class MemoryStorage extends BaseStorage {
|
|
4
|
-
data = new Map();
|
|
5
|
-
get(key) {
|
|
6
|
-
return this.data.get(key);
|
|
7
|
-
}
|
|
8
|
-
set(key, value) {
|
|
9
|
-
if (value === undefined) {
|
|
10
|
-
this.data.delete(key);
|
|
11
|
-
}
|
|
12
|
-
else {
|
|
13
|
-
this.data.set(key, value);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
delete(key) {
|
|
17
|
-
this.data.delete(key);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=common.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/storage/common.ts"],"names":[],"mappings":"AASA,MAAM,OAAgB,WAAW;CAOhC;AAED,MAAM,OAAO,aAGX,SAAQ,WAAc;IACL,IAAI,GAAG,IAAI,GAAG,EAAe,CAAC;IAE/C,GAAG,CAAC,GAAQ;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,GAAG,CAAC,GAAQ,EAAE,KAAc;QAC1B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,MAAM,CAAC,GAAQ;QACb,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BaseStorage } from "./common.js";
|
|
2
|
-
export declare class BrowserStorage<T extends Record<string, unknown> = Record<string, unknown>> extends BaseStorage<T> {
|
|
3
|
-
#private;
|
|
4
|
-
private readonly namespace;
|
|
5
|
-
constructor(namespace: string, basename: string | undefined);
|
|
6
|
-
get<Key extends keyof T>(key: Key): T[Key] | undefined;
|
|
7
|
-
set<Key extends keyof T>(key: Key, value?: T[Key]): void;
|
|
8
|
-
delete(key: keyof T): void;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=storage.browser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.browser.d.ts","sourceRoot":"","sources":["../../../src/storage/storage.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,cAAc,CACzB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC3D,SAAQ,WAAW,CAAC,CAAC,CAAC;;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS;IAQ3D,GAAG,CAAC,GAAG,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS;IAQtD,GAAG,CAAC,GAAG,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI;IAMxD,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI;CAG3B"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { BaseStorage } from "./common.js";
|
|
2
|
-
export class BrowserStorage extends BaseStorage {
|
|
3
|
-
namespace;
|
|
4
|
-
constructor(namespace, basename) {
|
|
5
|
-
super();
|
|
6
|
-
this.namespace = `${basename}:${namespace}`;
|
|
7
|
-
}
|
|
8
|
-
#buildKey(key) {
|
|
9
|
-
return `${this.namespace}:${key.toString()}`;
|
|
10
|
-
}
|
|
11
|
-
get(key) {
|
|
12
|
-
const value = localStorage.getItem(this.#buildKey(key));
|
|
13
|
-
if (value) {
|
|
14
|
-
return JSON.parse(value);
|
|
15
|
-
}
|
|
16
|
-
return undefined;
|
|
17
|
-
}
|
|
18
|
-
set(key, value) {
|
|
19
|
-
return value
|
|
20
|
-
? localStorage.setItem(this.#buildKey(key), JSON.stringify(value))
|
|
21
|
-
: localStorage.removeItem(this.#buildKey(key));
|
|
22
|
-
}
|
|
23
|
-
delete(key) {
|
|
24
|
-
return localStorage.removeItem(this.#buildKey(key));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=storage.browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.browser.js","sourceRoot":"","sources":["../../../src/storage/storage.browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,cAEX,SAAQ,WAAc;IACL,SAAS,CAAS;IAEnC,YAAY,SAAiB,EAAE,QAA4B;QACzD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,SAAS,GAAG,GAAG,QAAQ,IAAI,SAAS,EAAE,CAAC;IAC9C,CAAC;IAED,SAAS,CAAC,GAAY;QACpB,OAAO,GAAG,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC;IAC/C,CAAC;IACD,GAAG,CAAsB,GAAQ;QAC/B,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;QACxD,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAW,CAAC;QACrC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,GAAG,CAAsB,GAAQ,EAAE,KAAc;QAC/C,OAAO,KAAK;YACV,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAClE,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IACnD,CAAC;IAED,MAAM,CAAC,GAAY;QACjB,OAAO,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BaseStorage } from "./common.js";
|
|
2
|
-
export declare class NodeStorage<T extends Record<string, unknown> = Record<string, unknown>> extends BaseStorage<T> {
|
|
3
|
-
private readonly filePath;
|
|
4
|
-
constructor(filePath: string);
|
|
5
|
-
private readData;
|
|
6
|
-
private writeData;
|
|
7
|
-
get<Key extends keyof T>(key: Key): T[Key] | undefined;
|
|
8
|
-
set<Key extends keyof T>(key: Key, value?: T[Key]): void;
|
|
9
|
-
delete(key: keyof T): void;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=storage.node.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.node.d.ts","sourceRoot":"","sources":["../../../src/storage/storage.node.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,qBAAa,WAAW,CACtB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC3D,SAAQ,WAAW,CAAC,CAAC,CAAC;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,QAAQ,EAAE,MAAM;IAY5B,OAAO,CAAC,QAAQ;IAKhB,OAAO,CAAC,SAAS;IAIjB,GAAG,CAAC,GAAG,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS;IAKtD,GAAG,CAAC,GAAG,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI;IAUxD,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI;CAK3B"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { dirname } from "node:path";
|
|
3
|
-
import { BaseStorage } from "./common.js";
|
|
4
|
-
export class NodeStorage extends BaseStorage {
|
|
5
|
-
filePath;
|
|
6
|
-
constructor(filePath) {
|
|
7
|
-
super();
|
|
8
|
-
this.filePath = filePath;
|
|
9
|
-
const parentFolder = dirname(this.filePath);
|
|
10
|
-
mkdirSync(parentFolder, { recursive: true });
|
|
11
|
-
if (!existsSync(this.filePath)) {
|
|
12
|
-
writeFileSync(this.filePath, JSON.stringify({}));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
readData() {
|
|
16
|
-
const data = readFileSync(this.filePath, "utf-8");
|
|
17
|
-
return JSON.parse(data);
|
|
18
|
-
}
|
|
19
|
-
writeData(data) {
|
|
20
|
-
writeFileSync(this.filePath, JSON.stringify(data, null, 2));
|
|
21
|
-
}
|
|
22
|
-
get(key) {
|
|
23
|
-
const data = this.readData();
|
|
24
|
-
return data[key];
|
|
25
|
-
}
|
|
26
|
-
set(key, value) {
|
|
27
|
-
const data = this.readData();
|
|
28
|
-
if (value === undefined) {
|
|
29
|
-
delete data[key];
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
data[key] = value;
|
|
33
|
-
}
|
|
34
|
-
this.writeData(data);
|
|
35
|
-
}
|
|
36
|
-
delete(key) {
|
|
37
|
-
const data = this.readData();
|
|
38
|
-
delete data[key];
|
|
39
|
-
this.writeData(data);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=storage.node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.node.js","sourceRoot":"","sources":["../../../src/storage/storage.node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,WAEX,SAAQ,WAAc;IACL,QAAQ,CAAS;IAElC,YAAY,QAAgB;QAC1B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5C,SA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|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { Verifiable, VerifiedCredential } from "did-jwt-vc";
|
|
2
|
-
import type { User as EditorUser, ISigner } from "document-model";
|
|
3
|
-
import type { CREDENTIAL_TYPES } from "./constants.js";
|
|
4
|
-
import type { IEventEmitter } from "./event/types.js";
|
|
5
|
-
import type { IStorage } from "./storage/common.js";
|
|
6
|
-
export type InternalUser = EditorUser & {
|
|
7
|
-
did: string;
|
|
8
|
-
credential: PowerhouseVerifiableCredential | undefined;
|
|
9
|
-
};
|
|
10
|
-
export type User = InternalUser;
|
|
11
|
-
export type Unsubscribe = () => void;
|
|
12
|
-
export type RenownStorageMap = {
|
|
13
|
-
user: InternalUser | undefined;
|
|
14
|
-
};
|
|
15
|
-
export type RenownStorage = IStorage<RenownStorageMap>;
|
|
16
|
-
export type RenownEvents = {
|
|
17
|
-
user: User | undefined;
|
|
18
|
-
};
|
|
19
|
-
export type RenownEventEmitter = IEventEmitter<RenownEvents>;
|
|
20
|
-
export interface IRenown extends Pick<RenownEventEmitter, "on"> {
|
|
21
|
-
readonly baseUrl: string;
|
|
22
|
-
readonly user: User | undefined;
|
|
23
|
-
login: (userDid: string) => Promise<User>;
|
|
24
|
-
logout: () => Promise<void>;
|
|
25
|
-
readonly signer: ISigner;
|
|
26
|
-
readonly did: string;
|
|
27
|
-
verifyBearerToken: (token: string) => Promise<false | VerifiedCredential>;
|
|
28
|
-
getBearerToken: (options: CreateBearerTokenOptions, refresh?: boolean) => Promise<string>;
|
|
29
|
-
}
|
|
30
|
-
type IssuerType<T> = {
|
|
31
|
-
id: string;
|
|
32
|
-
} & T;
|
|
33
|
-
type CredentialSubjecType<T> = {
|
|
34
|
-
id?: string;
|
|
35
|
-
} & T;
|
|
36
|
-
interface CredentialStatus {
|
|
37
|
-
id: string;
|
|
38
|
-
type: string;
|
|
39
|
-
}
|
|
40
|
-
interface CredentialSchema {
|
|
41
|
-
id: string;
|
|
42
|
-
type: string;
|
|
43
|
-
}
|
|
44
|
-
interface IVerifiableCredentialPayload<Subject, Issuer> {
|
|
45
|
-
"@context": string[];
|
|
46
|
-
id: string;
|
|
47
|
-
type: string[];
|
|
48
|
-
issuer: IssuerType<Issuer>;
|
|
49
|
-
issuanceDate: string;
|
|
50
|
-
expirationDate?: string;
|
|
51
|
-
credentialSubject: CredentialSubjecType<Subject>;
|
|
52
|
-
credentialStatus?: CredentialStatus;
|
|
53
|
-
credentialSchema: CredentialSchema;
|
|
54
|
-
}
|
|
55
|
-
export interface IProof {
|
|
56
|
-
verificationMethod: string;
|
|
57
|
-
ethereumAddress: `0x${string}`;
|
|
58
|
-
created: string;
|
|
59
|
-
proofPurpose: string;
|
|
60
|
-
type: string;
|
|
61
|
-
proofValue: string;
|
|
62
|
-
eip712: {
|
|
63
|
-
domain: {
|
|
64
|
-
name: string;
|
|
65
|
-
version: string;
|
|
66
|
-
chainId: number;
|
|
67
|
-
verifyingContract: string;
|
|
68
|
-
};
|
|
69
|
-
types: typeof CREDENTIAL_TYPES;
|
|
70
|
-
primaryType: "VerifiableCredential";
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
export interface IVerifiableCredential<Subject, Issuer> extends IVerifiableCredentialPayload<Subject, Issuer> {
|
|
74
|
-
proof: IProof;
|
|
75
|
-
}
|
|
76
|
-
export interface IPowerhouseCredentialSubject {
|
|
77
|
-
id: string;
|
|
78
|
-
app: string;
|
|
79
|
-
name?: string;
|
|
80
|
-
}
|
|
81
|
-
export interface IPowerhouseIssuerType {
|
|
82
|
-
ethereumAddress: `0x${string}`;
|
|
83
|
-
}
|
|
84
|
-
export type PowerhouseVerifiableCredential = IVerifiableCredential<IPowerhouseCredentialSubject, IPowerhouseIssuerType>;
|
|
85
|
-
export interface IAuthCredentialSubject {
|
|
86
|
-
chainId: number;
|
|
87
|
-
networkId: string;
|
|
88
|
-
address: string;
|
|
89
|
-
}
|
|
90
|
-
export type AuthVerifiableCredential = IVerifiableCredential<IAuthCredentialSubject, {}>;
|
|
91
|
-
export type AuthVerifiedCredential = VerifiedCredential & {
|
|
92
|
-
verifiableCredential: Verifiable<AuthVerifiableCredential>;
|
|
93
|
-
};
|
|
94
|
-
export type PKHDid = {
|
|
95
|
-
networkId: string;
|
|
96
|
-
chainId: number;
|
|
97
|
-
address: `0x${string}`;
|
|
98
|
-
};
|
|
99
|
-
export interface CreateBearerTokenOptions {
|
|
100
|
-
expiresIn?: number;
|
|
101
|
-
aud?: string;
|
|
102
|
-
}
|
|
103
|
-
export {};
|
|
104
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,KAAK,EAAE,IAAI,IAAI,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,8BAA8B,GAAG,SAAS,CAAC;CACxD,CAAC;AAGF,MAAM,MAAM,IAAI,GAAG,YAAY,CAAC;AAEhC,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAErC,MAAM,MAAM,gBAAgB,GAAG;IAAE,IAAI,EAAE,YAAY,GAAG,SAAS,CAAA;CAAE,CAAC;AAElE,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AAEvD,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC;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,GAAG,qBAAqB,CAC1D,sBAAsB,EACtB,EAAE,CACH,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG;IACxD,oBAAoB,EAAE,UAAU,CAAC,wBAAwB,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd"}
|
package/dist/src/types.js
DELETED
package/dist/src/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|