@truto/truto-jsonata 1.0.39 → 1.0.40
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 +23 -0
- package/dist/browser/index.js +15440 -15
- package/dist/browser/index.js.map +84 -5
- package/dist/cjs/index.cjs +15440 -15
- package/dist/cjs/index.cjs.map +84 -5
- package/dist/esm/index.js +20 -1
- package/dist/esm/index.js.map +6 -5
- package/dist/functions/signJwt.d.ts +2 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -1008,6 +1008,29 @@ expression2.evaluate({ text: text2, algorithm: algorithm2, secret: secret2, outp
|
|
|
1008
1008
|
|
|
1009
1009
|
</details>
|
|
1010
1010
|
|
|
1011
|
+
<details>
|
|
1012
|
+
<summary>signJwt(payload, secretOrPrivateKey, options)</summary>
|
|
1013
|
+
|
|
1014
|
+
Generates a signed JWT using the jsonwebtoken library. Supports various algorithms via options.
|
|
1015
|
+
|
|
1016
|
+
**Example:**
|
|
1017
|
+
|
|
1018
|
+
```javascript
|
|
1019
|
+
import trutoJsonata from '@truto/truto-jsonata';
|
|
1020
|
+
|
|
1021
|
+
const payload = { sub: '1234567890', name: 'John Doe' };
|
|
1022
|
+
const secretOrPrivateKey = 'your-256-bit-secret';
|
|
1023
|
+
const options = { expiresIn: '1h', algorithm: 'HS256' };
|
|
1024
|
+
|
|
1025
|
+
const expression = trutoJsonata('$signJwt(payload, secretOrPrivateKey, options)');
|
|
1026
|
+
expression.evaluate({ payload, secretOrPrivateKey, options }).then(result => {
|
|
1027
|
+
console.log(result);
|
|
1028
|
+
// Output: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIn0.<signature>"
|
|
1029
|
+
});
|
|
1030
|
+
```
|
|
1031
|
+
|
|
1032
|
+
</details>
|
|
1033
|
+
|
|
1011
1034
|
<details>
|
|
1012
1035
|
<summary>xmlToJs(xml, options = { compact: true, spaces: 4 } )</summary>
|
|
1013
1036
|
|