@twin.org/web 0.0.1-next.60 → 0.0.1-next.63
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/dist/cjs/index.cjs +12 -0
- package/dist/esm/index.mjs +14 -2
- package/dist/types/utils/jwk.d.ts +6 -0
- package/docs/changelog.md +54 -0
- package/docs/reference/classes/Jwk.md +22 -0
- package/package.json +3 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -784,6 +784,18 @@ class Jwk {
|
|
|
784
784
|
privateKey
|
|
785
785
|
};
|
|
786
786
|
}
|
|
787
|
+
/**
|
|
788
|
+
* Generate a KID for the JWK.
|
|
789
|
+
* @param jwk The JWK to generate a KID for.
|
|
790
|
+
* @returns The KID.
|
|
791
|
+
*/
|
|
792
|
+
static async generateKid(jwk) {
|
|
793
|
+
core.Guards.object(Jwk._CLASS_NAME, "jwk", jwk);
|
|
794
|
+
const kidProps = core.ObjectHelper.pick(jwk, ["crv", "kty", "x"]);
|
|
795
|
+
const canonicalJson = core.JsonHelper.canonicalize(kidProps);
|
|
796
|
+
const hash = crypto.Sha256.sum256(core.Converter.utf8ToBytes(canonicalJson));
|
|
797
|
+
return core.Converter.bytesToBase64Url(hash);
|
|
798
|
+
}
|
|
787
799
|
}
|
|
788
800
|
|
|
789
801
|
// Copyright 2024 IOTA Stiftung.
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseError, StringHelper, Guards, Is, AsyncCache, ObjectHelper, GeneralError, Converter } from '@twin.org/core';
|
|
2
|
-
import { Ed25519 } from '@twin.org/crypto';
|
|
1
|
+
import { BaseError, StringHelper, Guards, Is, AsyncCache, ObjectHelper, GeneralError, Converter, JsonHelper } from '@twin.org/core';
|
|
2
|
+
import { Ed25519, Sha256 } from '@twin.org/crypto';
|
|
3
3
|
import { importJWK, CompactSign, flattenedVerify, SignJWT, jwtVerify } from 'jose';
|
|
4
4
|
|
|
5
5
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -782,6 +782,18 @@ class Jwk {
|
|
|
782
782
|
privateKey
|
|
783
783
|
};
|
|
784
784
|
}
|
|
785
|
+
/**
|
|
786
|
+
* Generate a KID for the JWK.
|
|
787
|
+
* @param jwk The JWK to generate a KID for.
|
|
788
|
+
* @returns The KID.
|
|
789
|
+
*/
|
|
790
|
+
static async generateKid(jwk) {
|
|
791
|
+
Guards.object(Jwk._CLASS_NAME, "jwk", jwk);
|
|
792
|
+
const kidProps = ObjectHelper.pick(jwk, ["crv", "kty", "x"]);
|
|
793
|
+
const canonicalJson = JsonHelper.canonicalize(kidProps);
|
|
794
|
+
const hash = Sha256.sum256(Converter.utf8ToBytes(canonicalJson));
|
|
795
|
+
return Converter.bytesToBase64Url(hash);
|
|
796
|
+
}
|
|
785
797
|
}
|
|
786
798
|
|
|
787
799
|
// Copyright 2024 IOTA Stiftung.
|
|
@@ -32,4 +32,10 @@ export declare class Jwk {
|
|
|
32
32
|
publicKey?: Uint8Array;
|
|
33
33
|
privateKey?: Uint8Array;
|
|
34
34
|
}>;
|
|
35
|
+
/**
|
|
36
|
+
* Generate a KID for the JWK.
|
|
37
|
+
* @param jwk The JWK to generate a KID for.
|
|
38
|
+
* @returns The KID.
|
|
39
|
+
*/
|
|
40
|
+
static generateKid(jwk: IJwk): Promise<string>;
|
|
35
41
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# @twin.org/web - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.1-next.63](https://github.com/twinfoundation/framework/compare/web-v0.0.1-next.62...web-v0.0.1-next.63) (2025-06-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add kid method to Jwk ([bc9239e](https://github.com/twinfoundation/framework/commit/bc9239ed9896a053d83e00ca221e962704ebc277))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/core bumped from 0.0.1-next.62 to 0.0.1-next.63
|
|
16
|
+
* @twin.org/crypto bumped from 0.0.1-next.62 to 0.0.1-next.63
|
|
17
|
+
|
|
18
|
+
## [0.0.1-next.62](https://github.com/twinfoundation/framework/compare/web-v0.0.1-next.61...web-v0.0.1-next.62) (2025-06-17)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* add guards arrayEndsWith and arrayStartsWith ([95d875e](https://github.com/twinfoundation/framework/commit/95d875ec8ccb4713c145fdde941d4cfedcec2ed3))
|
|
24
|
+
* add set method for async caches ([ba34b55](https://github.com/twinfoundation/framework/commit/ba34b55e651ad56ab8fc59e139e4af631c19cda0))
|
|
25
|
+
* ensure the alg is the correct one when generating JWK or JWS ([#136](https://github.com/twinfoundation/framework/issues/136)) ([46a5af1](https://github.com/twinfoundation/framework/commit/46a5af127192d7048068275d14f555f09add3642))
|
|
26
|
+
* propagate includeStackTrace on error conversion ([098fc72](https://github.com/twinfoundation/framework/commit/098fc729939ea3127f2bdcc0ddb6754096c5f919))
|
|
27
|
+
* use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* wrap inner error within FetchError / 2 ([#134](https://github.com/twinfoundation/framework/issues/134)) ([2ddb101](https://github.com/twinfoundation/framework/commit/2ddb101c3778be4e99559e37aa036cd7101585fb))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Dependencies
|
|
36
|
+
|
|
37
|
+
* The following workspace dependencies were updated
|
|
38
|
+
* dependencies
|
|
39
|
+
* @twin.org/core bumped from 0.0.1-next.61 to 0.0.1-next.62
|
|
40
|
+
* @twin.org/crypto bumped from 0.0.1-next.61 to 0.0.1-next.62
|
|
41
|
+
|
|
42
|
+
## [0.0.1-next.61](https://github.com/twinfoundation/framework/compare/web-v0.0.1-next.60...web-v0.0.1-next.61) (2025-06-17)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Miscellaneous Chores
|
|
46
|
+
|
|
47
|
+
* **web:** Synchronize repo versions
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
### Dependencies
|
|
51
|
+
|
|
52
|
+
* The following workspace dependencies were updated
|
|
53
|
+
* dependencies
|
|
54
|
+
* @twin.org/core bumped from 0.0.1-next.60 to 0.0.1-next.61
|
|
55
|
+
* @twin.org/crypto bumped from 0.0.1-next.60 to 0.0.1-next.61
|
|
56
|
+
|
|
3
57
|
## [0.0.1-next.60](https://github.com/twinfoundation/framework/compare/web-v0.0.1-next.59...web-v0.0.1-next.60) (2025-06-17)
|
|
4
58
|
|
|
5
59
|
|
|
@@ -105,3 +105,25 @@ The JWK to convert to raw.
|
|
|
105
105
|
`Promise`\<\{ `publicKey?`: `Uint8Array`\<`ArrayBufferLike`\>; `privateKey?`: `Uint8Array`\<`ArrayBufferLike`\>; \}\>
|
|
106
106
|
|
|
107
107
|
The crypto key.
|
|
108
|
+
|
|
109
|
+
***
|
|
110
|
+
|
|
111
|
+
### generateKid()
|
|
112
|
+
|
|
113
|
+
> `static` **generateKid**(`jwk`): `Promise`\<`string`\>
|
|
114
|
+
|
|
115
|
+
Generate a KID for the JWK.
|
|
116
|
+
|
|
117
|
+
#### Parameters
|
|
118
|
+
|
|
119
|
+
##### jwk
|
|
120
|
+
|
|
121
|
+
[`IJwk`](../interfaces/IJwk.md)
|
|
122
|
+
|
|
123
|
+
The JWK to generate a KID for.
|
|
124
|
+
|
|
125
|
+
#### Returns
|
|
126
|
+
|
|
127
|
+
`Promise`\<`string`\>
|
|
128
|
+
|
|
129
|
+
The KID.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/web",
|
|
3
|
-
"version": "0.0.1-next.
|
|
3
|
+
"version": "0.0.1-next.63",
|
|
4
4
|
"description": "Contains classes for use with web operations",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@twin.org/core": "0.0.1-next.
|
|
18
|
-
"@twin.org/crypto": "0.0.1-next.
|
|
17
|
+
"@twin.org/core": "0.0.1-next.63",
|
|
18
|
+
"@twin.org/crypto": "0.0.1-next.63",
|
|
19
19
|
"@twin.org/nameof": "next",
|
|
20
20
|
"jose": "6.0.11"
|
|
21
21
|
},
|