@twin.org/web 0.0.2-next.11 → 0.0.2-next.12

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.
@@ -752,14 +752,15 @@ class Jwk {
752
752
  /**
753
753
  * Convert the Ed25519 private key to a crypto key.
754
754
  * @param privateKey The private key to use.
755
+ * @param overrideUse Optional override for the use property, defaults to "sig".
755
756
  * @returns The crypto key.
756
757
  */
757
- static async fromEd25519Private(privateKey) {
758
+ static async fromEd25519Private(privateKey, overrideUse) {
758
759
  core.Guards.uint8Array(Jwk._CLASS_NAME, "privateKey", privateKey);
759
760
  const publicKey = crypto.Ed25519.publicKeyFromPrivateKey(privateKey);
760
761
  const jwk = {
761
762
  kty: "OKP",
762
- use: "enc",
763
+ use: overrideUse ?? "sig",
763
764
  alg: "EdDSA",
764
765
  crv: "Ed25519",
765
766
  x: core.Converter.bytesToBase64Url(publicKey),
@@ -770,13 +771,14 @@ class Jwk {
770
771
  /**
771
772
  * Convert the Ed25519 public key to a crypto key.
772
773
  * @param publicKey The private key to use.
774
+ * @param overrideUse Optional override for the use property, defaults to "sig".
773
775
  * @returns The crypto key.
774
776
  */
775
- static async fromEd25519Public(publicKey) {
777
+ static async fromEd25519Public(publicKey, overrideUse) {
776
778
  core.Guards.uint8Array(Jwk._CLASS_NAME, "publicKey", publicKey);
777
779
  const jwk = {
778
780
  kty: "OKP",
779
- use: "sig",
781
+ use: overrideUse ?? "sig",
780
782
  alg: "EdDSA",
781
783
  crv: "Ed25519",
782
784
  x: core.Converter.bytesToBase64Url(publicKey)
@@ -750,14 +750,15 @@ class Jwk {
750
750
  /**
751
751
  * Convert the Ed25519 private key to a crypto key.
752
752
  * @param privateKey The private key to use.
753
+ * @param overrideUse Optional override for the use property, defaults to "sig".
753
754
  * @returns The crypto key.
754
755
  */
755
- static async fromEd25519Private(privateKey) {
756
+ static async fromEd25519Private(privateKey, overrideUse) {
756
757
  Guards.uint8Array(Jwk._CLASS_NAME, "privateKey", privateKey);
757
758
  const publicKey = Ed25519.publicKeyFromPrivateKey(privateKey);
758
759
  const jwk = {
759
760
  kty: "OKP",
760
- use: "enc",
761
+ use: overrideUse ?? "sig",
761
762
  alg: "EdDSA",
762
763
  crv: "Ed25519",
763
764
  x: Converter.bytesToBase64Url(publicKey),
@@ -768,13 +769,14 @@ class Jwk {
768
769
  /**
769
770
  * Convert the Ed25519 public key to a crypto key.
770
771
  * @param publicKey The private key to use.
772
+ * @param overrideUse Optional override for the use property, defaults to "sig".
771
773
  * @returns The crypto key.
772
774
  */
773
- static async fromEd25519Public(publicKey) {
775
+ static async fromEd25519Public(publicKey, overrideUse) {
774
776
  Guards.uint8Array(Jwk._CLASS_NAME, "publicKey", publicKey);
775
777
  const jwk = {
776
778
  kty: "OKP",
777
- use: "sig",
779
+ use: overrideUse ?? "sig",
778
780
  alg: "EdDSA",
779
781
  crv: "Ed25519",
780
782
  x: Converter.bytesToBase64Url(publicKey)
@@ -14,15 +14,17 @@ export declare class Jwk {
14
14
  /**
15
15
  * Convert the Ed25519 private key to a crypto key.
16
16
  * @param privateKey The private key to use.
17
+ * @param overrideUse Optional override for the use property, defaults to "sig".
17
18
  * @returns The crypto key.
18
19
  */
19
- static fromEd25519Private(privateKey: Uint8Array): Promise<IJwk>;
20
+ static fromEd25519Private(privateKey: Uint8Array, overrideUse?: "enc" | "sig" | string): Promise<IJwk>;
20
21
  /**
21
22
  * Convert the Ed25519 public key to a crypto key.
22
23
  * @param publicKey The private key to use.
24
+ * @param overrideUse Optional override for the use property, defaults to "sig".
23
25
  * @returns The crypto key.
24
26
  */
25
- static fromEd25519Public(publicKey: Uint8Array): Promise<IJwk>;
27
+ static fromEd25519Public(publicKey: Uint8Array, overrideUse?: "enc" | "sig" | string): Promise<IJwk>;
26
28
  /**
27
29
  * Convert the JWK to raw keys.
28
30
  * @param jwk The JWK to convert to raw.
package/docs/changelog.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @twin.org/web - Changelog
2
2
 
3
+ ## [0.0.2-next.12](https://github.com/twinfoundation/framework/compare/web-v0.0.2-next.11...web-v0.0.2-next.12) (2025-09-15)
4
+
5
+
6
+ ### Features
7
+
8
+ * add jwk enc property overrides ([18b6309](https://github.com/twinfoundation/framework/commit/18b63092a386b56ea7fcd7e12865ac6e1b47cc1e))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/core bumped from 0.0.2-next.11 to 0.0.2-next.12
16
+ * @twin.org/crypto bumped from 0.0.2-next.11 to 0.0.2-next.12
17
+ * @twin.org/nameof bumped from 0.0.2-next.11 to 0.0.2-next.12
18
+ * devDependencies
19
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.11 to 0.0.2-next.12
20
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.11 to 0.0.2-next.12
21
+
3
22
  ## [0.0.2-next.11](https://github.com/twinfoundation/framework/compare/web-v0.0.2-next.10...web-v0.0.2-next.11) (2025-09-15)
4
23
 
5
24
 
@@ -44,7 +44,7 @@ The crypto key.
44
44
 
45
45
  ### fromEd25519Private()
46
46
 
47
- > `static` **fromEd25519Private**(`privateKey`): `Promise`\<[`IJwk`](../interfaces/IJwk.md)\>
47
+ > `static` **fromEd25519Private**(`privateKey`, `overrideUse?`): `Promise`\<[`IJwk`](../interfaces/IJwk.md)\>
48
48
 
49
49
  Convert the Ed25519 private key to a crypto key.
50
50
 
@@ -56,6 +56,12 @@ Convert the Ed25519 private key to a crypto key.
56
56
 
57
57
  The private key to use.
58
58
 
59
+ ##### overrideUse?
60
+
61
+ `string`
62
+
63
+ Optional override for the use property, defaults to "sig".
64
+
59
65
  #### Returns
60
66
 
61
67
  `Promise`\<[`IJwk`](../interfaces/IJwk.md)\>
@@ -66,7 +72,7 @@ The crypto key.
66
72
 
67
73
  ### fromEd25519Public()
68
74
 
69
- > `static` **fromEd25519Public**(`publicKey`): `Promise`\<[`IJwk`](../interfaces/IJwk.md)\>
75
+ > `static` **fromEd25519Public**(`publicKey`, `overrideUse?`): `Promise`\<[`IJwk`](../interfaces/IJwk.md)\>
70
76
 
71
77
  Convert the Ed25519 public key to a crypto key.
72
78
 
@@ -78,6 +84,12 @@ Convert the Ed25519 public key to a crypto key.
78
84
 
79
85
  The private key to use.
80
86
 
87
+ ##### overrideUse?
88
+
89
+ `string`
90
+
91
+ Optional override for the use property, defaults to "sig".
92
+
81
93
  #### Returns
82
94
 
83
95
  `Promise`\<[`IJwk`](../interfaces/IJwk.md)\>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/web",
3
- "version": "0.0.2-next.11",
3
+ "version": "0.0.2-next.12",
4
4
  "description": "Contains classes for use with web operations",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,9 +14,9 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/core": "0.0.2-next.11",
18
- "@twin.org/crypto": "0.0.2-next.11",
19
- "@twin.org/nameof": "0.0.2-next.11",
17
+ "@twin.org/core": "0.0.2-next.12",
18
+ "@twin.org/crypto": "0.0.2-next.12",
19
+ "@twin.org/nameof": "0.0.2-next.12",
20
20
  "jose": "6.1.0"
21
21
  },
22
22
  "main": "./dist/cjs/index.cjs",