@metamask/delegation-core 0.4.0 → 1.1.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/CHANGELOG.md +15 -1
- package/README.md +8 -8
- package/dist/index.cjs +525 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +118 -62
- package/dist/index.d.ts +118 -62
- package/dist/index.mjs +529 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.1.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `Caveat` terms decoding utils ([#191](https://github.com/metamask/smart-accounts-kit/pull/191))
|
|
15
|
+
|
|
16
|
+
## [1.0.0]
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Bumped from `0.4.0` to `1.0.0` ([#194](https://github.com/metamask/smart-accounts-kit/pull/194))
|
|
21
|
+
|
|
10
22
|
## [0.4.0]
|
|
11
23
|
|
|
12
24
|
### Added
|
|
@@ -78,7 +90,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
78
90
|
|
|
79
91
|
- Add @metamask/delegation-core package, providing utility types, delegation hashing, and terms encoding for a limited set of caveat enforcers.
|
|
80
92
|
|
|
81
|
-
[Unreleased]: https://github.com/metamask/smart-accounts-kit/compare/@metamask/delegation-core@
|
|
93
|
+
[Unreleased]: https://github.com/metamask/smart-accounts-kit/compare/@metamask/delegation-core@1.1.0...HEAD
|
|
94
|
+
[1.1.0]: https://github.com/metamask/smart-accounts-kit/compare/@metamask/delegation-core@1.0.0...@metamask/delegation-core@1.1.0
|
|
95
|
+
[1.0.0]: https://github.com/metamask/smart-accounts-kit/compare/@metamask/delegation-core@0.4.0...@metamask/delegation-core@1.0.0
|
|
82
96
|
[0.4.0]: https://github.com/metamask/smart-accounts-kit/compare/@metamask/delegation-core@0.3.0...@metamask/delegation-core@0.4.0
|
|
83
97
|
[0.3.0]: https://github.com/metamask/smart-accounts-kit/compare/@metamask/delegation-core@0.2.0...@metamask/delegation-core@0.3.0
|
|
84
98
|
[0.2.0]: https://github.com/metamask/smart-accounts-kit/compare/@metamask/delegation-core@0.2.0-rc.1...@metamask/delegation-core@0.2.0
|
package/README.md
CHANGED
|
@@ -67,8 +67,8 @@ Creates terms for a Timestamp caveat that enforces time-based constraints on del
|
|
|
67
67
|
**Parameters:**
|
|
68
68
|
|
|
69
69
|
- `terms: TimestampTerms`
|
|
70
|
-
- `
|
|
71
|
-
- `
|
|
70
|
+
- `afterThreshold: number` - Timestamp (seconds) after which delegation can be used
|
|
71
|
+
- `beforeThreshold: number` - Timestamp (seconds) before which delegation can be used
|
|
72
72
|
- `options?: EncodingOptions` - Optional encoding options
|
|
73
73
|
|
|
74
74
|
**Returns:** `Hex | Uint8Array` - 32-byte encoded terms (16 bytes per timestamp)
|
|
@@ -80,14 +80,14 @@ import { createTimestampTerms } from '@metamask/delegation-core';
|
|
|
80
80
|
|
|
81
81
|
// Valid between Jan 1, 2022 and Jan 1, 2023
|
|
82
82
|
const terms = createTimestampTerms({
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
afterThreshold: 1640995200, // 2022-01-01 00:00:00 UTC
|
|
84
|
+
beforeThreshold: 1672531200, // 2023-01-01 00:00:00 UTC
|
|
85
85
|
});
|
|
86
86
|
|
|
87
87
|
// Only valid after a certain time (no end time)
|
|
88
88
|
const openEndedTerms = createTimestampTerms({
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
afterThreshold: 1640995200,
|
|
90
|
+
beforeThreshold: 0,
|
|
91
91
|
});
|
|
92
92
|
```
|
|
93
93
|
|
|
@@ -354,8 +354,8 @@ export type ValueLteTerms = {
|
|
|
354
354
|
};
|
|
355
355
|
|
|
356
356
|
export type TimestampTerms = {
|
|
357
|
-
|
|
358
|
-
|
|
357
|
+
afterThreshold: number;
|
|
358
|
+
beforeThreshold: number;
|
|
359
359
|
};
|
|
360
360
|
|
|
361
361
|
export type ExactCalldataTerms = {
|