ox 0.14.10 → 0.14.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.
- package/CHANGELOG.md +14 -0
- package/_cjs/erc8021/Attribution.js +7 -1
- package/_cjs/erc8021/Attribution.js.map +1 -1
- package/_cjs/tempo/KeyAuthorization.js +141 -21
- package/_cjs/tempo/KeyAuthorization.js.map +1 -1
- package/_cjs/tempo/Period.js +31 -0
- package/_cjs/tempo/Period.js.map +1 -0
- package/_cjs/tempo/index.js +2 -1
- package/_cjs/tempo/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_cjs/webauthn/Credential.js +6 -0
- package/_cjs/webauthn/Credential.js.map +1 -1
- package/_esm/erc8021/Attribution.js +7 -1
- package/_esm/erc8021/Attribution.js.map +1 -1
- package/_esm/tempo/KeyAuthorization.js +150 -22
- package/_esm/tempo/KeyAuthorization.js.map +1 -1
- package/_esm/tempo/Period.js +92 -0
- package/_esm/tempo/Period.js.map +1 -0
- package/_esm/tempo/index.js +29 -0
- package/_esm/tempo/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_esm/webauthn/Credential.js +9 -0
- package/_esm/webauthn/Credential.js.map +1 -1
- package/_types/erc8021/Attribution.d.ts +2 -0
- package/_types/erc8021/Attribution.d.ts.map +1 -1
- package/_types/tempo/KeyAuthorization.d.ts +91 -19
- package/_types/tempo/KeyAuthorization.d.ts.map +1 -1
- package/_types/tempo/Period.d.ts +78 -0
- package/_types/tempo/Period.d.ts.map +1 -0
- package/_types/tempo/index.d.ts +29 -0
- package/_types/tempo/index.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/_types/webauthn/Credential.d.ts.map +1 -1
- package/erc8021/Attribution.ts +12 -1
- package/package.json +6 -1
- package/tempo/KeyAuthorization.test.ts +312 -3
- package/tempo/KeyAuthorization.ts +277 -51
- package/tempo/Period/package.json +6 -0
- package/tempo/Period.test.ts +44 -0
- package/tempo/Period.ts +97 -0
- package/tempo/e2e.test.ts +890 -1
- package/tempo/index.ts +30 -0
- package/version.ts +1 -1
- package/webauthn/Credential.ts +15 -0
package/tempo/index.ts
CHANGED
|
@@ -77,6 +77,36 @@ export * as AuthorizationTempo from './AuthorizationTempo.js'
|
|
|
77
77
|
*/
|
|
78
78
|
export * as KeyAuthorization from './KeyAuthorization.js'
|
|
79
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Utilities for constructing period durations (in seconds) for recurring spending limits.
|
|
82
|
+
*
|
|
83
|
+
* Periods define the reset interval for access key spending limits. A spending limit with a
|
|
84
|
+
* period will reset every `period` seconds. For example, a daily spending limit uses
|
|
85
|
+
* `Period.days(1)` (86400 seconds).
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts twoslash
|
|
89
|
+
* import { Value } from 'ox'
|
|
90
|
+
* import { KeyAuthorization, Period } from 'ox/tempo'
|
|
91
|
+
*
|
|
92
|
+
* const authorization = KeyAuthorization.from({
|
|
93
|
+
* address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
|
|
94
|
+
* chainId: 4217n,
|
|
95
|
+
* type: 'secp256k1',
|
|
96
|
+
* limits: [{
|
|
97
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
98
|
+
* limit: Value.from('100', 6),
|
|
99
|
+
* period: Period.days(1), // resets daily
|
|
100
|
+
* }],
|
|
101
|
+
* })
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* [Access Keys Specification](https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction#access-keys)
|
|
105
|
+
*
|
|
106
|
+
* @category Reference
|
|
107
|
+
*/
|
|
108
|
+
export * as Period from './Period.js'
|
|
109
|
+
|
|
80
110
|
/**
|
|
81
111
|
* Pool ID utilities for computing pool identifiers from token pairs.
|
|
82
112
|
*
|
package/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @internal */
|
|
2
|
-
export const version = '0.14.
|
|
2
|
+
export const version = '0.14.12'
|
package/webauthn/Credential.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Base64 from '../core/Base64.js'
|
|
2
|
+
import * as Cbor from '../core/Cbor.js'
|
|
2
3
|
import type * as Errors from '../core/Errors.js'
|
|
3
4
|
import type * as Hex from '../core/Hex.js'
|
|
4
5
|
import type { Compute } from '../core/internal/types.js'
|
|
@@ -68,6 +69,20 @@ export function serialize(credential: Credential): Credential<true> {
|
|
|
68
69
|
response[key] = Base64.fromBytes(new Uint8Array(value), base64UrlOptions)
|
|
69
70
|
}
|
|
70
71
|
|
|
72
|
+
// Some browsers/passkey providers (e.g. Firefox + 1Password) don't expose
|
|
73
|
+
// `authenticatorData` on the response object. Fall back to extracting it
|
|
74
|
+
// from the CBOR-encoded `attestationObject` which always contains `authData`.
|
|
75
|
+
if (!response.authenticatorData) {
|
|
76
|
+
const attestation = Cbor.decode<{ authData: Uint8Array }>(
|
|
77
|
+
new Uint8Array(attestationObject),
|
|
78
|
+
)
|
|
79
|
+
if (attestation.authData)
|
|
80
|
+
response.authenticatorData = Base64.fromBytes(
|
|
81
|
+
attestation.authData,
|
|
82
|
+
base64UrlOptions,
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
71
86
|
return {
|
|
72
87
|
attestationObject: Base64.fromBytes(
|
|
73
88
|
new Uint8Array(attestationObject),
|