@welshare/react 0.2.3 → 0.4.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/LICENSE +1 -1
- package/README.md +85 -44
- package/dist/esm/components/connect-button.d.ts.map +1 -1
- package/dist/esm/components/connect-button.js +1 -4
- package/dist/esm/components/welshare-logo.d.ts +1 -1
- package/dist/esm/hooks/use-binary-uploads.d.ts +59 -0
- package/dist/esm/hooks/use-binary-uploads.d.ts.map +1 -0
- package/dist/esm/hooks/use-binary-uploads.js +93 -0
- package/dist/esm/hooks/use-welshare.d.ts.map +1 -1
- package/dist/esm/hooks/use-welshare.js +16 -8
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +8 -5
- package/dist/esm/lib/encryption.d.ts.map +1 -1
- package/dist/esm/lib/encryption.js +3 -13
- package/dist/esm/lib/uploads.d.ts.map +1 -1
- package/dist/esm/lib/uploads.js +1 -3
- package/dist/esm/types.d.ts +11 -0
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/.turbo/turbo-build.log +5 -0
- package/dist/node_modules/@welshare/react/.turbo/turbo-lint.log +14 -0
- package/dist/node_modules/@welshare/react/LICENSE +1 -1
- package/dist/node_modules/@welshare/react/README.md +85 -44
- package/dist/node_modules/@welshare/react/dist/esm/components/connect-button.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/dist/esm/components/connect-button.js +1 -4
- package/dist/node_modules/@welshare/react/dist/esm/components/welshare-logo.d.ts +1 -1
- package/dist/node_modules/@welshare/react/dist/esm/hooks/use-binary-uploads.d.ts +59 -0
- package/dist/node_modules/@welshare/react/dist/esm/hooks/use-binary-uploads.d.ts.map +1 -0
- package/dist/node_modules/@welshare/react/dist/esm/hooks/use-binary-uploads.js +93 -0
- package/dist/node_modules/@welshare/react/dist/esm/hooks/use-welshare.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/dist/esm/hooks/use-welshare.js +16 -8
- package/dist/node_modules/@welshare/react/dist/esm/index.d.ts +3 -1
- package/dist/node_modules/@welshare/react/dist/esm/index.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/dist/esm/index.js +8 -5
- package/dist/node_modules/@welshare/react/dist/esm/lib/encryption.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/dist/esm/lib/encryption.js +3 -13
- package/dist/node_modules/@welshare/react/dist/esm/lib/uploads.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/dist/esm/lib/uploads.js +1 -3
- package/dist/node_modules/@welshare/react/dist/esm/types.d.ts +11 -0
- package/dist/node_modules/@welshare/react/dist/esm/types.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/dist/esm/utils.d.ts.map +1 -1
- package/dist/node_modules/@welshare/react/eslint.config.mjs +2 -2
- package/dist/node_modules/@welshare/react/package.json +5 -2
- package/dist/node_modules/@welshare/react/src/components/connect-button.tsx +1 -4
- package/dist/node_modules/@welshare/react/src/components/welshare-logo.tsx +1 -1
- package/dist/node_modules/@welshare/react/src/hooks/use-binary-uploads.ts +181 -0
- package/dist/node_modules/@welshare/react/src/hooks/use-welshare.ts +24 -10
- package/dist/node_modules/@welshare/react/src/index.ts +22 -5
- package/dist/node_modules/@welshare/react/src/lib/encryption.ts +3 -13
- package/dist/node_modules/@welshare/react/src/lib/uploads.ts +2 -4
- package/dist/node_modules/@welshare/react/src/types.ts +21 -10
- package/dist/node_modules/@welshare/react/src/utils.ts +1 -5
- package/dist/node_modules/@welshare/react/tsconfig.json +3 -12
- package/package.json +5 -2
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright © 2025 Welshare Health UG (haftungsbeschränkt)
|
|
1
|
+
Copyright © 2025-2026 Welshare Health UG (haftungsbeschränkt)
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
### Disclaimer, notes on maturity
|
|
4
4
|
|
|
5
|
-
This library is in Alpha / demo state at this moment. We're using it to review the security aspects while data is in transfer and in rest. There's absolutely no guarantee or warrant that at this point any data is safe
|
|
5
|
+
This library is in Alpha / demo state at this moment. We're using it to review the security aspects while data is in transfer and in rest. There's absolutely no guarantee or warrant that at this point any data is safe, even though we're using resources that prioritize decentralization and resilience. Welshare Health wallets are controlled by cryptographic material which _can_ be stored in non custodial / MPC environments (Privy). While that's considered very safe, we can't guarantee at this point that we've already got each aspect of inter application communication or key derivation features right, so don't connect wallets that store significant value with the welshare wallet yet.
|
|
6
6
|
|
|
7
7
|
## Purpose
|
|
8
8
|
|
|
@@ -32,9 +32,10 @@ If you want to submit questionnaire data, your application must first register a
|
|
|
32
32
|
|
|
33
33
|
At the moment there are only two supported submission types: Fhir compatible QuestionnaireResponses and our custom "Reflex" app submissions. Both types are identified by schema uids that are accessible on the `Schemas` export.
|
|
34
34
|
|
|
35
|
-
```
|
|
35
|
+
```js
|
|
36
36
|
export const Schemas = {
|
|
37
|
-
QuestionnaireResponse: "b14b538f-7de3-4767-ad77-464d755d78bd"
|
|
37
|
+
QuestionnaireResponse: "b14b538f-7de3-4767-ad77-464d755d78bd",
|
|
38
|
+
BinaryFile: "9d696baf-483f-4cc0-b748-23a22c1705f5",
|
|
38
39
|
};
|
|
39
40
|
```
|
|
40
41
|
|
|
@@ -83,47 +84,93 @@ export function QuestionnaireForm() {
|
|
|
83
84
|
|
|
84
85
|
### Binary file uploads (e.g. images)
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
The package provides two ways to upload binary files:
|
|
88
|
+
|
|
89
|
+
1. **`useWelshare` hook** - Upload via the wallet dialog (external wallet flow)
|
|
90
|
+
2. **`useBinaryUploads` hook** - Upload directly with your own session keypair
|
|
91
|
+
|
|
92
|
+
Before data hits any server, the SDK encrypts all files with a new random symmetric AES (GCM / 256 bits) key. Users request a presigned upload url and post the encrypted file to an S3 compatible API that's currently operated by Welshare. Ultimately, they encrypt the encryption key for a Nillion _owned_ BinaryData collection and store it across Nillion nodes (no single node can recover the key). At the time of insertion, they currently also grant ACL read rights for the application (Technically, this is the welshare builder keypair at the moment).
|
|
93
|
+
|
|
94
|
+
#### Option 1: Upload via Wallet Dialog (`useWelshare`)
|
|
87
95
|
|
|
88
|
-
|
|
96
|
+
This works best for applications that **don't** manage their own keypairs. It delegates the heavy lifting to the welshare wallet dialog frame.
|
|
89
97
|
|
|
90
98
|
```ts
|
|
91
|
-
const
|
|
99
|
+
const { isConnected, openWallet, uploadFile, submitData } = useWelshare({
|
|
100
|
+
applicationId: process.env.NEXT_PUBLIC_WELSHARE_APP_ID || "",
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// Upload file (wallet dialog handles auth)
|
|
104
|
+
const { url: uploadedFileUrl, binaryFileUid } = await uploadFile(
|
|
105
|
+
userFile,
|
|
106
|
+
`questionnaire/${questionnaireId}/${linkId}`
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
// Use in QuestionnaireResponse
|
|
110
|
+
const responseItem = {
|
|
111
|
+
answer: [
|
|
112
|
+
{
|
|
113
|
+
valueAttachment: {
|
|
114
|
+
id: binaryFileUid,
|
|
115
|
+
contentType: userFile.type,
|
|
116
|
+
size: userFile.size,
|
|
117
|
+
title: userFile.name,
|
|
118
|
+
url: uploadedFileUrl,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
};
|
|
92
123
|
```
|
|
93
124
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
Before uploading, welshare encrypts all files with a new random symmetric AES (GCM / 256 bits) key. Users request a presigned upload url and post the encrypted file to an S3 compatible API of ours. Finally, they encrypt the encryption key on a user controlled Nillion *owned* collection for binary data and grant respective access rights for the application. The application a user used to upload the file is by default able to download the file again (Technically, that application is always welshare right now. This will change to the "builder" address of the respective app and the hpmp enclave keys, which allow AI access to the files)
|
|
125
|
+
#### Option 2: Direct Upload (`useBinaryUploads`)
|
|
97
126
|
|
|
98
|
-
|
|
127
|
+
For applications that manage storage keypairs directly:
|
|
99
128
|
|
|
100
129
|
```ts
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
130
|
+
import {
|
|
131
|
+
useBinaryUploads,
|
|
132
|
+
encryptAndUploadFile,
|
|
133
|
+
Schemas,
|
|
134
|
+
} from "@welshare/react";
|
|
135
|
+
import { WelshareApi } from "@welshare/sdk";
|
|
136
|
+
|
|
137
|
+
const { createUploadCredentials, downloadAndDecryptFile, isRunning, error } =
|
|
138
|
+
useBinaryUploads({
|
|
139
|
+
keypair: storageKeyPair, // storage keypairs are derived by users
|
|
140
|
+
environment: "production",
|
|
141
|
+
});
|
|
110
142
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
143
|
+
// Get presigned URL
|
|
144
|
+
const { presignedUrl, uploadKey } = await createUploadCredentials({
|
|
145
|
+
applicationId: "your-app-id",
|
|
146
|
+
reference: `questionnaire/${questionnaireId}/photo`,
|
|
147
|
+
fileName: file.name,
|
|
148
|
+
fileType: file.type,
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// Encrypt & upload to S3, then submit metadata to Nillion
|
|
152
|
+
const { encryptionKey } = await encryptAndUploadFile(file, presignedUrl);
|
|
153
|
+
await WelshareApi.submitBinaryData(
|
|
154
|
+
storageKeyPair,
|
|
155
|
+
{
|
|
156
|
+
encryption_key: JSON.stringify(encryptionKey),
|
|
157
|
+
reference: `questionnaire/${questionnaireId}/photo`,
|
|
158
|
+
file_name: file.name,
|
|
159
|
+
file_size: file.size,
|
|
160
|
+
file_type: file.type,
|
|
161
|
+
controller_did: storageKeyPair.toDidString(),
|
|
162
|
+
url: `welshare://${uploadKey}`,
|
|
163
|
+
},
|
|
164
|
+
"production",
|
|
165
|
+
applicationId
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
// Download and decrypt owned files
|
|
169
|
+
const decryptedFile = await downloadAndDecryptFile(documentId);
|
|
125
170
|
```
|
|
126
171
|
|
|
172
|
+
Binary files are addressed as `valueAttachment` items in FHIR. See https://www.hl7.org/fhir/questionnaireresponse.html
|
|
173
|
+
|
|
127
174
|
## API
|
|
128
175
|
|
|
129
176
|
### supported callbacks
|
|
@@ -143,21 +190,15 @@ those are configured in the `useWelshare` options parameter and called back duri
|
|
|
143
190
|
|
|
144
191
|
## Security Notes
|
|
145
192
|
|
|
146
|
-
No part of this application
|
|
147
|
-
|
|
148
|
-
The EVM addresses that control a user profile are (supposedly) never leaked to a third party.
|
|
149
|
-
|
|
150
|
-
The key derivation mechanism that creates new storage keys that users use to sign messages is not guaranteed to be 100% sound. At this moment it's used as a cryptographic authenticator, but the derivation mechanism will change in the future, rendering already existing keys obsolete. We're not guaranteeing that your key material stays trivially derivable.
|
|
193
|
+
No part of this application interacts with a "blockchain" (Nillion nodes are validated by a custom chain but that's relevant for end users' security or privacy).
|
|
151
194
|
|
|
152
|
-
|
|
195
|
+
The EVM addresses that control a user profile are never disclosed to third parties, hence they cannot correlate the wallet control keys with the keys that control the actual data.
|
|
153
196
|
|
|
154
|
-
|
|
197
|
+
The key derivation mechanism is used for creating self signed cryptographic authentication tokens, but the mechanism that keys are derived will very likely change in the future. Existing keys might render obsolete at that point which will require users to manually migrate their data. We don't guarantee that the current key derivation mechanism will be part of this SDK's exposed feature set forever. However, users will always be able to derive keys on their own, as long as they know the rules and don't lose the required secret inputs (e.g. signing keys or salts).
|
|
155
198
|
|
|
156
|
-
|
|
199
|
+
Data is stored on [nilDB (by Nillion)](https://docs.nillion.com/build/private-storage/quickstart), a protocol that enforces access control lists, encrypts data at rest and stores records redundantly. Plain data documents are not generally encrypted at this point in time, however. Binary uploads are end to end encrypted in the way that's described above.
|
|
157
200
|
|
|
158
|
-
|
|
159
|
-
- Tshy for build management
|
|
160
|
-
- Vitest for testing
|
|
201
|
+
All data that's sent to nilDB via _user client_ is exclusively controlled by the user's own key material. Welshare only delegates NUCs (access rights) to the users. Be aware that right now the welshare builder key _can_ read any data users upload. This will structurally improve once Nillion supports delegated reads for non builder grantees. Welshare's goal is to make user originated information available exclusively for code that runs in execution environments trusted by the users.
|
|
161
202
|
|
|
162
203
|
## License
|
|
163
204
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-button.d.ts","sourceRoot":"","sources":["../../../src/components/connect-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,qBAAqB,UAAW;IAC3C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,
|
|
1
|
+
{"version":3,"file":"connect-button.d.ts","sourceRoot":"","sources":["../../../src/components/connect-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,qBAAqB,UAAW;IAC3C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,4CA8FA,CAAC"}
|
|
@@ -55,8 +55,5 @@ export const ConnectWelshareButton = (props) => {
|
|
|
55
55
|
const handleBlur = (e) => {
|
|
56
56
|
e.currentTarget.style.boxShadow = "0 2px 6px rgba(1, 152, 255, 0.2)";
|
|
57
57
|
};
|
|
58
|
-
return (_jsx("button", { onClick: props.openWallet, style: buttonStyles, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseDown: handleMouseDown, onFocus: handleFocus, onBlur: handleBlur, type: "button", children: _jsx(_Fragment, { children: props.children || (_jsxs(_Fragment, { children: [_jsx("span", { className: "", children: _jsx(WelshareLogo, { width: 24, height: 18, style: {
|
|
59
|
-
"marginRight": "4px",
|
|
60
|
-
color: "#ffffff",
|
|
61
|
-
} }) }), _jsx("span", { children: "Connect Welshare Profile" })] })) }) }));
|
|
58
|
+
return (_jsx("button", { onClick: props.openWallet, style: buttonStyles, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onMouseDown: handleMouseDown, onFocus: handleFocus, onBlur: handleBlur, type: "button", children: _jsx(_Fragment, { children: props.children || (_jsxs(_Fragment, { children: [_jsx("span", { className: "", children: _jsx(WelshareLogo, { width: 24, height: 18, style: { marginRight: "4px", color: "#ffffff" } }) }), _jsx("span", { children: "Connect Welshare Profile" })] })) }) }));
|
|
62
59
|
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { RequestUploadCredentialsPayload, UploadCredentials } from "../types.js";
|
|
2
|
+
import { Nillion, type WelshareApiEnvironment, type WelshareEnvironmentName } from "@welshare/sdk";
|
|
3
|
+
export interface UseBinaryUploadsOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The user's session keypair for authentication.
|
|
6
|
+
*/
|
|
7
|
+
keypair: Nillion.Keypair | null | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* The Welshare environment to use for API calls.
|
|
10
|
+
*/
|
|
11
|
+
environment: WelshareApiEnvironment | WelshareEnvironmentName;
|
|
12
|
+
}
|
|
13
|
+
export interface UseBinaryUploadsResult {
|
|
14
|
+
/**
|
|
15
|
+
* Request upload credentials (presigned URL) for uploading an encrypted file.
|
|
16
|
+
*/
|
|
17
|
+
createUploadCredentials: (payload: RequestUploadCredentialsPayload) => Promise<UploadCredentials>;
|
|
18
|
+
/**
|
|
19
|
+
* Download and decrypt a file by its document ID.
|
|
20
|
+
* Only works for files owned by the current user.
|
|
21
|
+
*/
|
|
22
|
+
downloadAndDecryptFile: (documentId: string) => Promise<File | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Whether an operation is currently running.
|
|
25
|
+
*/
|
|
26
|
+
isRunning: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Error message if the last operation failed.
|
|
29
|
+
*/
|
|
30
|
+
error: string | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Hook for managing binary file uploads and downloads with Welshare.
|
|
34
|
+
*
|
|
35
|
+
* This hook provides functionality to:
|
|
36
|
+
* - Request presigned URLs for uploading encrypted files to S3
|
|
37
|
+
* - Download and decrypt files from Nillion storage
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* const { createUploadCredentials, downloadAndDecryptFile, isRunning, error } = useBinaryUploads({
|
|
42
|
+
* keypair: sessionKeyPair,
|
|
43
|
+
* environment: 'production',
|
|
44
|
+
* });
|
|
45
|
+
*
|
|
46
|
+
* // Upload flow: get credentials, encrypt, upload to S3, then submit metadata via submitBinaryData
|
|
47
|
+
* const credentials = await createUploadCredentials({
|
|
48
|
+
* applicationId: 'my-app',
|
|
49
|
+
* reference: 'user-photo',
|
|
50
|
+
* fileName: 'photo.jpg',
|
|
51
|
+
* fileType: 'image/jpeg',
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* // Download and decrypt
|
|
55
|
+
* const file = await downloadAndDecryptFile(documentId);
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare const useBinaryUploads: (options: UseBinaryUploadsOptions) => UseBinaryUploadsResult;
|
|
59
|
+
//# sourceMappingURL=use-binary-uploads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-binary-uploads.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-binary-uploads.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,+BAA+B,EAC/B,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,OAAO,EAGP,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IAC5C;;OAEG;IACH,WAAW,EAAE,sBAAsB,GAAG,uBAAuB,CAAC;CAC/D;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,uBAAuB,EAAE,CACvB,OAAO,EAAE,+BAA+B,KACrC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAEhC;;;OAGG;IACH,sBAAsB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IAC1E;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,gBAAgB,YAClB,uBAAuB,KAC/B,sBAuGF,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { decrypt } from "../lib/encryption.js";
|
|
3
|
+
import { WelshareApi, resolveEnvironment, } from "@welshare/sdk";
|
|
4
|
+
/**
|
|
5
|
+
* Hook for managing binary file uploads and downloads with Welshare.
|
|
6
|
+
*
|
|
7
|
+
* This hook provides functionality to:
|
|
8
|
+
* - Request presigned URLs for uploading encrypted files to S3
|
|
9
|
+
* - Download and decrypt files from Nillion storage
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const { createUploadCredentials, downloadAndDecryptFile, isRunning, error } = useBinaryUploads({
|
|
14
|
+
* keypair: sessionKeyPair,
|
|
15
|
+
* environment: 'production',
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* // Upload flow: get credentials, encrypt, upload to S3, then submit metadata via submitBinaryData
|
|
19
|
+
* const credentials = await createUploadCredentials({
|
|
20
|
+
* applicationId: 'my-app',
|
|
21
|
+
* reference: 'user-photo',
|
|
22
|
+
* fileName: 'photo.jpg',
|
|
23
|
+
* fileType: 'image/jpeg',
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Download and decrypt
|
|
27
|
+
* const file = await downloadAndDecryptFile(documentId);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export const useBinaryUploads = (options) => {
|
|
31
|
+
const [isRunning, setIsRunning] = useState(false);
|
|
32
|
+
const [error, setError] = useState(null);
|
|
33
|
+
const mountedRef = useRef(true);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
mountedRef.current = true;
|
|
36
|
+
return () => {
|
|
37
|
+
mountedRef.current = false;
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
const resolvedEnvironment = useMemo(() => resolveEnvironment(options.environment), [options.environment]);
|
|
41
|
+
const { keypair } = options;
|
|
42
|
+
const createUploadCredentials = useCallback(async (payload) => {
|
|
43
|
+
if (!keypair) {
|
|
44
|
+
throw new Error("No keypair available");
|
|
45
|
+
}
|
|
46
|
+
const { reference, fileName, fileType } = payload;
|
|
47
|
+
const { presignedUrl, uploadKey } = await WelshareApi.fetchS3WriteDelegation(keypair, { reference, fileName, fileType }, resolvedEnvironment);
|
|
48
|
+
return { presignedUrl, uploadKey };
|
|
49
|
+
}, [keypair, resolvedEnvironment]);
|
|
50
|
+
/**
|
|
51
|
+
* Downloads and decrypts a file by its document ID from Nillion.
|
|
52
|
+
*/
|
|
53
|
+
const downloadAndDecryptFile = useCallback(async (documentId) => {
|
|
54
|
+
if (!keypair) {
|
|
55
|
+
throw new Error("No keypair available");
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
setIsRunning(true);
|
|
59
|
+
setError(null);
|
|
60
|
+
const { binaryFile, data: downloadResponse } = await WelshareApi.fetchBinaryData(keypair, resolvedEnvironment, documentId);
|
|
61
|
+
const encodedEncryptionKey = JSON.parse(binaryFile.encryption_key);
|
|
62
|
+
const decryptedData = await decrypt(await downloadResponse, encodedEncryptionKey);
|
|
63
|
+
if (!decryptedData) {
|
|
64
|
+
throw new Error("Failed to decrypt file (received null)");
|
|
65
|
+
}
|
|
66
|
+
const decryptedFile = new File([decryptedData], binaryFile.file_name, {
|
|
67
|
+
type: binaryFile.file_type,
|
|
68
|
+
});
|
|
69
|
+
return decryptedFile;
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
console.error("Error during file download/decryption:", err);
|
|
73
|
+
const errorMessage = err instanceof Error
|
|
74
|
+
? err.message
|
|
75
|
+
: "Failed to download/decrypt file";
|
|
76
|
+
if (mountedRef.current) {
|
|
77
|
+
setError(errorMessage);
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
if (mountedRef.current) {
|
|
83
|
+
setIsRunning(false);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, [keypair, resolvedEnvironment]);
|
|
87
|
+
return {
|
|
88
|
+
createUploadCredentials,
|
|
89
|
+
downloadAndDecryptFile,
|
|
90
|
+
isRunning,
|
|
91
|
+
error,
|
|
92
|
+
};
|
|
93
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-welshare.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-welshare.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EACjB,kBAAkB,EAElB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"use-welshare.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-welshare.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EACjB,kBAAkB,EAElB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAQpB,eAAO,MAAM,WAAW,UAAW,yBAAyB;;;;;uBA8LlD,IAAI,aACC,MAAM,KAChB,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;iBAuC9B,CAAC,YACT,kBAAkB,cAChB,iBAAiB,CAAC,CAAC,CAAC;;;CAuEnC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getBaseUrl, WELSHARE_API_ENVIRONMENT, } from "@welshare/sdk/environment";
|
|
1
2
|
import { useEffect, useRef, useState } from "react";
|
|
2
3
|
import { encryptAndUploadFile } from "../lib/uploads.js";
|
|
3
4
|
export const useWelshare = (props) => {
|
|
@@ -9,11 +10,15 @@ export const useWelshare = (props) => {
|
|
|
9
10
|
const [uploadState, setUploadState] = useState();
|
|
10
11
|
// (claude opus) Use ref to control current upload in effect without triggering re-renders
|
|
11
12
|
const currentUploadRef = useRef(null);
|
|
13
|
+
// Resolve the base URL from environment or apiBaseUrl
|
|
14
|
+
const resolvedBaseUrl = props.environment
|
|
15
|
+
? getBaseUrl(props.environment)
|
|
16
|
+
: (props.apiBaseUrl ?? getBaseUrl(WELSHARE_API_ENVIRONMENT.production));
|
|
12
17
|
const options = {
|
|
13
|
-
apiBaseUrl: "https://wallet.welshare.app",
|
|
14
18
|
...props,
|
|
19
|
+
apiBaseUrl: resolvedBaseUrl,
|
|
15
20
|
};
|
|
16
|
-
const WELSHARE_WALLET_URL = `${
|
|
21
|
+
const WELSHARE_WALLET_URL = `${resolvedBaseUrl}/wallet-external`;
|
|
17
22
|
useEffect(() => {
|
|
18
23
|
const handleMessage = async (event) => {
|
|
19
24
|
// Verify origin for security
|
|
@@ -128,7 +133,13 @@ export const useWelshare = (props) => {
|
|
|
128
133
|
return () => {
|
|
129
134
|
window.removeEventListener("message", handleMessage);
|
|
130
135
|
};
|
|
131
|
-
}, [
|
|
136
|
+
}, [
|
|
137
|
+
WELSHARE_WALLET_URL,
|
|
138
|
+
dialogWindow,
|
|
139
|
+
messageIdCounter,
|
|
140
|
+
options.applicationId,
|
|
141
|
+
options.callbacks,
|
|
142
|
+
]);
|
|
132
143
|
/**
|
|
133
144
|
* Starts a file upload and returns a promise that resolves with the uploaded file URL
|
|
134
145
|
* @param file The file to upload
|
|
@@ -159,10 +170,7 @@ export const useWelshare = (props) => {
|
|
|
159
170
|
const message = {
|
|
160
171
|
type: "REQUEST_UPLOAD_CREDENTIALS",
|
|
161
172
|
id: String(messageIdCounter),
|
|
162
|
-
payload: {
|
|
163
|
-
...payload,
|
|
164
|
-
applicationId: options.applicationId,
|
|
165
|
-
},
|
|
173
|
+
payload: { ...payload, applicationId: options.applicationId },
|
|
166
174
|
};
|
|
167
175
|
dialogWindow.postMessage(message, WELSHARE_WALLET_URL);
|
|
168
176
|
setMessageIdCounter((prev) => prev + 1);
|
|
@@ -207,7 +215,7 @@ export const useWelshare = (props) => {
|
|
|
207
215
|
.filter(([_, value]) => value !== undefined && value !== null)
|
|
208
216
|
.map(([key, value]) => `social.${key}=${encodeURIComponent(String(value))}`);
|
|
209
217
|
if (socialEntries.length > 0) {
|
|
210
|
-
socialParams = `&${socialEntries.join(
|
|
218
|
+
socialParams = `&${socialEntries.join("&")}`;
|
|
211
219
|
}
|
|
212
220
|
}
|
|
213
221
|
const walletUrl = `${WELSHARE_WALLET_URL}?applicationId=${options.applicationId}${socialParams}`;
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { ConnectWelshareButton } from "./components/connect-button.js";
|
|
2
2
|
export { WelshareLogo } from "./components/welshare-logo.js";
|
|
3
3
|
export { useWelshare } from "./hooks/use-welshare.js";
|
|
4
|
-
export {
|
|
4
|
+
export { useBinaryUploads, type UseBinaryUploadsOptions, type UseBinaryUploadsResult, } from "./hooks/use-binary-uploads.js";
|
|
5
|
+
export { WELSHARE_API_ENVIRONMENT, resolveEnvironment, getBaseUrl, type WelshareApiEnvironment, type WelshareEnvironmentName, type NillionClusterConfig, } from "@welshare/sdk/environment";
|
|
6
|
+
export { decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey, } from "./lib/encryption.js";
|
|
5
7
|
export { decodeEncryptionKey, type EncryptionKey } from "./utils.js";
|
|
6
8
|
export { browserDownload, encryptAndUploadFile } from "./lib/uploads.js";
|
|
7
9
|
export declare const Schemas: {
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAG7D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,GAC5B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,UAAU,EACV,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,GAC1B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,WAAW,EACX,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAGzE,eAAO,MAAM,OAAO;;;;CAInB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
//
|
|
2
|
-
//import { QuestionnaireResponseSchema, ReflexSubmissionSchema } from "@welshare/sdk";
|
|
1
|
+
// ---- Components ----
|
|
3
2
|
export { ConnectWelshareButton } from "./components/connect-button.js";
|
|
4
3
|
export { WelshareLogo } from "./components/welshare-logo.js";
|
|
5
|
-
// ----
|
|
4
|
+
// ---- Hooks ----
|
|
6
5
|
export { useWelshare } from "./hooks/use-welshare.js";
|
|
7
|
-
export {
|
|
6
|
+
export { useBinaryUploads, } from "./hooks/use-binary-uploads.js";
|
|
7
|
+
// ---- Environment (re-exported from @welshare/sdk) ----
|
|
8
|
+
export { WELSHARE_API_ENVIRONMENT, resolveEnvironment, getBaseUrl, } from "@welshare/sdk/environment";
|
|
9
|
+
// ---- Utils ----
|
|
10
|
+
export { decrypt, encodeEncryptionKey, encryptFile, generateRandomAESKey, } from "./lib/encryption.js";
|
|
8
11
|
export { decodeEncryptionKey } from "./utils.js";
|
|
9
12
|
export { browserDownload, encryptAndUploadFile } from "./lib/uploads.js";
|
|
10
|
-
//todo: import them from the SDK
|
|
13
|
+
//todo: import them from the SDK
|
|
11
14
|
export const Schemas = {
|
|
12
15
|
QuestionnaireResponse: "b14b538f-7de3-4767-ad77-464d755d78bd", //QuestionnaireResponseSchema.schemaUid,
|
|
13
16
|
ReflexSubmission: "f5cf2d8a-1f78-4f21-b4bd-082e983b830c", //ReflexSubmissionSchema.schemaUid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../../src/lib/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAuB,MAAM,aAAa,CAAC;AAE5E,eAAO,MAAM,oBAAoB,QAAa,OAAO,CAAC,SAAS,CAU9D,CAAC;AAIF,eAAO,MAAM,WAAW,SAChB,IAAI,OACL,SAAS,KACb,OAAO,CAAC;IAAE,aAAa,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,UAAU,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../../src/lib/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAuB,MAAM,aAAa,CAAC;AAE5E,eAAO,MAAM,oBAAoB,QAAa,OAAO,CAAC,SAAS,CAU9D,CAAC;AAIF,eAAO,MAAM,WAAW,SAChB,IAAI,OACL,SAAS,KACb,OAAO,CAAC;IAAE,aAAa,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,UAAU,CAAA;CAAE,CAaxD,CAAC;AAEF,eAAO,MAAM,mBAAmB,QACzB,SAAS,MACV,UAAU,KACb,OAAO,CAAC,aAAa,CAYvB,CAAC;AAGF,eAAO,MAAM,OAAO,kBACH,WAAW,iBACX,aAAa,KAC3B,OAAO,CAAC,WAAW,GAAG,IAAI,CAuB5B,CAAC"}
|
|
@@ -15,10 +15,7 @@ export const encryptFile = async (file, key) => {
|
|
|
15
15
|
const fileData = await file.arrayBuffer();
|
|
16
16
|
const iv = window.crypto.getRandomValues(new Uint8Array(12));
|
|
17
17
|
// Encrypt the file data
|
|
18
|
-
const encryptedData = await window.crypto.subtle.encrypt({
|
|
19
|
-
name: ALGORITHM,
|
|
20
|
-
iv: iv,
|
|
21
|
-
}, key, fileData);
|
|
18
|
+
const encryptedData = await window.crypto.subtle.encrypt({ name: ALGORITHM, iv: iv }, key, fileData);
|
|
22
19
|
return { encryptedData, iv };
|
|
23
20
|
};
|
|
24
21
|
export const encodeEncryptionKey = async (key, iv) => {
|
|
@@ -30,21 +27,14 @@ export const encodeEncryptionKey = async (key, iv) => {
|
|
|
30
27
|
const ivHex = Array.from(iv)
|
|
31
28
|
.map((b) => b.toString(16).padStart(2, "0"))
|
|
32
29
|
.join("");
|
|
33
|
-
return {
|
|
34
|
-
algorithm: ALGORITHM,
|
|
35
|
-
key: keyHex,
|
|
36
|
-
iv: ivHex,
|
|
37
|
-
};
|
|
30
|
+
return { algorithm: ALGORITHM, key: keyHex, iv: ivHex };
|
|
38
31
|
};
|
|
39
32
|
// Helper function to decrypt a file using encoded encryption key
|
|
40
33
|
export const decrypt = async (encryptedData, encryptionKey) => {
|
|
41
34
|
try {
|
|
42
35
|
const { key: keyBytes, iv } = decodeEncryptionKey(encryptionKey);
|
|
43
36
|
const key = await window.crypto.subtle.importKey("raw", keyBytes, { name: ALGORITHM }, false, ["decrypt"]);
|
|
44
|
-
const decryptedData = await window.crypto.subtle.decrypt({
|
|
45
|
-
name: ALGORITHM,
|
|
46
|
-
iv: iv,
|
|
47
|
-
}, key, encryptedData);
|
|
37
|
+
const decryptedData = await window.crypto.subtle.decrypt({ name: ALGORITHM, iv: iv }, key, encryptedData);
|
|
48
38
|
return decryptedData;
|
|
49
39
|
}
|
|
50
40
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../../src/lib/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAO3C,eAAO,MAAM,oBAAoB,SACzB,IAAI,gBACI,MAAM,KACnB,OAAO,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"uploads.d.ts","sourceRoot":"","sources":["../../../src/lib/uploads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAO3C,eAAO,MAAM,oBAAoB,SACzB,IAAI,gBACI,MAAM,KACnB,OAAO,CAAC,aAAa,CAgBvB,CAAC;AAEF,eAAO,MAAM,eAAe,kBAAmB,IAAI,SASlD,CAAC"}
|
package/dist/esm/lib/uploads.js
CHANGED
|
@@ -6,9 +6,7 @@ export const encryptAndUploadFile = async (file, presignedUrl) => {
|
|
|
6
6
|
const uploadResponse = await fetch(presignedUrl, {
|
|
7
7
|
method: "PUT",
|
|
8
8
|
body: encryptedData,
|
|
9
|
-
headers: {
|
|
10
|
-
"Content-Type": file.type,
|
|
11
|
-
},
|
|
9
|
+
headers: { "Content-Type": file.type },
|
|
12
10
|
});
|
|
13
11
|
if (!uploadResponse.ok) {
|
|
14
12
|
throw new Error(`Failed to upload file ${uploadResponse.status}`);
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EncryptionKey } from "./utils.js";
|
|
2
|
+
import type { WelshareApiEnvironment, WelshareEnvironmentName } from "@welshare/sdk/environment";
|
|
2
3
|
export interface DialogMessage {
|
|
3
4
|
type: string;
|
|
4
5
|
payload?: any;
|
|
@@ -52,6 +53,16 @@ export interface WelshareConnectionOptions {
|
|
|
52
53
|
privy?: string;
|
|
53
54
|
twitter?: string;
|
|
54
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* The Welshare environment to connect to.
|
|
58
|
+
* Can be an environment name ('production', 'staging', etc.) or a full environment object.
|
|
59
|
+
* Takes precedence over apiBaseUrl if both are provided.
|
|
60
|
+
*/
|
|
61
|
+
environment?: WelshareApiEnvironment | WelshareEnvironmentName;
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated Use `environment` instead for type-safe configuration.
|
|
64
|
+
* The base URL of the Welshare API. Defaults to production.
|
|
65
|
+
*/
|
|
55
66
|
apiBaseUrl?: string;
|
|
56
67
|
callbacks: {
|
|
57
68
|
onFileUploaded?: (insertedUid: string, url: string) => void;
|
package/dist/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAExC,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,UAAU,EAAE,CAAC,CAAC;CACf;AAED,MAAM,MAAM,iBAAiB,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5E,MAAM,WAAW,+BAA+B;IAC9C,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,2BACf,SAAQ,+BAA+B;IACvC,aAAa,EAAE,aAAa,CAAC;IAE7B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAkB,SAAQ,+BAA+B;IACxE,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE;QACb,OAAO,EAAE,CAAC,MAAM,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,aAAa,EAAE,MAAM,CAAA;SAAE,KAAK,IAAI,CAAC;QAClE,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;KAChC,CAAC;CACH;AAED,MAAM,WAAW,2BAA4B,SAAQ,aAAa;IAChE,OAAO,EACH,iBAAiB,CAAC,OAAO,CAAC,GAC1B,2BAA2B,GAC3B,+BAA+B,CAAC;CACrC;AAED,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE;QACnB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF;;;;OAIG;IACH,WAAW,CAAC,EAAE,sBAAsB,GAAG,uBAAuB,CAAC;IAC/D;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE;QACT,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;QAC5D,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;QAC3D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QAClC,cAAc,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;QACjD,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;QAC7B,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;KAC5B,CAAC;CACH"}
|
package/dist/esm/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC;AAElC,MAAM,MAAM,aAAa,GAAG;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,YAAY,CAAC;AACnC,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC;AAElC,MAAM,MAAM,aAAa,GAAG;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E,eAAO,MAAM,mBAAmB,kBACf,aAAa,KAC3B;IAAE,GAAG,EAAE,YAAY,CAAC;IAAC,EAAE,EAAE,YAAY,CAAA;CAUvC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
> @welshare/react@0.3.0 lint /Users/stadolf/work/welshare/workspace/surveys-monorepo/packages/welshare-react
|
|
3
|
+
> eslint . --max-warnings 25
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/Users/stadolf/work/welshare/workspace/surveys-monorepo/packages/welshare-react/src/hooks/use-welshare.ts
|
|
7
|
+
110:11 warning Unexpected lexical declaration in case block no-case-declarations
|
|
8
|
+
290:19 warning '_' is defined but never used @typescript-eslint/no-unused-vars
|
|
9
|
+
|
|
10
|
+
/Users/stadolf/work/welshare/workspace/surveys-monorepo/packages/welshare-react/src/types.ts
|
|
11
|
+
9:13 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
12
|
+
|
|
13
|
+
✖ 3 problems (0 errors, 3 warnings)
|
|
14
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright © 2025 Welshare Health UG (haftungsbeschränkt)
|
|
1
|
+
Copyright © 2025-2026 Welshare Health UG (haftungsbeschränkt)
|
|
2
2
|
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
4
|
|