@tidecloak/nextjs 0.9.12 → 0.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -49,6 +49,16 @@ This bundle provides:
|
|
|
49
49
|
* `doEncrypt()` / `doDecrypt()` — tag-based encryption/decryption
|
|
50
50
|
* `createTideCloakMiddleware()` — Edge middleware for route protection (supports both Pages & App routers)
|
|
51
51
|
|
|
52
|
+
> **Note:** Installing this package automatically adds a `silent-check-sso.html` file to your `public` directory. This file is required for silent SSO checks; if it doesn’t exist, create it manually at `public/silent-check-sso.html` with the following content, otherwise the app will break:
|
|
53
|
+
>
|
|
54
|
+
> ```html
|
|
55
|
+
> <html>
|
|
56
|
+
> <body>
|
|
57
|
+
> <script>parent.postMessage(location.href, location.origin)</script>
|
|
58
|
+
> </body>
|
|
59
|
+
> </html>
|
|
60
|
+
> ```
|
|
61
|
+
|
|
52
62
|
---
|
|
53
63
|
|
|
54
64
|
## 3. Initialize the Provider
|
|
@@ -111,7 +121,7 @@ export default MyApp;
|
|
|
111
121
|
|
|
112
122
|
## 4. Redirect URI Handling
|
|
113
123
|
|
|
114
|
-
TideCloak supports an optional `
|
|
124
|
+
TideCloak supports an optional `redirectUri` parameter. This is the URL users are sent to after login or logout.
|
|
115
125
|
|
|
116
126
|
If omitted, it defaults to:
|
|
117
127
|
|
|
@@ -121,14 +131,14 @@ If omitted, it defaults to:
|
|
|
121
131
|
|
|
122
132
|
> If your app runs at `http://localhost:3000`, then by default users will be redirected to `http://localhost:3000/auth/redirect` after login or logout.
|
|
123
133
|
>
|
|
124
|
-
> If that route doesn't exist in your project, you must create it or explicitly define a different `
|
|
134
|
+
> If that route doesn't exist in your project, you must create it or explicitly define a different `redirectUri` in your TideCloak config.
|
|
125
135
|
|
|
126
136
|
If you use the default, you **must create a page** at `/auth/redirect` in your app.
|
|
127
137
|
|
|
128
138
|
You can customize this URI in your provider config:
|
|
129
139
|
|
|
130
140
|
```tsx
|
|
131
|
-
<TideCloakProvider config={{ ...adapter,
|
|
141
|
+
<TideCloakProvider config={{ ...adapter, redirectUri: 'https://yourapp.com/auth/callback' }}>
|
|
132
142
|
{children}
|
|
133
143
|
</TideCloakProvider>
|
|
134
144
|
```
|
|
@@ -283,8 +293,46 @@ const decryptedArray = await doDecrypt([
|
|
|
283
293
|
]);
|
|
284
294
|
```
|
|
285
295
|
|
|
286
|
-
|
|
287
|
-
|
|
296
|
+
> **Important:** The `data` property **must** be either a string or a `Uint8Array` (raw bytes).\
|
|
297
|
+
> When you encrypt a string, decryption returns a string.\
|
|
298
|
+
> When you encrypt a `Uint8Array`, decryption returns a `Uint8Array`.
|
|
299
|
+
|
|
300
|
+
### Valid example:
|
|
301
|
+
>
|
|
302
|
+
> ```ts
|
|
303
|
+
> // Before testing below, ensure you've set up the necessary roles:
|
|
304
|
+
> const multi_encrypted_addresses = await doEncrypt([
|
|
305
|
+
> {
|
|
306
|
+
> data: "10 Smith Street",
|
|
307
|
+
> tags: ["street"]
|
|
308
|
+
> },
|
|
309
|
+
> {
|
|
310
|
+
> data: "Southport",
|
|
311
|
+
> tags: ["suburb"]
|
|
312
|
+
> },
|
|
313
|
+
> {
|
|
314
|
+
> data: "20 James Street - Burleigh Heads",
|
|
315
|
+
> tags: ["street", "suburb"]
|
|
316
|
+
> }
|
|
317
|
+
> ]);
|
|
318
|
+
> ```
|
|
319
|
+
>
|
|
320
|
+
|
|
321
|
+
### Invalid (will fail):
|
|
322
|
+
>
|
|
323
|
+
> ```ts
|
|
324
|
+
> // Prepare data for encryption
|
|
325
|
+
> const dataToEncrypt = {
|
|
326
|
+
> title: noteData.title,
|
|
327
|
+
> content: noteData.content
|
|
328
|
+
> };
|
|
329
|
+
>
|
|
330
|
+
> // Encrypt the note data using TideCloak (this will error)
|
|
331
|
+
> const encryptedArray = await doEncrypt([{ data: dataToEncrypt, tags: ['note'] }]);
|
|
332
|
+
> ```
|
|
333
|
+
|
|
334
|
+
* **Permissions:** Encryption requires `_tide_<tag>.selfencrypt`; decryption requires `_tide_<tag>.selfdecrypt`.
|
|
335
|
+
* **Order guarantee:** Output preserves input order.
|
|
288
336
|
|
|
289
337
|
---
|
|
290
338
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,eAAe,EACf,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,aAAa,EACb,eAAe,EACf,wBAAwB,EAGzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,eAAe,EACf,wBAAwB,EACzB,CAAC;AACF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tidecloakMiddleware.d.ts","sourceRoot":"","sources":["../../../src/server/tidecloakMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAEvD,OAAO,EAGL,YAAY,EACZ,kBAAkB,EACnB,MAAM,iBAAiB,CAAA;AAExB,UAAU,GAAG;IACT,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,OAAO,CAAC;IACzB,mBAAmB,EAAE,MAAM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GAAG,IAAI,CAAA;IACpF,wDAAwD;IACxD,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,KAAK,YAAY,CAAA;CACvD;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,qBAAqB,SAO7B,WAAW,oCAyDlD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tidecloak/nextjs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.5",
|
|
4
4
|
"description": "TideCloak nextjs SDK",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"prepare": "npm run build"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@tidecloak/react": "^0.
|
|
52
|
-
"@tidecloak/verify": "^0.
|
|
51
|
+
"@tidecloak/react": "^0.11.5",
|
|
52
|
+
"@tidecloak/verify": "^0.11.5"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@types/react": "^19.1.8",
|