ox 1.1.2 → 1.3.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 +61 -0
- package/dist/core/AbiFunction.d.ts +1 -1
- package/dist/core/AbiFunction.d.ts.map +1 -1
- package/dist/core/AbiFunction.js +6 -2
- package/dist/core/AbiFunction.js.map +1 -1
- package/dist/core/AbiParameters.d.ts +1 -1
- package/dist/core/AbiParameters.d.ts.map +1 -1
- package/dist/core/AbiParameters.js +1 -13
- package/dist/core/AbiParameters.js.map +1 -1
- package/dist/core/AesGcm.d.ts +36 -1
- package/dist/core/AesGcm.d.ts.map +1 -1
- package/dist/core/AesGcm.js +44 -0
- package/dist/core/AesGcm.js.map +1 -1
- package/dist/core/Ed25519.d.ts +46 -1
- package/dist/core/Ed25519.d.ts.map +1 -1
- package/dist/core/Ed25519.js +43 -0
- package/dist/core/Ed25519.js.map +1 -1
- package/dist/core/Engine.d.ts +1 -1
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Hash.d.ts +200 -1
- package/dist/core/Hash.d.ts.map +1 -1
- package/dist/core/Hash.js +207 -0
- package/dist/core/Hash.js.map +1 -1
- package/dist/core/Hex.d.ts.map +1 -1
- package/dist/core/Hex.js +1 -4
- package/dist/core/Hex.js.map +1 -1
- package/dist/core/Rlp.d.ts +32 -0
- package/dist/core/Rlp.d.ts.map +1 -1
- package/dist/core/Rlp.js +146 -0
- package/dist/core/Rlp.js.map +1 -1
- package/dist/core/Secp256k1.d.ts +46 -1
- package/dist/core/Secp256k1.d.ts.map +1 -1
- package/dist/core/Secp256k1.js +48 -0
- package/dist/core/Secp256k1.js.map +1 -1
- package/dist/core/WebAuthn.d.ts +224 -0
- package/dist/core/WebAuthn.d.ts.map +1 -0
- package/dist/core/WebAuthn.js +343 -0
- package/dist/core/WebAuthn.js.map +1 -0
- package/dist/core/WebAuthnP256.d.ts +46 -50
- package/dist/core/WebAuthnP256.d.ts.map +1 -1
- package/dist/core/WebAuthnP256.js +44 -50
- package/dist/core/WebAuthnP256.js.map +1 -1
- package/dist/core/internal/abiParameters.d.ts +7 -87
- package/dist/core/internal/abiParameters.d.ts.map +1 -1
- package/dist/core/internal/abiParameters.js +339 -194
- package/dist/core/internal/abiParameters.js.map +1 -1
- package/dist/core/internal/engine.d.ts +35 -2
- package/dist/core/internal/engine.d.ts.map +1 -1
- package/dist/core/internal/engine.js +12 -1
- package/dist/core/internal/engine.js.map +1 -1
- package/dist/core/internal/hash.d.ts +10 -0
- package/dist/core/internal/hash.d.ts.map +1 -1
- package/dist/core/internal/hash.js +26 -1
- package/dist/core/internal/hash.js.map +1 -1
- package/dist/index.d.ts +23 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -14
- package/dist/index.js.map +1 -1
- package/dist/node/Engine.d.ts +1 -1
- package/dist/node/Engine.d.ts.map +1 -1
- package/dist/node/Engine.js.map +1 -1
- package/dist/node/Hash.d.ts +6 -4
- package/dist/node/Hash.d.ts.map +1 -1
- package/dist/node/Hash.js +35 -3
- package/dist/node/Hash.js.map +1 -1
- package/dist/tempo/AuthorizationTempo.d.ts +6 -6
- package/dist/tempo/AuthorizationTempo.js +6 -6
- package/dist/tempo/KeyAuthorization.d.ts +3 -8
- package/dist/tempo/KeyAuthorization.d.ts.map +1 -1
- package/dist/tempo/KeyAuthorization.js +3 -8
- package/dist/tempo/KeyAuthorization.js.map +1 -1
- package/dist/tempo/SignatureEnvelope.d.ts +8 -8
- package/dist/tempo/SignatureEnvelope.js +8 -8
- package/dist/trusted-setups/Paths.d.ts +1 -0
- package/dist/trusted-setups/Paths.d.ts.map +1 -1
- package/dist/trusted-setups/Paths.js +1 -0
- package/dist/trusted-setups/Paths.js.map +1 -1
- package/dist/trusted-setups/Setups.d.ts +35 -0
- package/dist/trusted-setups/Setups.d.ts.map +1 -0
- package/dist/trusted-setups/Setups.js +29 -0
- package/dist/trusted-setups/Setups.js.map +1 -0
- package/dist/trusted-setups/index.d.ts +20 -0
- package/dist/trusted-setups/index.d.ts.map +1 -1
- package/dist/trusted-setups/index.js +20 -0
- package/dist/trusted-setups/index.js.map +1 -1
- package/dist/trusted-setups/internal/paths.d.ts.map +1 -1
- package/dist/trusted-setups/internal/paths.js +1 -1
- package/dist/trusted-setups/internal/paths.js.map +1 -1
- package/dist/trusted-setups/internal/setups/mainnet.d.ts +7 -0
- package/dist/trusted-setups/internal/setups/mainnet.d.ts.map +1 -0
- package/dist/trusted-setups/internal/setups/mainnet.js +11 -0
- package/dist/trusted-setups/internal/setups/mainnet.js.map +1 -0
- package/dist/wasm/Engine.d.ts +4 -3
- package/dist/wasm/Engine.d.ts.map +1 -1
- package/dist/wasm/Engine.js +5 -5
- package/dist/wasm/Engine.js.map +1 -1
- package/dist/wasm/Hash.d.ts +1 -1
- package/dist/wasm/Hash.d.ts.map +1 -1
- package/dist/wasm/Hash.js +5 -0
- package/dist/wasm/Hash.js.map +1 -1
- package/dist/wasm/Keystore.d.ts +23 -9
- package/dist/wasm/Keystore.d.ts.map +1 -1
- package/dist/wasm/Keystore.js +30 -13
- package/dist/wasm/Keystore.js.map +1 -1
- package/dist/wasm/Kzg.d.ts +112 -0
- package/dist/wasm/Kzg.d.ts.map +1 -0
- package/dist/wasm/Kzg.js +333 -0
- package/dist/wasm/Kzg.js.map +1 -0
- package/dist/wasm/Secp256k1.d.ts +55 -0
- package/dist/wasm/Secp256k1.d.ts.map +1 -0
- package/dist/wasm/Secp256k1.js +181 -0
- package/dist/wasm/Secp256k1.js.map +1 -0
- package/dist/wasm/index.d.ts +44 -1
- package/dist/wasm/index.d.ts.map +1 -1
- package/dist/wasm/index.js +44 -1
- package/dist/wasm/index.js.map +1 -1
- package/dist/wasm/internal/blake3.d.ts +10 -1
- package/dist/wasm/internal/blake3.d.ts.map +1 -1
- package/dist/wasm/internal/blake3.js +12 -1
- package/dist/wasm/internal/blake3.js.map +1 -1
- package/dist/wasm/internal/blake3.wasm.d.ts +3 -1
- package/dist/wasm/internal/blake3.wasm.d.ts.map +1 -1
- package/dist/wasm/internal/blake3.wasm.js +3 -1
- package/dist/wasm/internal/blake3.wasm.js.map +1 -1
- package/dist/wasm/internal/hash.d.ts +9 -0
- package/dist/wasm/internal/hash.d.ts.map +1 -1
- package/dist/wasm/internal/hash.js +13 -1
- package/dist/wasm/internal/hash.js.map +1 -1
- package/dist/wasm/internal/hashState.d.ts +25 -0
- package/dist/wasm/internal/hashState.d.ts.map +1 -0
- package/dist/wasm/internal/hashState.js +105 -0
- package/dist/wasm/internal/hashState.js.map +1 -0
- package/dist/wasm/internal/hashes.d.ts +12 -1
- package/dist/wasm/internal/hashes.d.ts.map +1 -1
- package/dist/wasm/internal/hashes.js +18 -1
- package/dist/wasm/internal/hashes.js.map +1 -1
- package/dist/wasm/internal/hashes.wasm.d.ts +11 -3
- package/dist/wasm/internal/hashes.wasm.d.ts.map +1 -1
- package/dist/wasm/internal/hashes.wasm.js +11 -3
- package/dist/wasm/internal/hashes.wasm.js.map +1 -1
- package/dist/wasm/internal/instantiate.d.ts +12 -0
- package/dist/wasm/internal/instantiate.d.ts.map +1 -1
- package/dist/wasm/internal/instantiate.js +23 -7
- package/dist/wasm/internal/instantiate.js.map +1 -1
- package/dist/wasm/internal/keystore.d.ts +10 -0
- package/dist/wasm/internal/keystore.d.ts.map +1 -0
- package/dist/wasm/internal/keystore.js +10 -0
- package/dist/wasm/internal/keystore.js.map +1 -0
- package/dist/wasm/internal/kzg.d.ts +17 -0
- package/dist/wasm/internal/kzg.d.ts.map +1 -0
- package/dist/wasm/internal/kzg.js +8 -0
- package/dist/wasm/internal/kzg.js.map +1 -0
- package/dist/wasm/internal/kzg.wasm.d.ts +3 -0
- package/dist/wasm/internal/kzg.wasm.d.ts.map +1 -0
- package/dist/wasm/internal/kzg.wasm.js +10 -0
- package/dist/wasm/internal/kzg.wasm.js.map +1 -0
- package/dist/wasm/internal/scrypt.d.ts +16 -0
- package/dist/wasm/internal/scrypt.d.ts.map +1 -0
- package/dist/wasm/internal/scrypt.js +78 -0
- package/dist/wasm/internal/scrypt.js.map +1 -0
- package/dist/wasm/internal/scrypt.wasm.d.ts +7 -0
- package/dist/wasm/internal/scrypt.wasm.d.ts.map +1 -0
- package/dist/wasm/internal/scrypt.wasm.js +14 -0
- package/dist/wasm/internal/scrypt.wasm.js.map +1 -0
- package/dist/wasm/internal/secp256k1.d.ts +16 -0
- package/dist/wasm/internal/secp256k1.d.ts.map +1 -0
- package/dist/wasm/internal/secp256k1.js +20 -0
- package/dist/wasm/internal/secp256k1.js.map +1 -0
- package/dist/wasm/internal/secp256k1.wasm.d.ts +3 -0
- package/dist/wasm/internal/secp256k1.wasm.d.ts.map +1 -0
- package/dist/wasm/internal/secp256k1.wasm.js +10 -0
- package/dist/wasm/internal/secp256k1.wasm.js.map +1 -0
- package/dist/webauthn/Authentication.d.ts +2 -0
- package/dist/webauthn/Authentication.d.ts.map +1 -1
- package/dist/webauthn/Authentication.js +2 -1
- package/dist/webauthn/Authentication.js.map +1 -1
- package/dist/webauthn/Registration.d.ts.map +1 -1
- package/dist/webauthn/Registration.js +2 -1
- package/dist/webauthn/Registration.js.map +1 -1
- package/dist/webauthn/Types.d.ts +27 -6
- package/dist/webauthn/Types.d.ts.map +1 -1
- package/dist/webauthn/internal/utils.d.ts.map +1 -1
- package/dist/webauthn/internal/utils.js +35 -9
- package/dist/webauthn/internal/utils.js.map +1 -1
- package/dist/zod/TypedData.d.ts +2 -2
- package/package.json +27 -2
- package/src/benchmarks/Ox.bench.ts +6 -0
- package/src/benchmarks/OxNode.bench.ts +8 -0
- package/src/benchmarks/OxV0.bench.ts +4 -0
- package/src/benchmarks/OxWasm.bench.ts +22 -0
- package/src/core/AbiFunction.ts +5 -5
- package/src/core/AbiParameters.ts +8 -20
- package/src/core/AesGcm.ts +86 -1
- package/src/core/Ed25519.ts +87 -1
- package/src/core/Engine.ts +1 -0
- package/src/core/Hash.ts +321 -1
- package/src/core/Hex.ts +1 -4
- package/src/core/Rlp.ts +172 -5
- package/src/core/Secp256k1.ts +92 -1
- package/src/core/WebAuthn.ts +579 -0
- package/src/core/WebAuthnP256.ts +47 -50
- package/src/core/_test/AbiFunction.test.ts +9 -0
- package/src/core/_test/AbiParameters.differential.fuzz.ts +156 -0
- package/src/core/_test/AbiParameters.encode.test.ts +22 -0
- package/src/core/_test/AbiParameters.fuzz.ts +4 -0
- package/src/core/_test/AesGcm.test.ts +76 -0
- package/src/core/_test/Block.test.ts +9 -2
- package/src/core/_test/Ed25519.test-d.ts +13 -1
- package/src/core/_test/Ed25519.test.ts +120 -1
- package/src/core/_test/Engine.test-d.ts +9 -0
- package/src/core/_test/Engine.test.ts +1 -1
- package/src/core/_test/Hash.test-d.ts +41 -0
- package/src/core/_test/Hash.test.ts +278 -1
- package/src/core/_test/Hash.vectors.test.ts +1 -2
- package/src/core/_test/Hex.test.ts +2 -0
- package/src/core/_test/Rlp.test-d.ts +18 -0
- package/src/core/_test/Rlp.test.ts +109 -0
- package/src/core/_test/Secp256k1.test-d.ts +14 -0
- package/src/core/_test/Secp256k1.test.ts +91 -1
- package/src/core/_test/Transaction.test.ts +11 -2
- package/src/core/_test/WebAuthn.test-d.ts +142 -0
- package/src/core/_test/WebAuthn.test.ts +766 -0
- package/src/core/_test/index.test.ts +1 -0
- package/src/core/internal/abiParameters.ts +466 -326
- package/src/core/internal/engine.ts +47 -2
- package/src/core/internal/hash.ts +53 -1
- package/src/index.ts +24 -14
- package/src/node/Engine.ts +1 -0
- package/src/node/Hash.ts +43 -6
- package/src/node/_test/Engine.test-d.ts +1 -0
- package/src/node/_test/Engine.test.ts +2 -0
- package/src/node/_test/Hash.test-d.ts +11 -0
- package/src/node/_test/Hash.test.ts +46 -0
- package/src/tempo/AuthorizationTempo.ts +6 -6
- package/src/tempo/KeyAuthorization.ts +3 -8
- package/src/tempo/SignatureEnvelope.ts +8 -8
- package/src/trusted-setups/Paths.ts +1 -0
- package/src/trusted-setups/README.md +39 -0
- package/src/trusted-setups/Setups.ts +46 -0
- package/src/trusted-setups/_test/Paths.test.ts +16 -0
- package/src/trusted-setups/_test/Setups.test-d.ts +7 -0
- package/src/trusted-setups/_test/Setups.test.ts +43 -0
- package/src/trusted-setups/_test/index.test.ts +1 -0
- package/src/trusted-setups/index.ts +21 -0
- package/src/trusted-setups/internal/paths.ts +4 -1
- package/src/trusted-setups/internal/setups/mainnet.source.json +7 -0
- package/src/trusted-setups/internal/setups/mainnet.ts +16 -0
- package/src/version.ts +1 -1
- package/src/wasm/Engine.ts +9 -6
- package/src/wasm/Hash.ts +10 -0
- package/src/wasm/Keystore.bench.ts +26 -0
- package/src/wasm/Keystore.ts +32 -14
- package/src/wasm/Kzg.bench.ts +63 -0
- package/src/wasm/Kzg.ts +518 -0
- package/src/wasm/Secp256k1.bench.ts +79 -0
- package/src/wasm/Secp256k1.ts +248 -0
- package/src/wasm/_test/Engine.test-d.ts +2 -0
- package/src/wasm/_test/Engine.test.ts +5 -0
- package/src/wasm/_test/Hash.browser.test.ts +31 -0
- package/src/wasm/_test/Hash.test-d.ts +17 -0
- package/src/wasm/_test/Hash.test.ts +252 -3
- package/src/wasm/_test/Keystore.browser.test.ts +31 -0
- package/src/wasm/_test/Keystore.fuzz.ts +50 -0
- package/src/wasm/_test/Keystore.test-d.ts +10 -1
- package/src/wasm/_test/Keystore.test.ts +289 -4
- package/src/wasm/_test/Kzg.test-d.ts +19 -0
- package/src/wasm/_test/Kzg.test.ts +220 -0
- package/src/wasm/_test/Runtime.test.ts +9 -0
- package/src/wasm/_test/Secp256k1.test-d.ts +35 -0
- package/src/wasm/_test/Secp256k1.test.ts +354 -0
- package/src/wasm/index.ts +46 -1
- package/src/wasm/internal/blake3.ts +23 -2
- package/src/wasm/internal/blake3.wasm.ts +4 -1
- package/src/wasm/internal/hash.ts +27 -1
- package/src/wasm/internal/hashState.ts +154 -0
- package/src/wasm/internal/hashes.ts +56 -15
- package/src/wasm/internal/hashes.wasm.ts +15 -3
- package/src/wasm/internal/instantiate.ts +29 -9
- package/src/wasm/internal/keystore.ts +19 -0
- package/src/wasm/internal/kzg.ts +50 -0
- package/src/wasm/internal/kzg.wasm.ts +11 -0
- package/src/wasm/internal/scrypt.ts +131 -0
- package/src/wasm/internal/scrypt.wasm.ts +17 -0
- package/src/wasm/internal/secp256k1.ts +62 -0
- package/src/wasm/internal/secp256k1.wasm.ts +11 -0
- package/src/webauthn/Authentication.ts +4 -0
- package/src/webauthn/Registration.ts +2 -0
- package/src/webauthn/Types.ts +32 -2
- package/src/webauthn/_test/Authentication.test.ts +123 -1
- package/src/webauthn/_test/Registration.test.ts +26 -6
- package/src/webauthn/_test/WebAuthn.browser.test.ts +28 -0
- package/src/webauthn/internal/utils.ts +41 -8
- package/wasm/vendor/c-kzg-4844/LICENSE +201 -0
- package/wasm/vendor/c-kzg-4844/blst/LICENSE +201 -0
- package/src/trusted-setups/internal/setups/mainnet.txt +0 -4163
|
@@ -12,9 +12,9 @@ export declare const createChallenge: Uint8Array;
|
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```ts twoslash
|
|
15
|
-
* import {
|
|
15
|
+
* import { WebAuthn } from 'ox'
|
|
16
16
|
*
|
|
17
|
-
* const credential = await
|
|
17
|
+
* const credential = await WebAuthn.createCredential({
|
|
18
18
|
* name: 'Example'
|
|
19
19
|
* }) // [!code focus]
|
|
20
20
|
* // @log: {
|
|
@@ -23,7 +23,7 @@ export declare const createChallenge: Uint8Array;
|
|
|
23
23
|
* // @log: raw: PublicKeyCredential {},
|
|
24
24
|
* // @log: }
|
|
25
25
|
*
|
|
26
|
-
* const { metadata, signature } = await
|
|
26
|
+
* const { metadata, signature } = await WebAuthn.sign({
|
|
27
27
|
* credentialId: credential.id,
|
|
28
28
|
* challenge: '0xdeadbeef'
|
|
29
29
|
* })
|
|
@@ -39,27 +39,25 @@ export declare namespace createCredential {
|
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Gets the authenticator data which contains information about the
|
|
42
|
-
* processing of an authenticator request (ie. from `
|
|
42
|
+
* processing of an authenticator request (ie. from `WebAuthn.sign`).
|
|
43
43
|
*
|
|
44
44
|
* :::warning
|
|
45
45
|
*
|
|
46
46
|
* This function is mainly for testing purposes or for manually constructing
|
|
47
47
|
* autenticator data. In most cases you will not need this function.
|
|
48
48
|
* `authenticatorData` is typically returned as part of the
|
|
49
|
-
* {@link ox#
|
|
49
|
+
* {@link ox#WebAuthn.(sign:function)} response (ie. an authenticator response).
|
|
50
50
|
*
|
|
51
51
|
* :::
|
|
52
52
|
*
|
|
53
53
|
* @example
|
|
54
54
|
* ```ts twoslash
|
|
55
|
-
* import {
|
|
55
|
+
* import { WebAuthn } from 'ox'
|
|
56
56
|
*
|
|
57
|
-
* const authenticatorData =
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* }
|
|
62
|
-
* )
|
|
57
|
+
* const authenticatorData = WebAuthn.getAuthenticatorData({
|
|
58
|
+
* rpId: 'example.com',
|
|
59
|
+
* signCount: 420
|
|
60
|
+
* })
|
|
63
61
|
* // @log: "0xa379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce194705000001a4"
|
|
64
62
|
* ```
|
|
65
63
|
*
|
|
@@ -69,20 +67,18 @@ export declare namespace createCredential {
|
|
|
69
67
|
* Include a credential ID and public key in the authenticator data (for registration responses):
|
|
70
68
|
*
|
|
71
69
|
* ```ts twoslash
|
|
72
|
-
* import { P256,
|
|
70
|
+
* import { P256, WebAuthn } from 'ox'
|
|
73
71
|
*
|
|
74
72
|
* const { publicKey } = P256.createKeyPair()
|
|
75
73
|
*
|
|
76
|
-
* const authenticatorData =
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* publicKey
|
|
83
|
-
* }
|
|
74
|
+
* const authenticatorData = WebAuthn.getAuthenticatorData({
|
|
75
|
+
* rpId: 'example.com',
|
|
76
|
+
* flag: 0x41, // UP + AT
|
|
77
|
+
* credential: {
|
|
78
|
+
* id: new Uint8Array(32),
|
|
79
|
+
* publicKey
|
|
84
80
|
* }
|
|
85
|
-
* )
|
|
81
|
+
* })
|
|
86
82
|
* ```
|
|
87
83
|
*
|
|
88
84
|
* @param options - Options to construct the authenticator data.
|
|
@@ -95,22 +91,22 @@ export declare namespace getAuthenticatorData {
|
|
|
95
91
|
}
|
|
96
92
|
/**
|
|
97
93
|
* Constructs the Client Data in stringified JSON format which represents client data that
|
|
98
|
-
* was passed to `credentials.get()` in {@link ox#
|
|
94
|
+
* was passed to `credentials.get()` in {@link ox#WebAuthn.(sign:function)}.
|
|
99
95
|
*
|
|
100
96
|
* :::warning
|
|
101
97
|
*
|
|
102
98
|
* This function is mainly for testing purposes or for manually constructing
|
|
103
99
|
* client data. In most cases you will not need this function.
|
|
104
100
|
* `clientDataJSON` is typically returned as part of the
|
|
105
|
-
* {@link ox#
|
|
101
|
+
* {@link ox#WebAuthn.(sign:function)} response (ie. an authenticator response).
|
|
106
102
|
*
|
|
107
103
|
* :::
|
|
108
104
|
*
|
|
109
105
|
* @example
|
|
110
106
|
* ```ts twoslash
|
|
111
|
-
* import {
|
|
107
|
+
* import { WebAuthn } from 'ox'
|
|
112
108
|
*
|
|
113
|
-
* const clientDataJSON =
|
|
109
|
+
* const clientDataJSON = WebAuthn.getClientDataJSON({
|
|
114
110
|
* challenge: '0xdeadbeef',
|
|
115
111
|
* origin: 'https://example.com'
|
|
116
112
|
* })
|
|
@@ -138,19 +134,17 @@ export declare namespace getClientDataJSON {
|
|
|
138
134
|
*
|
|
139
135
|
* @example
|
|
140
136
|
* ```ts twoslash
|
|
141
|
-
* import { P256,
|
|
137
|
+
* import { P256, WebAuthn } from 'ox'
|
|
142
138
|
*
|
|
143
139
|
* const { publicKey } = P256.createKeyPair()
|
|
144
140
|
*
|
|
145
|
-
* const attestationObject =
|
|
146
|
-
* {
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* }
|
|
153
|
-
* )
|
|
141
|
+
* const attestationObject = WebAuthn.getAttestationObject({
|
|
142
|
+
* authData: WebAuthn.getAuthenticatorData({
|
|
143
|
+
* rpId: 'example.com',
|
|
144
|
+
* flag: 0x41,
|
|
145
|
+
* credential: { id: new Uint8Array(32), publicKey }
|
|
146
|
+
* })
|
|
147
|
+
* })
|
|
154
148
|
* ```
|
|
155
149
|
*
|
|
156
150
|
* @param options - Options to construct the attestation object.
|
|
@@ -167,9 +161,9 @@ export declare namespace getAttestationObject {
|
|
|
167
161
|
*
|
|
168
162
|
* @example
|
|
169
163
|
* ```ts twoslash
|
|
170
|
-
* import {
|
|
164
|
+
* import { WebAuthn } from 'ox'
|
|
171
165
|
*
|
|
172
|
-
* const options =
|
|
166
|
+
* const options = WebAuthn.getCredentialCreationOptions({
|
|
173
167
|
* name: 'Example'
|
|
174
168
|
* })
|
|
175
169
|
*
|
|
@@ -190,9 +184,9 @@ export declare namespace getCredentialCreationOptions {
|
|
|
190
184
|
*
|
|
191
185
|
* @example
|
|
192
186
|
* ```ts twoslash
|
|
193
|
-
* import {
|
|
187
|
+
* import { WebAuthn } from 'ox'
|
|
194
188
|
*
|
|
195
|
-
* const options =
|
|
189
|
+
* const options = WebAuthn.getCredentialRequestOptions({
|
|
196
190
|
* challenge: '0xdeadbeef'
|
|
197
191
|
* })
|
|
198
192
|
*
|
|
@@ -218,15 +212,15 @@ export declare namespace getCredentialRequestOptions {
|
|
|
218
212
|
*
|
|
219
213
|
* This function is mainly for testing purposes or for manually constructing
|
|
220
214
|
* signing payloads. In most cases you will not need this function and
|
|
221
|
-
* instead use {@link ox#
|
|
215
|
+
* instead use {@link ox#WebAuthn.(sign:function)}.
|
|
222
216
|
*
|
|
223
217
|
* :::
|
|
224
218
|
*
|
|
225
219
|
* @example
|
|
226
220
|
* ```ts twoslash
|
|
227
|
-
* import {
|
|
221
|
+
* import { WebAuthn, WebCryptoP256 } from 'ox'
|
|
228
222
|
*
|
|
229
|
-
* const { metadata, payload } =
|
|
223
|
+
* const { metadata, payload } = WebAuthn.getSignPayload({
|
|
230
224
|
* // [!code focus]
|
|
231
225
|
* challenge: '0xdeadbeef' // [!code focus]
|
|
232
226
|
* }) // [!code focus]
|
|
@@ -266,13 +260,13 @@ export declare namespace getSignPayload {
|
|
|
266
260
|
*
|
|
267
261
|
* @example
|
|
268
262
|
* ```ts twoslash
|
|
269
|
-
* import {
|
|
263
|
+
* import { WebAuthn } from 'ox'
|
|
270
264
|
*
|
|
271
|
-
* const credential = await
|
|
265
|
+
* const credential = await WebAuthn.createCredential({
|
|
272
266
|
* name: 'Example'
|
|
273
267
|
* })
|
|
274
268
|
*
|
|
275
|
-
* const { metadata, signature } = await
|
|
269
|
+
* const { metadata, signature } = await WebAuthn.sign({
|
|
276
270
|
* // [!code focus]
|
|
277
271
|
* credentialId: credential.id, // [!code focus]
|
|
278
272
|
* challenge: '0xdeadbeef' // [!code focus]
|
|
@@ -303,18 +297,18 @@ export declare namespace sign {
|
|
|
303
297
|
*
|
|
304
298
|
* @example
|
|
305
299
|
* ```ts twoslash
|
|
306
|
-
* import {
|
|
300
|
+
* import { WebAuthn } from 'ox'
|
|
307
301
|
*
|
|
308
|
-
* const credential = await
|
|
302
|
+
* const credential = await WebAuthn.createCredential({
|
|
309
303
|
* name: 'Example'
|
|
310
304
|
* })
|
|
311
305
|
*
|
|
312
|
-
* const { metadata, signature } = await
|
|
306
|
+
* const { metadata, signature } = await WebAuthn.sign({
|
|
313
307
|
* credentialId: credential.id,
|
|
314
308
|
* challenge: '0xdeadbeef'
|
|
315
309
|
* })
|
|
316
310
|
*
|
|
317
|
-
* const result = await
|
|
311
|
+
* const result = await WebAuthn.verify({
|
|
318
312
|
* // [!code focus]
|
|
319
313
|
* metadata, // [!code focus]
|
|
320
314
|
* challenge: '0xdeadbeef', // [!code focus]
|
|
@@ -333,4 +327,6 @@ export declare namespace verify {
|
|
|
333
327
|
type ErrorType = Authentication.verify.ErrorType;
|
|
334
328
|
}
|
|
335
329
|
export type { AttestationConveyancePreference, AuthenticationExtensionsClientInputs, AuthenticatorAttachment, AuthenticatorSelectionCriteria, AuthenticatorTransport, BufferSource, COSEAlgorithmIdentifier, Credential, CredentialCreationOptions, CredentialMediationRequirement, CredentialRequestOptions, LargeBlobSupport, PrfExtension, PublicKeyCredential, PublicKeyCredentialCreationOptions, PublicKeyCredentialDescriptor, PublicKeyCredentialEntity, PublicKeyCredentialParameters, PublicKeyCredentialRequestOptions, PublicKeyCredentialRpEntity, PublicKeyCredentialType, PublicKeyCredentialUserEntity, ResidentKeyRequirement, UserVerificationRequirement, } from '../webauthn/Types.js';
|
|
330
|
+
/** @deprecated Use `WebAuthn` instead. */
|
|
331
|
+
declare module './WebAuthnP256.js' { }
|
|
336
332
|
//# sourceMappingURL=WebAuthnP256.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebAuthnP256.d.ts","sourceRoot":"","sources":["../../src/core/WebAuthnP256.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,aAAa,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,KAAK,WAAW,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAA;AAE3D,2CAA2C;AAC3C,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,UAAU,CAAA;AAEnD,8CAA8C;AAC9C,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,CAAA;AAEnD,eAAO,MAAM,eAAe,YAA+B,CAAA;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,gBAAgB,CAAC,OAAO,GAChC,OAAO,CAAC,cAAc,CAAC,CAEzB;AAED,MAAM,CAAC,OAAO,WAAW,gBAAgB,CAAC;IACxC,KAAK,O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
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```ts twoslash
|
|
10
|
-
* import {
|
|
10
|
+
* import { WebAuthn } from 'ox'
|
|
11
11
|
*
|
|
12
|
-
* const credential = await
|
|
12
|
+
* const credential = await WebAuthn.createCredential({
|
|
13
13
|
* name: 'Example'
|
|
14
14
|
* }) // [!code focus]
|
|
15
15
|
* // @log: {
|
|
@@ -18,7 +18,7 @@ export const createChallenge = Registration.createChallenge;
|
|
|
18
18
|
* // @log: raw: PublicKeyCredential {},
|
|
19
19
|
* // @log: }
|
|
20
20
|
*
|
|
21
|
-
* const { metadata, signature } = await
|
|
21
|
+
* const { metadata, signature } = await WebAuthn.sign({
|
|
22
22
|
* credentialId: credential.id,
|
|
23
23
|
* challenge: '0xdeadbeef'
|
|
24
24
|
* })
|
|
@@ -32,27 +32,25 @@ export async function createCredential(options) {
|
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Gets the authenticator data which contains information about the
|
|
35
|
-
* processing of an authenticator request (ie. from `
|
|
35
|
+
* processing of an authenticator request (ie. from `WebAuthn.sign`).
|
|
36
36
|
*
|
|
37
37
|
* :::warning
|
|
38
38
|
*
|
|
39
39
|
* This function is mainly for testing purposes or for manually constructing
|
|
40
40
|
* autenticator data. In most cases you will not need this function.
|
|
41
41
|
* `authenticatorData` is typically returned as part of the
|
|
42
|
-
* {@link ox#
|
|
42
|
+
* {@link ox#WebAuthn.(sign:function)} response (ie. an authenticator response).
|
|
43
43
|
*
|
|
44
44
|
* :::
|
|
45
45
|
*
|
|
46
46
|
* @example
|
|
47
47
|
* ```ts twoslash
|
|
48
|
-
* import {
|
|
48
|
+
* import { WebAuthn } from 'ox'
|
|
49
49
|
*
|
|
50
|
-
* const authenticatorData =
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* }
|
|
55
|
-
* )
|
|
50
|
+
* const authenticatorData = WebAuthn.getAuthenticatorData({
|
|
51
|
+
* rpId: 'example.com',
|
|
52
|
+
* signCount: 420
|
|
53
|
+
* })
|
|
56
54
|
* // @log: "0xa379a6f6eeafb9a55e378c118034e2751e682fab9f2d30ab13d2125586ce194705000001a4"
|
|
57
55
|
* ```
|
|
58
56
|
*
|
|
@@ -62,20 +60,18 @@ export async function createCredential(options) {
|
|
|
62
60
|
* Include a credential ID and public key in the authenticator data (for registration responses):
|
|
63
61
|
*
|
|
64
62
|
* ```ts twoslash
|
|
65
|
-
* import { P256,
|
|
63
|
+
* import { P256, WebAuthn } from 'ox'
|
|
66
64
|
*
|
|
67
65
|
* const { publicKey } = P256.createKeyPair()
|
|
68
66
|
*
|
|
69
|
-
* const authenticatorData =
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* publicKey
|
|
76
|
-
* }
|
|
67
|
+
* const authenticatorData = WebAuthn.getAuthenticatorData({
|
|
68
|
+
* rpId: 'example.com',
|
|
69
|
+
* flag: 0x41, // UP + AT
|
|
70
|
+
* credential: {
|
|
71
|
+
* id: new Uint8Array(32),
|
|
72
|
+
* publicKey
|
|
77
73
|
* }
|
|
78
|
-
* )
|
|
74
|
+
* })
|
|
79
75
|
* ```
|
|
80
76
|
*
|
|
81
77
|
* @param options - Options to construct the authenticator data.
|
|
@@ -84,22 +80,22 @@ export async function createCredential(options) {
|
|
|
84
80
|
export const getAuthenticatorData = Authenticator.getAuthenticatorData;
|
|
85
81
|
/**
|
|
86
82
|
* Constructs the Client Data in stringified JSON format which represents client data that
|
|
87
|
-
* was passed to `credentials.get()` in {@link ox#
|
|
83
|
+
* was passed to `credentials.get()` in {@link ox#WebAuthn.(sign:function)}.
|
|
88
84
|
*
|
|
89
85
|
* :::warning
|
|
90
86
|
*
|
|
91
87
|
* This function is mainly for testing purposes or for manually constructing
|
|
92
88
|
* client data. In most cases you will not need this function.
|
|
93
89
|
* `clientDataJSON` is typically returned as part of the
|
|
94
|
-
* {@link ox#
|
|
90
|
+
* {@link ox#WebAuthn.(sign:function)} response (ie. an authenticator response).
|
|
95
91
|
*
|
|
96
92
|
* :::
|
|
97
93
|
*
|
|
98
94
|
* @example
|
|
99
95
|
* ```ts twoslash
|
|
100
|
-
* import {
|
|
96
|
+
* import { WebAuthn } from 'ox'
|
|
101
97
|
*
|
|
102
|
-
* const clientDataJSON =
|
|
98
|
+
* const clientDataJSON = WebAuthn.getClientDataJSON({
|
|
103
99
|
* challenge: '0xdeadbeef',
|
|
104
100
|
* origin: 'https://example.com'
|
|
105
101
|
* })
|
|
@@ -123,19 +119,17 @@ export const getClientDataJSON = Authenticator.getClientDataJSON;
|
|
|
123
119
|
*
|
|
124
120
|
* @example
|
|
125
121
|
* ```ts twoslash
|
|
126
|
-
* import { P256,
|
|
122
|
+
* import { P256, WebAuthn } from 'ox'
|
|
127
123
|
*
|
|
128
124
|
* const { publicKey } = P256.createKeyPair()
|
|
129
125
|
*
|
|
130
|
-
* const attestationObject =
|
|
131
|
-
* {
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
* }
|
|
138
|
-
* )
|
|
126
|
+
* const attestationObject = WebAuthn.getAttestationObject({
|
|
127
|
+
* authData: WebAuthn.getAuthenticatorData({
|
|
128
|
+
* rpId: 'example.com',
|
|
129
|
+
* flag: 0x41,
|
|
130
|
+
* credential: { id: new Uint8Array(32), publicKey }
|
|
131
|
+
* })
|
|
132
|
+
* })
|
|
139
133
|
* ```
|
|
140
134
|
*
|
|
141
135
|
* @param options - Options to construct the attestation object.
|
|
@@ -148,9 +142,9 @@ export const getAttestationObject = Authenticator.getAttestationObject;
|
|
|
148
142
|
*
|
|
149
143
|
* @example
|
|
150
144
|
* ```ts twoslash
|
|
151
|
-
* import {
|
|
145
|
+
* import { WebAuthn } from 'ox'
|
|
152
146
|
*
|
|
153
|
-
* const options =
|
|
147
|
+
* const options = WebAuthn.getCredentialCreationOptions({
|
|
154
148
|
* name: 'Example'
|
|
155
149
|
* })
|
|
156
150
|
*
|
|
@@ -167,9 +161,9 @@ export const getCredentialCreationOptions = Registration.getOptions;
|
|
|
167
161
|
*
|
|
168
162
|
* @example
|
|
169
163
|
* ```ts twoslash
|
|
170
|
-
* import {
|
|
164
|
+
* import { WebAuthn } from 'ox'
|
|
171
165
|
*
|
|
172
|
-
* const options =
|
|
166
|
+
* const options = WebAuthn.getCredentialRequestOptions({
|
|
173
167
|
* challenge: '0xdeadbeef'
|
|
174
168
|
* })
|
|
175
169
|
*
|
|
@@ -191,15 +185,15 @@ export const getCredentialRequestOptions = Authentication.getOptions;
|
|
|
191
185
|
*
|
|
192
186
|
* This function is mainly for testing purposes or for manually constructing
|
|
193
187
|
* signing payloads. In most cases you will not need this function and
|
|
194
|
-
* instead use {@link ox#
|
|
188
|
+
* instead use {@link ox#WebAuthn.(sign:function)}.
|
|
195
189
|
*
|
|
196
190
|
* :::
|
|
197
191
|
*
|
|
198
192
|
* @example
|
|
199
193
|
* ```ts twoslash
|
|
200
|
-
* import {
|
|
194
|
+
* import { WebAuthn, WebCryptoP256 } from 'ox'
|
|
201
195
|
*
|
|
202
|
-
* const { metadata, payload } =
|
|
196
|
+
* const { metadata, payload } = WebAuthn.getSignPayload({
|
|
203
197
|
* // [!code focus]
|
|
204
198
|
* challenge: '0xdeadbeef' // [!code focus]
|
|
205
199
|
* }) // [!code focus]
|
|
@@ -234,13 +228,13 @@ export const getSignPayload = Authentication.getSignPayload;
|
|
|
234
228
|
*
|
|
235
229
|
* @example
|
|
236
230
|
* ```ts twoslash
|
|
237
|
-
* import {
|
|
231
|
+
* import { WebAuthn } from 'ox'
|
|
238
232
|
*
|
|
239
|
-
* const credential = await
|
|
233
|
+
* const credential = await WebAuthn.createCredential({
|
|
240
234
|
* name: 'Example'
|
|
241
235
|
* })
|
|
242
236
|
*
|
|
243
|
-
* const { metadata, signature } = await
|
|
237
|
+
* const { metadata, signature } = await WebAuthn.sign({
|
|
244
238
|
* // [!code focus]
|
|
245
239
|
* credentialId: credential.id, // [!code focus]
|
|
246
240
|
* challenge: '0xdeadbeef' // [!code focus]
|
|
@@ -268,18 +262,18 @@ export async function sign(options) {
|
|
|
268
262
|
*
|
|
269
263
|
* @example
|
|
270
264
|
* ```ts twoslash
|
|
271
|
-
* import {
|
|
265
|
+
* import { WebAuthn } from 'ox'
|
|
272
266
|
*
|
|
273
|
-
* const credential = await
|
|
267
|
+
* const credential = await WebAuthn.createCredential({
|
|
274
268
|
* name: 'Example'
|
|
275
269
|
* })
|
|
276
270
|
*
|
|
277
|
-
* const { metadata, signature } = await
|
|
271
|
+
* const { metadata, signature } = await WebAuthn.sign({
|
|
278
272
|
* credentialId: credential.id,
|
|
279
273
|
* challenge: '0xdeadbeef'
|
|
280
274
|
* })
|
|
281
275
|
*
|
|
282
|
-
* const result = await
|
|
276
|
+
* const result = await WebAuthn.verify({
|
|
283
277
|
* // [!code focus]
|
|
284
278
|
* metadata, // [!code focus]
|
|
285
279
|
* challenge: '0xdeadbeef', // [!code focus]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebAuthnP256.js","sourceRoot":"","sources":["../../src/core/WebAuthnP256.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,aAAa,MAAM,8BAA8B,CAAA;AAE7D,OAAO,KAAK,YAAY,MAAM,6BAA6B,CAAA;AAQ3D,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAC,eAAe,CAAA;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAiC;IAEjC,OAAO,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AACrC,CAAC;AAOD
|
|
1
|
+
{"version":3,"file":"WebAuthnP256.js","sourceRoot":"","sources":["../../src/core/WebAuthnP256.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,+BA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,OAAuB;IAC5C,OAAO,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AACvC,CAAC"}
|
|
@@ -12,11 +12,6 @@ export type ParameterToPrimitiveType<abiParameter extends AbiParameter | {
|
|
|
12
12
|
type: unknown;
|
|
13
13
|
}, abiParameterKind extends AbiParameterKind = AbiParameterKind> = AbiParameterToPrimitiveType<abiParameter, abiParameterKind>;
|
|
14
14
|
/** @internal */
|
|
15
|
-
export type PreparedParameter = {
|
|
16
|
-
dynamic: boolean;
|
|
17
|
-
encoded: Hex.Hex;
|
|
18
|
-
};
|
|
19
|
-
/** @internal */
|
|
20
15
|
export type ToObject<parameters extends readonly AbiParameter[], kind extends AbiParameterKind = AbiParameterKind> = IsNarrowable<parameters, AbiParameters.AbiParameters> extends true ? Compute<UnionToIntersection<{
|
|
21
16
|
[index in keyof parameters]: parameters[index] extends {
|
|
22
17
|
name: infer name extends string;
|
|
@@ -91,88 +86,13 @@ export declare namespace decodeString {
|
|
|
91
86
|
type ErrorType = Bytes.toNumber.ErrorType | Bytes.toString.ErrorType | Errors.GlobalErrorType;
|
|
92
87
|
}
|
|
93
88
|
/** @internal */
|
|
94
|
-
export declare function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
type ErrorType = prepareParameter.ErrorType | Errors.GlobalErrorType;
|
|
102
|
-
}
|
|
103
|
-
/** @internal */
|
|
104
|
-
export declare function prepareParameter<const parameter extends AbiParameters.Parameter>({ checksumAddress, parameter: parameter_, value, }: {
|
|
105
|
-
parameter: parameter;
|
|
106
|
-
value: parameter extends AbiParameters.Parameter ? ParameterToPrimitiveType<parameter> : never;
|
|
107
|
-
checksumAddress?: boolean | undefined;
|
|
108
|
-
}): PreparedParameter;
|
|
109
|
-
/** @internal */
|
|
110
|
-
export declare namespace prepareParameter {
|
|
111
|
-
type ErrorType = encodeArray.ErrorType | encodeTuple.ErrorType | encodeAddress.ErrorType | encodeBoolean.ErrorType | encodeBytes.ErrorType | encodeString.ErrorType | AbiParameters.InvalidTypeError | Errors.GlobalErrorType;
|
|
112
|
-
}
|
|
113
|
-
/** @internal */
|
|
114
|
-
export declare function encode(preparedParameters: PreparedParameter[]): Hex.Hex;
|
|
115
|
-
/** @internal */
|
|
116
|
-
export declare namespace encode {
|
|
117
|
-
type ErrorType = Hex.concat.ErrorType | Hex.fromNumber.ErrorType | Hex.size.ErrorType | Errors.GlobalErrorType;
|
|
118
|
-
}
|
|
119
|
-
/** @internal */
|
|
120
|
-
export declare function encodeAddress(value: Hex.Hex, options: {
|
|
121
|
-
checksum: boolean;
|
|
122
|
-
}): PreparedParameter;
|
|
123
|
-
/** @internal */
|
|
124
|
-
export declare namespace encodeAddress {
|
|
125
|
-
type ErrorType = Address.assert.ErrorType | Hex.padLeft.ErrorType | Errors.GlobalErrorType;
|
|
126
|
-
}
|
|
127
|
-
/** @internal */
|
|
128
|
-
export declare function encodeArray<const parameter extends AbiParameters.Parameter>(value: ParameterToPrimitiveType<parameter>, options: {
|
|
129
|
-
checksumAddress?: boolean | undefined;
|
|
130
|
-
length: number | null;
|
|
131
|
-
parameter: parameter;
|
|
132
|
-
}): PreparedParameter;
|
|
133
|
-
/** @internal */
|
|
134
|
-
export declare namespace encodeArray {
|
|
135
|
-
type ErrorType = AbiParameters.InvalidArrayError | AbiParameters.ArrayLengthMismatchError | Hex.concat.ErrorType | Hex.fromNumber.ErrorType | Errors.GlobalErrorType;
|
|
136
|
-
}
|
|
137
|
-
/** @internal */
|
|
138
|
-
export declare function encodeBytes(value: Hex.Hex, { type }: {
|
|
139
|
-
type: string;
|
|
140
|
-
}): PreparedParameter;
|
|
141
|
-
/** @internal */
|
|
142
|
-
export declare namespace encodeBytes {
|
|
143
|
-
type ErrorType = Hex.padLeft.ErrorType | Hex.padRight.ErrorType | Hex.fromNumber.ErrorType | Hex.slice.ErrorType | Errors.GlobalErrorType;
|
|
144
|
-
}
|
|
145
|
-
/** @internal */
|
|
146
|
-
export declare function encodeBoolean(value: boolean): PreparedParameter;
|
|
147
|
-
/** @internal */
|
|
148
|
-
export declare namespace encodeBoolean {
|
|
149
|
-
type ErrorType = Hex.padLeft.ErrorType | Hex.fromBoolean.ErrorType | Errors.GlobalErrorType;
|
|
150
|
-
}
|
|
151
|
-
/** @internal */
|
|
152
|
-
export declare function encodeNumber(value: number, { signed, size }: {
|
|
153
|
-
signed: boolean;
|
|
154
|
-
size: number;
|
|
155
|
-
}): PreparedParameter;
|
|
156
|
-
/** @internal */
|
|
157
|
-
export declare namespace encodeNumber {
|
|
158
|
-
type ErrorType = Hex.fromNumber.ErrorType | Errors.GlobalErrorType;
|
|
159
|
-
}
|
|
160
|
-
/** @internal */
|
|
161
|
-
export declare function encodeString(value: string): PreparedParameter;
|
|
162
|
-
/** @internal */
|
|
163
|
-
export declare namespace encodeString {
|
|
164
|
-
type ErrorType = Hex.fromNumber.ErrorType | Hex.padRight.ErrorType | Hex.slice.ErrorType | Hex.size.ErrorType | Errors.GlobalErrorType;
|
|
165
|
-
}
|
|
166
|
-
/** @internal */
|
|
167
|
-
export declare function encodeTuple<const parameter extends AbiParameters.Parameter & {
|
|
168
|
-
components: readonly AbiParameters.Parameter[];
|
|
169
|
-
}>(value: ParameterToPrimitiveType<parameter>, options: {
|
|
170
|
-
checksumAddress?: boolean | undefined;
|
|
171
|
-
parameter: parameter;
|
|
172
|
-
}): PreparedParameter;
|
|
173
|
-
/** @internal */
|
|
174
|
-
export declare namespace encodeTuple {
|
|
175
|
-
type ErrorType = Hex.concat.ErrorType | Errors.GlobalErrorType;
|
|
89
|
+
export declare function encodeParameters(parameters: readonly AbiParameters.Parameter[], values: readonly unknown[], options?: encodeParameters.Options): Hex.Hex;
|
|
90
|
+
export declare namespace encodeParameters {
|
|
91
|
+
type Options = {
|
|
92
|
+
checksumAddress?: boolean | undefined;
|
|
93
|
+
prefix?: Hex.Hex | undefined;
|
|
94
|
+
};
|
|
95
|
+
type ErrorType = AbiParameters.LengthMismatchError | AbiParameters.InvalidArrayError | AbiParameters.ArrayLengthMismatchError | AbiParameters.BytesSizeMismatchError | AbiParameters.InvalidTypeError | Address.assert.ErrorType | Hex.IntegerOutOfRangeError | Hex.fromBytes.ErrorType | Errors.GlobalErrorType;
|
|
176
96
|
}
|
|
177
97
|
/** @internal */
|
|
178
98
|
export declare function getArrayComponents(type: string): [length: number | null, innerType: string] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abiParameters.d.ts","sourceRoot":"","sources":["../../../src/core/internal/abiParameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,6BAA6B,EAC7B,2BAA2B,EAC5B,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,GAAG,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"abiParameters.d.ts","sourceRoot":"","sources":["../../../src/core/internal/abiParameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,6BAA6B,EAC7B,2BAA2B,EAC5B,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,aAAa,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,GAAG,MAAM,WAAW,CAAA;AAGhC,OAAO,KAAK,KAAK,MAAM,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAE5E,gBAAgB;AAChB,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