@renown/sdk 6.0.0-dev.23 → 6.0.0-dev.230

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.
Files changed (197) hide show
  1. package/README.md +47 -437
  2. package/dist/index.d.ts +77 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +173 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/node.d.ts +136 -0
  7. package/dist/node.d.ts.map +1 -0
  8. package/dist/node.js +305 -0
  9. package/dist/node.js.map +1 -0
  10. package/dist/renown-builder-EmbIygby.js +819 -0
  11. package/dist/renown-builder-EmbIygby.js.map +1 -0
  12. package/dist/utils-BGF8Qb5f.d.ts +689 -0
  13. package/dist/utils-BGF8Qb5f.d.ts.map +1 -0
  14. package/package.json +15 -38
  15. package/dist/e2e/fixtures/main.d.ts +0 -2
  16. package/dist/e2e/fixtures/main.d.ts.map +0 -1
  17. package/dist/e2e/fixtures/main.js +0 -97
  18. package/dist/e2e/fixtures/main.js.map +0 -1
  19. package/dist/e2e/fixtures/vite.config.d.ts +0 -3
  20. package/dist/e2e/fixtures/vite.config.d.ts.map +0 -1
  21. package/dist/e2e/fixtures/vite.config.js +0 -10
  22. package/dist/e2e/fixtures/vite.config.js.map +0 -1
  23. package/dist/e2e/renown-components.spec.d.ts +0 -2
  24. package/dist/e2e/renown-components.spec.d.ts.map +0 -1
  25. package/dist/e2e/renown-components.spec.js +0 -155
  26. package/dist/e2e/renown-components.spec.js.map +0 -1
  27. package/dist/playwright.config.d.ts +0 -3
  28. package/dist/playwright.config.d.ts.map +0 -1
  29. package/dist/playwright.config.js +0 -25
  30. package/dist/playwright.config.js.map +0 -1
  31. package/dist/src/assets/assets.d.ts +0 -19
  32. package/dist/src/assets/renown-hover.svg +0 -17
  33. package/dist/src/assets/renown-light.svg +0 -15
  34. package/dist/src/assets/renown-short-hover.png +0 -0
  35. package/dist/src/assets/renown-short.png +0 -0
  36. package/dist/src/assets/renown.svg +0 -16
  37. package/dist/src/common.d.ts +0 -15
  38. package/dist/src/common.d.ts.map +0 -1
  39. package/dist/src/common.js +0 -105
  40. package/dist/src/common.js.map +0 -1
  41. package/dist/src/components/RenownAuthButton.d.ts +0 -62
  42. package/dist/src/components/RenownAuthButton.d.ts.map +0 -1
  43. package/dist/src/components/RenownAuthButton.js +0 -82
  44. package/dist/src/components/RenownAuthButton.js.map +0 -1
  45. package/dist/src/components/RenownLoginButton.d.ts +0 -48
  46. package/dist/src/components/RenownLoginButton.d.ts.map +0 -1
  47. package/dist/src/components/RenownLoginButton.js +0 -175
  48. package/dist/src/components/RenownLoginButton.js.map +0 -1
  49. package/dist/src/components/RenownUserButton.d.ts +0 -66
  50. package/dist/src/components/RenownUserButton.d.ts.map +0 -1
  51. package/dist/src/components/RenownUserButton.js +0 -216
  52. package/dist/src/components/RenownUserButton.js.map +0 -1
  53. package/dist/src/components/icons.d.ts +0 -25
  54. package/dist/src/components/icons.d.ts.map +0 -1
  55. package/dist/src/components/icons.js +0 -24
  56. package/dist/src/components/icons.js.map +0 -1
  57. package/dist/src/components/image-data.d.ts +0 -3
  58. package/dist/src/components/image-data.d.ts.map +0 -1
  59. package/dist/src/components/image-data.js +0 -4
  60. package/dist/src/components/image-data.js.map +0 -1
  61. package/dist/src/components/index.d.ts +0 -8
  62. package/dist/src/components/index.d.ts.map +0 -1
  63. package/dist/src/components/index.js +0 -5
  64. package/dist/src/components/index.js.map +0 -1
  65. package/dist/src/constants.d.ts +0 -130
  66. package/dist/src/constants.d.ts.map +0 -1
  67. package/dist/src/constants.js +0 -40
  68. package/dist/src/constants.js.map +0 -1
  69. package/dist/src/crypto/browser-key-storage.d.ts +0 -8
  70. package/dist/src/crypto/browser-key-storage.d.ts.map +0 -1
  71. package/dist/src/crypto/browser-key-storage.js +0 -73
  72. package/dist/src/crypto/browser-key-storage.js.map +0 -1
  73. package/dist/src/crypto/index.d.ts +0 -36
  74. package/dist/src/crypto/index.d.ts.map +0 -1
  75. package/dist/src/crypto/index.js +0 -130
  76. package/dist/src/crypto/index.js.map +0 -1
  77. package/dist/src/crypto/node-key-storage.d.ts +0 -8
  78. package/dist/src/crypto/node-key-storage.d.ts.map +0 -1
  79. package/dist/src/crypto/node-key-storage.js +0 -67
  80. package/dist/src/crypto/node-key-storage.js.map +0 -1
  81. package/dist/src/crypto/node.d.ts +0 -2
  82. package/dist/src/crypto/node.d.ts.map +0 -1
  83. package/dist/src/crypto/node.js +0 -3
  84. package/dist/src/crypto/node.js.map +0 -1
  85. package/dist/src/crypto/signer.d.ts +0 -21
  86. package/dist/src/crypto/signer.d.ts.map +0 -1
  87. package/dist/src/crypto/signer.js +0 -236
  88. package/dist/src/crypto/signer.js.map +0 -1
  89. package/dist/src/event/event.browser.d.ts +0 -10
  90. package/dist/src/event/event.browser.d.ts.map +0 -1
  91. package/dist/src/event/event.browser.js +0 -24
  92. package/dist/src/event/event.browser.js.map +0 -1
  93. package/dist/src/event/event.node.d.ts +0 -8
  94. package/dist/src/event/event.node.d.ts.map +0 -1
  95. package/dist/src/event/event.node.js +0 -17
  96. package/dist/src/event/event.node.js.map +0 -1
  97. package/dist/src/event/types.d.ts +0 -16
  98. package/dist/src/event/types.d.ts.map +0 -1
  99. package/dist/src/event/types.js +0 -2
  100. package/dist/src/event/types.js.map +0 -1
  101. package/dist/src/hooks/index.d.ts +0 -2
  102. package/dist/src/hooks/index.d.ts.map +0 -1
  103. package/dist/src/hooks/index.js +0 -2
  104. package/dist/src/hooks/index.js.map +0 -1
  105. package/dist/src/hooks/use-user.d.ts +0 -21
  106. package/dist/src/hooks/use-user.d.ts.map +0 -1
  107. package/dist/src/hooks/use-user.js +0 -30
  108. package/dist/src/hooks/use-user.js.map +0 -1
  109. package/dist/src/index.browser.d.ts +0 -4
  110. package/dist/src/index.browser.d.ts.map +0 -1
  111. package/dist/src/index.browser.js +0 -4
  112. package/dist/src/index.browser.js.map +0 -1
  113. package/dist/src/index.d.ts +0 -13
  114. package/dist/src/index.d.ts.map +0 -1
  115. package/dist/src/index.js +0 -13
  116. package/dist/src/index.js.map +0 -1
  117. package/dist/src/index.node.d.ts +0 -4
  118. package/dist/src/index.node.d.ts.map +0 -1
  119. package/dist/src/index.node.js +0 -4
  120. package/dist/src/index.node.js.map +0 -1
  121. package/dist/src/init.browser.d.ts +0 -3
  122. package/dist/src/init.browser.d.ts.map +0 -1
  123. package/dist/src/init.browser.js +0 -7
  124. package/dist/src/init.browser.js.map +0 -1
  125. package/dist/src/init.node.d.ts +0 -3
  126. package/dist/src/init.node.d.ts.map +0 -1
  127. package/dist/src/init.node.js +0 -8
  128. package/dist/src/init.node.js.map +0 -1
  129. package/dist/src/lib/crypto/browser.d.ts +0 -8
  130. package/dist/src/lib/crypto/browser.d.ts.map +0 -1
  131. package/dist/src/lib/crypto/browser.js +0 -73
  132. package/dist/src/lib/crypto/browser.js.map +0 -1
  133. package/dist/src/lib/crypto/index.d.ts +0 -36
  134. package/dist/src/lib/crypto/index.d.ts.map +0 -1
  135. package/dist/src/lib/crypto/index.js +0 -150
  136. package/dist/src/lib/crypto/index.js.map +0 -1
  137. package/dist/src/lib/crypto/node.d.ts +0 -8
  138. package/dist/src/lib/crypto/node.d.ts.map +0 -1
  139. package/dist/src/lib/crypto/node.js +0 -67
  140. package/dist/src/lib/crypto/node.js.map +0 -1
  141. package/dist/src/lib/renown/constants.d.ts +0 -130
  142. package/dist/src/lib/renown/constants.d.ts.map +0 -1
  143. package/dist/src/lib/renown/constants.js +0 -40
  144. package/dist/src/lib/renown/constants.js.map +0 -1
  145. package/dist/src/lib/renown/did-parser.d.ts +0 -28
  146. package/dist/src/lib/renown/did-parser.d.ts.map +0 -1
  147. package/dist/src/lib/renown/did-parser.js +0 -57
  148. package/dist/src/lib/renown/did-parser.js.map +0 -1
  149. package/dist/src/lib/renown/index.d.ts +0 -4
  150. package/dist/src/lib/renown/index.d.ts.map +0 -1
  151. package/dist/src/lib/renown/index.js +0 -4
  152. package/dist/src/lib/renown/index.js.map +0 -1
  153. package/dist/src/lib/renown/utils.d.ts +0 -33
  154. package/dist/src/lib/renown/utils.d.ts.map +0 -1
  155. package/dist/src/lib/renown/utils.js +0 -207
  156. package/dist/src/lib/renown/utils.js.map +0 -1
  157. package/dist/src/lib/session-storage.d.ts +0 -40
  158. package/dist/src/lib/session-storage.d.ts.map +0 -1
  159. package/dist/src/lib/session-storage.js +0 -107
  160. package/dist/src/lib/session-storage.js.map +0 -1
  161. package/dist/src/node.d.ts +0 -6
  162. package/dist/src/node.d.ts.map +0 -1
  163. package/dist/src/node.js +0 -6
  164. package/dist/src/node.js.map +0 -1
  165. package/dist/src/providers/index.d.ts +0 -3
  166. package/dist/src/providers/index.d.ts.map +0 -1
  167. package/dist/src/providers/index.js +0 -2
  168. package/dist/src/providers/index.js.map +0 -1
  169. package/dist/src/providers/renown-user-provider.d.ts +0 -72
  170. package/dist/src/providers/renown-user-provider.d.ts.map +0 -1
  171. package/dist/src/providers/renown-user-provider.js +0 -171
  172. package/dist/src/providers/renown-user-provider.js.map +0 -1
  173. package/dist/src/storage/common.d.ts +0 -13
  174. package/dist/src/storage/common.d.ts.map +0 -1
  175. package/dist/src/storage/common.js +0 -7
  176. package/dist/src/storage/common.js.map +0 -1
  177. package/dist/src/storage/storage.browser.d.ts +0 -9
  178. package/dist/src/storage/storage.browser.d.ts.map +0 -1
  179. package/dist/src/storage/storage.browser.js +0 -25
  180. package/dist/src/storage/storage.browser.js.map +0 -1
  181. package/dist/src/storage/storage.node.d.ts +0 -11
  182. package/dist/src/storage/storage.node.d.ts.map +0 -1
  183. package/dist/src/storage/storage.node.js +0 -40
  184. package/dist/src/storage/storage.node.js.map +0 -1
  185. package/dist/src/types.d.ts +0 -80
  186. package/dist/src/types.d.ts.map +0 -1
  187. package/dist/src/types.js +0 -2
  188. package/dist/src/types.js.map +0 -1
  189. package/dist/src/utils.d.ts +0 -17
  190. package/dist/src/utils.d.ts.map +0 -1
  191. package/dist/src/utils.js +0 -80
  192. package/dist/src/utils.js.map +0 -1
  193. package/dist/tests/auth.test.d.ts +0 -2
  194. package/dist/tests/auth.test.d.ts.map +0 -1
  195. package/dist/tests/auth.test.js +0 -13
  196. package/dist/tests/auth.test.js.map +0 -1
  197. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,689 @@
1
+ import { Resolver } from "did-resolver";
2
+ import { Action, AppActionSigner, ISigner, ISigner as ISigner$1, Signature, SignatureVerificationHandler, User, UserActionSigner } from "@powerhousedao/shared/document-model";
3
+
4
+ //#region src/constants.d.ts
5
+ declare const DEFAULT_RENOWN_URL = "https://www.renown.id";
6
+ declare const DEFAULT_RENOWN_NETWORK_ID = "eip155";
7
+ declare const DEFAULT_RENOWN_CHAIN_ID = "1";
8
+ declare const DOMAIN_TYPE: readonly [{
9
+ readonly name: "name";
10
+ readonly type: "string";
11
+ }, {
12
+ readonly name: "version";
13
+ readonly type: "string";
14
+ }, {
15
+ readonly name: "chainId";
16
+ readonly type: "uint256";
17
+ }, {
18
+ readonly name: "verifyingContract";
19
+ readonly type: "address";
20
+ }];
21
+ declare const VERIFIABLE_CREDENTIAL_EIP712_TYPE: readonly [{
22
+ readonly name: "@context";
23
+ readonly type: "string[]";
24
+ }, {
25
+ readonly name: "type";
26
+ readonly type: "string[]";
27
+ }, {
28
+ readonly name: "id";
29
+ readonly type: "string";
30
+ }, {
31
+ readonly name: "issuer";
32
+ readonly type: "Issuer";
33
+ }, {
34
+ readonly name: "credentialSubject";
35
+ readonly type: "CredentialSubject";
36
+ }, {
37
+ readonly name: "credentialSchema";
38
+ readonly type: "CredentialSchema";
39
+ }, {
40
+ readonly name: "issuanceDate";
41
+ readonly type: "string";
42
+ }, {
43
+ readonly name: "expirationDate";
44
+ readonly type: "string";
45
+ }];
46
+ declare const CREDENTIAL_SCHEMA_EIP712_TYPE: readonly [{
47
+ readonly name: "id";
48
+ readonly type: "string";
49
+ }, {
50
+ readonly name: "type";
51
+ readonly type: "string";
52
+ }];
53
+ declare const CREDENTIAL_SUBJECT_TYPE: readonly [{
54
+ readonly name: "app";
55
+ readonly type: "string";
56
+ }, {
57
+ readonly name: "id";
58
+ readonly type: "string";
59
+ }, {
60
+ readonly name: "name";
61
+ readonly type: "string";
62
+ }];
63
+ declare const ISSUER_TYPE: readonly [{
64
+ readonly name: "id";
65
+ readonly type: "string";
66
+ }, {
67
+ readonly name: "ethereumAddress";
68
+ readonly type: "string";
69
+ }];
70
+ declare const CREDENTIAL_TYPES: {
71
+ readonly EIP712Domain: readonly [{
72
+ readonly name: "name";
73
+ readonly type: "string";
74
+ }, {
75
+ readonly name: "version";
76
+ readonly type: "string";
77
+ }, {
78
+ readonly name: "chainId";
79
+ readonly type: "uint256";
80
+ }, {
81
+ readonly name: "verifyingContract";
82
+ readonly type: "address";
83
+ }];
84
+ readonly VerifiableCredential: readonly [{
85
+ readonly name: "@context";
86
+ readonly type: "string[]";
87
+ }, {
88
+ readonly name: "type";
89
+ readonly type: "string[]";
90
+ }, {
91
+ readonly name: "id";
92
+ readonly type: "string";
93
+ }, {
94
+ readonly name: "issuer";
95
+ readonly type: "Issuer";
96
+ }, {
97
+ readonly name: "credentialSubject";
98
+ readonly type: "CredentialSubject";
99
+ }, {
100
+ readonly name: "credentialSchema";
101
+ readonly type: "CredentialSchema";
102
+ }, {
103
+ readonly name: "issuanceDate";
104
+ readonly type: "string";
105
+ }, {
106
+ readonly name: "expirationDate";
107
+ readonly type: "string";
108
+ }];
109
+ readonly CredentialSchema: readonly [{
110
+ readonly name: "id";
111
+ readonly type: "string";
112
+ }, {
113
+ readonly name: "type";
114
+ readonly type: "string";
115
+ }];
116
+ readonly CredentialSubject: readonly [{
117
+ readonly name: "app";
118
+ readonly type: "string";
119
+ }, {
120
+ readonly name: "id";
121
+ readonly type: "string";
122
+ }, {
123
+ readonly name: "name";
124
+ readonly type: "string";
125
+ }];
126
+ readonly Issuer: readonly [{
127
+ readonly name: "id";
128
+ readonly type: "string";
129
+ }, {
130
+ readonly name: "ethereumAddress";
131
+ readonly type: "string";
132
+ }];
133
+ };
134
+ //#endregion
135
+ //#region src/crypto/types.d.ts
136
+ type JwkKeyPair = {
137
+ publicKey: JsonWebKey;
138
+ privateKey: JsonWebKey;
139
+ };
140
+ interface JsonWebKeyPairStorage {
141
+ loadKeyPair(): Promise<JwkKeyPair | undefined>;
142
+ saveKeyPair(keyPair: JwkKeyPair): Promise<void>;
143
+ removeKeyPair(): Promise<void>;
144
+ }
145
+ type DID = `did:${string}`;
146
+ interface IRenownCrypto {
147
+ did: DID;
148
+ publicKey: CryptoKey;
149
+ removeDid(): Promise<void>;
150
+ sign: (data: Uint8Array) => Promise<Uint8Array>;
151
+ verify: (data: Uint8Array, signature: Uint8Array) => Promise<boolean>;
152
+ issuer: Issuer;
153
+ getBearerToken: (address: string | undefined, options?: CreateBearerTokenOptions) => Promise<string>;
154
+ }
155
+ /**
156
+ * @deprecated Use IRenownCrypto instead
157
+ */
158
+ interface IConnectCrypto extends IRenownCrypto {}
159
+ //#endregion
160
+ //#region src/event/types.d.ts
161
+ interface IEventEmitter<Events extends Record<string, unknown>> {
162
+ /**
163
+ * Registers a listener for the specified event.
164
+ * @param event - The event name.
165
+ * @param listener - The listener function for the event.
166
+ * @returns A function to remove the listener.
167
+ */
168
+ on<K extends keyof Events>(event: K, listener: (data: Events[K]) => void): () => void;
169
+ /**
170
+ * Emits an event with the specified data.
171
+ * @param event - The event name.
172
+ * @param data - The data to pass to listeners.
173
+ */
174
+ emit<K extends keyof Events>(event: K, data: Events[K]): void;
175
+ }
176
+ //#endregion
177
+ //#region src/storage/common.d.ts
178
+ interface IStorage<T extends Record<string, unknown> = Record<string, unknown>, Key extends keyof T = keyof T> {
179
+ get(key: Key): T[Key] | undefined;
180
+ set(key: Key, value?: T[Key]): void;
181
+ delete(key: Key): void;
182
+ }
183
+ declare abstract class BaseStorage<T extends Record<string, unknown> = Record<string, unknown>, Key extends keyof T = keyof T> implements IStorage<T> {
184
+ abstract get(key: Key): T[Key] | undefined;
185
+ abstract set(key: Key, value?: T[Key]): void;
186
+ abstract delete(key: Key): void;
187
+ }
188
+ declare class MemoryStorage<T extends Record<string, unknown> = Record<string, unknown>, Key extends keyof T = keyof T> extends BaseStorage<T> {
189
+ private readonly data;
190
+ get(key: Key): T[Key] | undefined;
191
+ set(key: Key, value?: T[Key]): void;
192
+ delete(key: Key): void;
193
+ }
194
+ //#endregion
195
+ //#region src/types.d.ts
196
+ interface EcdsaSignature {
197
+ r: string;
198
+ s: string;
199
+ recoveryParam?: number;
200
+ }
201
+ type Signer = (data: string | Uint8Array) => Promise<EcdsaSignature | string>;
202
+ interface JWTPayload {
203
+ iss?: string;
204
+ sub?: string;
205
+ aud?: string | string[];
206
+ iat?: number;
207
+ nbf?: number;
208
+ exp?: number;
209
+ rexp?: number;
210
+ [x: string]: any;
211
+ }
212
+ interface JWTVerifyPolicies {
213
+ now?: number;
214
+ nbf?: boolean;
215
+ iat?: boolean;
216
+ exp?: boolean;
217
+ aud?: boolean;
218
+ }
219
+ interface JWTVerified {
220
+ verified: true;
221
+ payload: Partial<JWTPayload>;
222
+ didResolutionResult: DIDResolutionResult;
223
+ issuer: string;
224
+ signer: VerificationMethod;
225
+ jwt: string;
226
+ policies?: JWTVerifyPolicies;
227
+ }
228
+ interface DIDResolutionResult {
229
+ "@context"?: "https://w3id.org/did-resolution/v1" | string | string[];
230
+ didResolutionMetadata: DIDResolutionMetadata;
231
+ didDocument: DIDDocument | null;
232
+ didDocumentMetadata: DIDDocumentMetadata;
233
+ }
234
+ interface DIDResolutionMetadata {
235
+ contentType?: string;
236
+ error?: "invalidDid" | "notFound" | "representationNotSupported" | "unsupportedDidMethod" | string;
237
+ [x: string]: any;
238
+ }
239
+ interface DIDDocumentMetadata {
240
+ created?: string;
241
+ updated?: string;
242
+ deactivated?: boolean;
243
+ versionId?: string;
244
+ nextUpdate?: string;
245
+ nextVersionId?: string;
246
+ equivalentId?: string;
247
+ canonicalId?: string;
248
+ [x: string]: any;
249
+ }
250
+ type KeyCapabilitySection = "authentication" | "assertionMethod" | "keyAgreement" | "capabilityInvocation" | "capabilityDelegation";
251
+ type DIDDocument = {
252
+ "@context"?: "https://www.w3.org/ns/did/v1" | string | string[];
253
+ id: string;
254
+ alsoKnownAs?: string[];
255
+ controller?: string | string[];
256
+ verificationMethod?: VerificationMethod[];
257
+ service?: Service[]; /** @deprecated */
258
+ publicKey?: VerificationMethod[];
259
+ } & { [x in KeyCapabilitySection]?: (string | VerificationMethod)[] };
260
+ interface Service {
261
+ id: string;
262
+ type: string;
263
+ serviceEndpoint: ServiceEndpoint | ServiceEndpoint[];
264
+ [x: string]: any;
265
+ }
266
+ type ServiceEndpoint = string | Record<string, any>;
267
+ interface JsonWebKey$1 {
268
+ alg?: string;
269
+ crv?: string;
270
+ e?: string;
271
+ ext?: boolean;
272
+ key_ops?: string[];
273
+ kid?: string;
274
+ kty: string;
275
+ n?: string;
276
+ use?: string;
277
+ x?: string;
278
+ y?: string;
279
+ [x: string]: any;
280
+ }
281
+ interface VerificationMethod {
282
+ id: string;
283
+ type: string;
284
+ controller: string;
285
+ publicKeyBase58?: string;
286
+ publicKeyBase64?: string;
287
+ publicKeyJwk?: JsonWebKey$1;
288
+ publicKeyHex?: string;
289
+ publicKeyMultibase?: string;
290
+ blockchainAccountId?: string;
291
+ ethereumAddress?: string;
292
+ conditionOr?: VerificationMethod[];
293
+ conditionAnd?: VerificationMethod[];
294
+ threshold?: number;
295
+ conditionThreshold?: VerificationMethod[];
296
+ conditionWeightedThreshold?: ConditionWeightedThreshold[];
297
+ conditionDelegated?: string;
298
+ relationshipParent?: string[];
299
+ relationshipChild?: string[];
300
+ relationshipSibling?: string[];
301
+ }
302
+ interface ConditionWeightedThreshold {
303
+ condition: VerificationMethod;
304
+ weight: number;
305
+ }
306
+ interface Issuer {
307
+ did: string;
308
+ signer: Signer;
309
+ alg?: string;
310
+ }
311
+ interface Proof {
312
+ type?: string;
313
+ [x: string]: any;
314
+ }
315
+ type Verifiable<T> = Readonly<T> & {
316
+ readonly proof: Proof;
317
+ };
318
+ interface CredentialStatus {
319
+ id: string;
320
+ type: string;
321
+ }
322
+ type W3CCredential = {
323
+ "@context": string[];
324
+ id?: string;
325
+ type: string[];
326
+ issuer: {
327
+ id: string;
328
+ [x: string]: any;
329
+ };
330
+ issuanceDate: string;
331
+ expirationDate?: string;
332
+ credentialSubject: {
333
+ id?: string;
334
+ [x: string]: any;
335
+ };
336
+ credentialStatus?: CredentialStatus;
337
+ evidence?: any;
338
+ termsOfUse?: any;
339
+ [x: string]: any;
340
+ };
341
+ type VerifiedJWT = JWTVerified;
342
+ type VerifiedCredential = VerifiedJWT & {
343
+ verifiableCredential: Verifiable<W3CCredential>;
344
+ };
345
+ type RenownProfile = {
346
+ documentId: string;
347
+ username: string | null;
348
+ ethAddress: string | null;
349
+ userImage: string | null;
350
+ createdAt: string;
351
+ updatedAt: string;
352
+ };
353
+ type InternalUser = User & {
354
+ did: string;
355
+ credential: PowerhouseVerifiableCredential | undefined;
356
+ profile?: RenownProfile;
357
+ };
358
+ type User$1 = InternalUser;
359
+ /**
360
+ * Strategy function for fetching user profile data.
361
+ * Called after successful authentication to enrich the user object.
362
+ * Should return the user's Renown profile, or undefined if not available.
363
+ * Must not throw — return undefined on failure.
364
+ */
365
+ type ProfileFetcher = (user: User$1, baseUrl: string) => Promise<RenownProfile | undefined>;
366
+ type Unsubscribe = () => void;
367
+ type LoginStatus = "initial" | "checking" | "authorized" | "not-authorized";
368
+ type RenownStorageMap = {
369
+ user: InternalUser | undefined;
370
+ };
371
+ type RenownStorage = IStorage<RenownStorageMap>;
372
+ type RenownEvents = {
373
+ user: User$1 | undefined;
374
+ status: LoginStatus;
375
+ };
376
+ type RenownEventEmitter = IEventEmitter<RenownEvents>;
377
+ interface IRenown extends Pick<RenownEventEmitter, "on"> {
378
+ readonly baseUrl: string;
379
+ readonly user: User$1 | undefined;
380
+ readonly status: LoginStatus;
381
+ login: (userDid: string) => Promise<User$1>;
382
+ logout: () => Promise<void>;
383
+ readonly crypto: IRenownCrypto;
384
+ readonly signer: ISigner$1;
385
+ readonly did: string;
386
+ readonly profileFetcher: ProfileFetcher | undefined;
387
+ verifyBearerToken: (token: string) => Promise<false | VerifiedCredential>;
388
+ getBearerToken: (options: CreateBearerTokenOptions, refresh?: boolean) => Promise<string>;
389
+ }
390
+ type IssuerType<T> = {
391
+ id: string;
392
+ } & T;
393
+ type CredentialSubjecType<T> = {
394
+ id?: string;
395
+ } & T;
396
+ interface CredentialSchema {
397
+ id: string;
398
+ type: string;
399
+ }
400
+ interface IVerifiableCredentialPayload<Subject, Issuer> {
401
+ "@context": string[];
402
+ id: string;
403
+ type: string[];
404
+ issuer: IssuerType<Issuer>;
405
+ issuanceDate: string;
406
+ expirationDate?: string;
407
+ credentialSubject: CredentialSubjecType<Subject>;
408
+ credentialStatus?: CredentialStatus;
409
+ credentialSchema: CredentialSchema;
410
+ }
411
+ interface IProof {
412
+ verificationMethod: string;
413
+ ethereumAddress: `0x${string}`;
414
+ created: string;
415
+ proofPurpose: string;
416
+ type: string;
417
+ proofValue: string;
418
+ eip712: {
419
+ domain: {
420
+ name: string;
421
+ version: string;
422
+ chainId: number;
423
+ verifyingContract: string;
424
+ };
425
+ types: typeof CREDENTIAL_TYPES;
426
+ primaryType: "VerifiableCredential";
427
+ };
428
+ }
429
+ interface IVerifiableCredential<Subject, Issuer> extends IVerifiableCredentialPayload<Subject, Issuer> {
430
+ proof: IProof;
431
+ }
432
+ interface IPowerhouseCredentialSubject {
433
+ id: string;
434
+ app: string;
435
+ name?: string;
436
+ }
437
+ interface IPowerhouseIssuerType {
438
+ ethereumAddress: `0x${string}`;
439
+ }
440
+ type PowerhouseVerifiableCredential = IVerifiableCredential<IPowerhouseCredentialSubject, IPowerhouseIssuerType>;
441
+ interface IAuthCredentialSubject {
442
+ chainId: number;
443
+ networkId: string;
444
+ address: string;
445
+ }
446
+ type AuthVerifiableCredential = IVerifiableCredential<IAuthCredentialSubject, {}>;
447
+ type AuthVerifiedCredential = VerifiedCredential & {
448
+ verifiableCredential: Verifiable<AuthVerifiableCredential>;
449
+ };
450
+ type PKHDid = {
451
+ networkId: string;
452
+ chainId: number;
453
+ address: `0x${string}`;
454
+ };
455
+ interface CreateBearerTokenOptions {
456
+ expiresIn?: number;
457
+ aud?: string;
458
+ }
459
+ //#endregion
460
+ //#region src/crypto/renown-crypto.d.ts
461
+ declare class RenownCrypto implements IRenownCrypto {
462
+ #private;
463
+ readonly did: DID;
464
+ static algorithm: EcKeyAlgorithm;
465
+ static signAlgorithm: {
466
+ name: string;
467
+ namedCurve: string;
468
+ hash: string;
469
+ };
470
+ constructor(keyPairStorage: JsonWebKeyPairStorage, crypto: SubtleCrypto, keyPair: CryptoKeyPair, did: DID);
471
+ get publicKey(): CryptoKey;
472
+ getBearerToken(address: string | undefined, options?: CreateBearerTokenOptions): Promise<string>;
473
+ removeDid(): Promise<void>;
474
+ sign(data: Uint8Array | string): Promise<Uint8Array>;
475
+ verify(data: Uint8Array, signature: Uint8Array): Promise<boolean>;
476
+ get issuer(): Issuer;
477
+ }
478
+ /**
479
+ * @deprecated Use RenownCrypto instead
480
+ */
481
+ declare class ConnectCrypto extends RenownCrypto {}
482
+ //#endregion
483
+ //#region src/crypto/renown-crypto-builder.d.ts
484
+ declare class RenownCryptoBuilder {
485
+ #private;
486
+ private keyPairStorage?;
487
+ private subtleCrypto?;
488
+ withKeyPairStorage(storage: JsonWebKeyPairStorage): this;
489
+ withSubtleCrypto(crypto: SubtleCrypto): this;
490
+ build(): Promise<RenownCrypto>;
491
+ }
492
+ //#endregion
493
+ //#region src/crypto/memory-key-storage.d.ts
494
+ declare class MemoryKeyStorage implements JsonWebKeyPairStorage {
495
+ private keyPair;
496
+ constructor(keyPair?: JwkKeyPair);
497
+ loadKeyPair(): Promise<JwkKeyPair | undefined>;
498
+ saveKeyPair(keyPair: JwkKeyPair): Promise<void>;
499
+ removeKeyPair(): Promise<void>;
500
+ }
501
+ //#endregion
502
+ //#region src/crypto/signer.d.ts
503
+ declare class RenownCryptoSigner implements ISigner {
504
+ private readonly crypto;
505
+ private readonly appName;
506
+ user?: UserActionSigner | undefined;
507
+ readonly app: AppActionSigner;
508
+ constructor(crypto: IRenownCrypto, appName: string, user?: UserActionSigner | undefined);
509
+ get publicKey(): CryptoKey;
510
+ sign(data: Uint8Array): Promise<Uint8Array>;
511
+ verify(data: Uint8Array, signature: Uint8Array): Promise<void>;
512
+ signAction(action: Action, abortSignal?: AbortSignal): Promise<Signature>;
513
+ /**
514
+ * Signs an action including a predicted resulting state hash.
515
+ *
516
+ * The resulting hash is packed into the signature tuple's 4th element (index 3)
517
+ * using the format: `${prevStateHash}:${resultingStateHash}`
518
+ *
519
+ * This allows offline verification of documents without reducer logic:
520
+ * - Verifier can check that the signature is valid for the claimed resulting state
521
+ * - Verifier can compare claimed resulting state to actual operation.hash
522
+ *
523
+ * @param action - The action to sign
524
+ * @param resultingStateHash - The predicted hash of document state AFTER this action runs
525
+ * @param abortSignal - Optional abort signal
526
+ * @returns A Signature tuple with the resulting hash encoded in element [3]
527
+ */
528
+ signActionWithResultingState(action: Action, resultingStateHash: string, abortSignal?: AbortSignal): Promise<Signature>;
529
+ /**
530
+ * Internal signing implementation shared by signAction and signActionWithResultingState.
531
+ */
532
+ private _signAction;
533
+ private hashAction;
534
+ private buildSignatureMessage;
535
+ private arrayBufferToHex;
536
+ private arrayBufferToBase64;
537
+ }
538
+ /**
539
+ * Creates a signature verification handler that verifies signatures using the Web Crypto API.
540
+ * The verification uses ECDSA with P-256 curve and SHA-256 hash, matching the RenownCrypto signing algorithm.
541
+ */
542
+ declare function createSignatureVerifier(requireSignature?: boolean): SignatureVerificationHandler;
543
+ /**
544
+ * Parses the hash field (element [3]) from a signature tuple.
545
+ *
546
+ * Supports two formats:
547
+ * - Old format: just `prevStateHash` (no colon)
548
+ * - New format: `prevStateHash:resultingStateHash` (colon-separated)
549
+ *
550
+ * @param hashField - The 4th element of a Signature tuple
551
+ * @returns Object with prevStateHash and optional resultingStateHash
552
+ */
553
+ declare function parseSignatureHashField(hashField: string): {
554
+ prevStateHash: string;
555
+ resultingStateHash: string | undefined;
556
+ };
557
+ /**
558
+ * Extracts the resulting state hash from a signature, if present.
559
+ *
560
+ * @param signature - A Signature tuple
561
+ * @returns The resulting state hash, or undefined if not present
562
+ */
563
+ declare function extractResultingHashFromSignature(signature: Signature): string | undefined;
564
+ /**
565
+ * Checks if a signature includes a resulting state hash.
566
+ *
567
+ * @param signature - A Signature tuple
568
+ * @returns true if the signature includes a resulting state hash
569
+ */
570
+ declare function signatureHasResultingHash(signature: Signature): boolean;
571
+ //#endregion
572
+ //#region src/common.d.ts
573
+ declare class RenownMemoryStorage extends MemoryStorage<RenownStorageMap> {}
574
+ declare class Renown implements IRenown {
575
+ #private;
576
+ constructor(store: RenownStorage, eventEmitter: RenownEventEmitter, crypto: IRenownCrypto, appName: string, baseUrl?: string, profileFetcher?: ProfileFetcher);
577
+ get baseUrl(): string;
578
+ get user(): InternalUser | undefined;
579
+ get status(): LoginStatus;
580
+ get signer(): ISigner$1;
581
+ get crypto(): IRenownCrypto;
582
+ get did(): `did:${string}`;
583
+ get profileFetcher(): ProfileFetcher | undefined;
584
+ login(userDid: string): Promise<User$1>;
585
+ logout(): Promise<void>;
586
+ on<K extends keyof RenownEvents>(event: K, listener: (data: RenownEvents[K]) => void): () => void;
587
+ verifyBearerToken(token: string): Promise<false | AuthVerifiedCredential>;
588
+ getBearerToken(options: CreateBearerTokenOptions): Promise<string>;
589
+ }
590
+ //#endregion
591
+ //#region src/renown-builder.d.ts
592
+ interface RenownBuilderOptions {
593
+ appName: string;
594
+ storage?: RenownStorage;
595
+ eventEmitter?: RenownEventEmitter;
596
+ crypto?: IRenownCrypto;
597
+ keyPairStorage?: JsonWebKeyPairStorage;
598
+ baseUrl?: string;
599
+ profileFetcher?: ProfileFetcher;
600
+ }
601
+ /**
602
+ * Base builder for creating Renown instances.
603
+ * Use platform-specific builders (RenownBuilder from init.browser.js or init.node.js)
604
+ * for pre-configured defaults.
605
+ */
606
+ declare class BaseRenownBuilder {
607
+ #private;
608
+ /**
609
+ * @param appName - Application name used for signing context
610
+ */
611
+ constructor(appName: string);
612
+ /**
613
+ * Set custom storage for user data persistence.
614
+ * Defaults to in-memory storage if not set.
615
+ */
616
+ withStorage(storage: RenownStorage): this;
617
+ /**
618
+ * Set custom event emitter for user state changes.
619
+ * Defaults to in-memory event emitter if not set.
620
+ */
621
+ withEventEmitter(eventEmitter: RenownEventEmitter): this;
622
+ /**
623
+ * Set a pre-built crypto instance.
624
+ * Either crypto or keyPairStorage must be provided.
625
+ */
626
+ withCrypto(crypto: IRenownCrypto): this;
627
+ /**
628
+ * Set key pair storage for cryptographic keys.
629
+ * A crypto instance will be built from this storage.
630
+ * Either crypto or keyPairStorage must be provided.
631
+ */
632
+ withKeyPairStorage(keyPairStorage: JsonWebKeyPairStorage): this;
633
+ /**
634
+ * Set the Renown server URL for credential verification.
635
+ * Defaults to https://www.renown.id
636
+ */
637
+ withBaseUrl(baseUrl: string): this;
638
+ /**
639
+ * Set a profile fetcher strategy for enriching user data after login.
640
+ * The fetcher receives the authenticated user and the base URL,
641
+ * and returns a RenownProfile. Called in the background after each login.
642
+ * Defaults to fetchRenownProfile which calls the Renown API.
643
+ */
644
+ withProfileFetcher(profileFetcher: ProfileFetcher): this;
645
+ /**
646
+ * Build and initialize the Renown instance.
647
+ * If a user is stored, attempts to re-authenticate them.
648
+ * @throws Error if neither crypto nor keyPairStorage is provided
649
+ */
650
+ build(): Promise<Renown>;
651
+ /**
652
+ * Create a BaseRenownBuilder from options object for a more concise API
653
+ */
654
+ static from(options: RenownBuilderOptions): BaseRenownBuilder;
655
+ }
656
+ //#endregion
657
+ //#region src/profile.d.ts
658
+ declare const fetchRenownProfile: ProfileFetcher;
659
+ //#endregion
660
+ //#region src/utils.d.ts
661
+ type ILogger = {
662
+ level: "verbose" | "debug" | "info" | "warn" | "error";
663
+ verbose: (message: string, ...replacements: any[]) => void;
664
+ debug: (message: string, ...replacements: any[]) => void;
665
+ info: (message: string, ...replacements: any[]) => void;
666
+ warn: (message: string, ...replacements: any[]) => void;
667
+ error: (message: string, ...replacements: any[]) => void;
668
+ };
669
+ /**
670
+ * Parse a DID:pkh string to extract network, chain ID, and address information
671
+ * @param did - The DID string in format "did:pkh:networkId:chainId:address"
672
+ * @returns Parsed DID information
673
+ * @throws Error if the DID format is invalid
674
+ */
675
+ declare function parsePkhDid(did: string): PKHDid;
676
+ interface VerifyAuthBearerTokenOptions {
677
+ /** Expected `aud` claim. Required when verifying tokens that include an
678
+ * audience claim — did-jwt rejects them otherwise with
679
+ * `invalid_config: JWT audience is required but your app address has not
680
+ * been configured`. Tokens minted without `aud` are unaffected. */
681
+ audience?: string;
682
+ }
683
+ declare function verifyAuthBearerToken(jwt: string, options?: VerifyAuthBearerTokenOptions): Promise<false | AuthVerifiedCredential>;
684
+ declare function assertIsAuthCredential(credential: VerifiedCredential): asserts credential is AuthVerifiedCredential;
685
+ declare function createAuthBearerToken(chainId: number, networkId: string, address: string, issuer: Issuer, options?: CreateBearerTokenOptions): Promise<string>;
686
+ declare const getResolver: () => Resolver;
687
+ //#endregion
688
+ export { RenownProfile as $, DIDResolutionResult as A, Issuer as B, AuthVerifiedCredential as C, DEFAULT_RENOWN_NETWORK_ID as Ct, DIDDocument as D, VERIFIABLE_CREDENTIAL_EIP712_TYPE as Dt, CredentialStatus as E, ISSUER_TYPE as Et, IProof as F, KeyCapabilitySection as G, JWTVerified as H, IRenown as I, PowerhouseVerifiableCredential as J, LoginStatus as K, ISigner$1 as L, IAuthCredentialSubject as M, IPowerhouseCredentialSubject as N, DIDDocumentMetadata as O, IPowerhouseIssuerType as P, RenownEvents as Q, IVerifiableCredential as R, AuthVerifiableCredential as S, DEFAULT_RENOWN_CHAIN_ID as St, CreateBearerTokenOptions as T, DOMAIN_TYPE as Tt, JWTVerifyPolicies as U, JWTPayload as V, JsonWebKey$1 as W, Proof as X, ProfileFetcher as Y, RenownEventEmitter as Z, signatureHasResultingHash as _, JsonWebKeyPairStorage as _t, getResolver as a, Unsubscribe as at, ConnectCrypto as b, CREDENTIAL_SUBJECT_TYPE as bt, fetchRenownProfile as c, VerificationMethod as ct, Renown as d, W3CCredential as dt, RenownStorage as et, RenownMemoryStorage as f, BaseStorage as ft, parseSignatureHashField as g, IRenownCrypto as gt, extractResultingHashFromSignature as h, IConnectCrypto as ht, createAuthBearerToken as i, Signer as it, EcdsaSignature as j, DIDResolutionMetadata as k, BaseRenownBuilder as l, VerifiedCredential as lt, createSignatureVerifier as m, DID as mt, VerifyAuthBearerTokenOptions as n, Service as nt, parsePkhDid as o, User$1 as ot, RenownCryptoSigner as p, IEventEmitter as pt, PKHDid as q, assertIsAuthCredential as r, ServiceEndpoint as rt, verifyAuthBearerToken as s, Verifiable as st, ILogger as t, RenownStorageMap as tt, RenownBuilderOptions as u, VerifiedJWT as ut, MemoryKeyStorage as v, JwkKeyPair as vt, ConditionWeightedThreshold as w, DEFAULT_RENOWN_URL as wt, RenownCrypto as x, CREDENTIAL_TYPES as xt, RenownCryptoBuilder as y, CREDENTIAL_SCHEMA_EIP712_TYPE as yt, InternalUser as z };
689
+ //# sourceMappingURL=utils-BGF8Qb5f.d.ts.map