@amadeus-protocol/wallet-sdk 0.1.5 → 0.1.6
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/README.md +17 -0
- package/dist/binary.d.ts +0 -2
- package/dist/binary.d.ts.map +1 -1
- package/dist/binary.js +1 -2
- package/dist/bytes.d.ts +0 -2
- package/dist/bytes.d.ts.map +1 -1
- package/dist/bytes.js +1 -2
- package/dist/client/injected.d.ts +0 -2
- package/dist/client/injected.d.ts.map +1 -1
- package/dist/client/injected.js +1 -2
- package/dist/constants.d.ts +0 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -2
- package/dist/crypto/apikey.d.ts +0 -2
- package/dist/crypto/apikey.d.ts.map +1 -1
- package/dist/crypto/apikey.js +1 -2
- package/dist/crypto/bls.d.ts +0 -2
- package/dist/crypto/bls.d.ts.map +1 -1
- package/dist/crypto/bls.js +1 -2
- package/dist/crypto/box.d.ts +0 -2
- package/dist/crypto/box.d.ts.map +1 -1
- package/dist/crypto/box.js +1 -2
- package/dist/crypto/connect.d.ts +0 -2
- package/dist/crypto/connect.d.ts.map +1 -1
- package/dist/crypto/connect.js +1 -2
- package/dist/crypto/message.d.ts +0 -2
- package/dist/crypto/message.d.ts.map +1 -1
- package/dist/crypto/message.js +1 -2
- package/dist/errors.d.ts +0 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -2
- package/dist/react/index.d.ts +0 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -2
- package/dist/schema.d.ts +0 -2
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +1 -2
- package/dist/transport/bridge.d.ts +0 -2
- package/dist/transport/bridge.d.ts.map +1 -1
- package/dist/transport/bridge.js +1 -2
- package/dist/transport/envelope.d.ts +0 -2
- package/dist/transport/envelope.d.ts.map +1 -1
- package/dist/transport/envelope.js +1 -2
- package/dist/transport/session.d.ts +0 -2
- package/dist/transport/session.d.ts.map +1 -1
- package/dist/transport/session.js +1 -2
- package/dist/transport/uri.d.ts +0 -2
- package/dist/transport/uri.d.ts.map +1 -1
- package/dist/transport/uri.js +1 -2
- package/dist/tx.d.ts +0 -2
- package/dist/tx.d.ts.map +1 -1
- package/dist/tx.js +1 -2
- package/dist/types.d.ts +0 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -2
- package/dist/wallet/handler.d.ts +0 -2
- package/dist/wallet/handler.d.ts.map +1 -1
- package/dist/wallet/handler.js +1 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -41,6 +41,23 @@ const result = verifyApiKey(apiKey, { aud: 'amadeus' })
|
|
|
41
41
|
if (result.valid) console.log(result.address)
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
> **The token's address is the public key of the `seed` you pass in.** A recovery
|
|
45
|
+
> phrase can open two different addresses (the standard `eip2333` derivation, and
|
|
46
|
+
> the `legacy` raw-BIP39 seed used by wallets created with older extension and app
|
|
47
|
+
> builds), so don't assume one. Resolve the seed with `resolveCandidateForAddress`
|
|
48
|
+
> (sdk ≥ 1.6.0), which returns the candidate whose `publicKey` equals the user's
|
|
49
|
+
> wallet address, or `null` if neither derivation opens it (it throws on an
|
|
50
|
+
> invalid phrase). Otherwise the token silently belongs to a different account.
|
|
51
|
+
>
|
|
52
|
+
> ```ts
|
|
53
|
+
> import { resolveCandidateForAddress } from '@amadeus-protocol/sdk'
|
|
54
|
+
> import { generateApiKey } from '@amadeus-protocol/wallet-sdk'
|
|
55
|
+
>
|
|
56
|
+
> const candidate = resolveCandidateForAddress(phrase, walletAddress)
|
|
57
|
+
> if (!candidate) throw new Error('This phrase does not open that address')
|
|
58
|
+
> const { apiKey } = generateApiKey({ seed: candidate.seed, aud: 'amadeus', expIn: 3600 })
|
|
59
|
+
> ```
|
|
60
|
+
|
|
44
61
|
## Security notes
|
|
45
62
|
|
|
46
63
|
- **Distinct DSTs** (`_TX_`, `_APIKEY_`, `_CONNECT_`) make a signature from one
|
package/dist/binary.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/binary.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* JSON-safe encoding for binary values (typed arrays) that cross a text
|
|
4
3
|
* transport. Transaction args can contain raw bytes (e.g. a recipient pubkey);
|
|
@@ -25,6 +24,5 @@ declare function encodeBinaryValues(value: unknown): unknown;
|
|
|
25
24
|
declare function decodeBinaryValues(value: unknown): unknown;
|
|
26
25
|
/** Human-readable stand-in for tagged bytes when displaying args in an approval UI. */
|
|
27
26
|
declare function describeBinaryValues(value: unknown): unknown;
|
|
28
|
-
//#endregion
|
|
29
27
|
export { BYTES_TAG, TaggedBytes, decodeBinaryValues, describeBinaryValues, encodeBinaryValues, isTaggedBytes };
|
|
30
28
|
//# sourceMappingURL=binary.d.ts.map
|
package/dist/binary.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary.d.ts","names":[],"sources":["../src/binary.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"binary.d.ts","names":[],"sources":["../src/binary.ts"],"mappings":";;;;;;;;;;;;cAea;KAED;GAAiB;;iBAab,cAAc,iBAAiB,SAAS;;;;;iBAcxC,mBAAmB;;iBAkBnB,mBAAmB;;iBAgBnB,qBAAqB"}
|
package/dist/binary.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { base64ToUint8Array, uint8ArrayToBase64 } from "@amadeus-protocol/sdk";
|
|
2
|
-
|
|
2
|
+
// src/binary.ts
|
|
3
3
|
/**
|
|
4
4
|
* JSON-safe encoding for binary values (typed arrays) that cross a text
|
|
5
5
|
* transport. Transaction args can contain raw bytes (e.g. a recipient pubkey);
|
|
@@ -50,7 +50,6 @@ function describeBinaryValues(value) {
|
|
|
50
50
|
if (typeof value === "object" && value !== null) return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, describeBinaryValues(entry)]));
|
|
51
51
|
return value;
|
|
52
52
|
}
|
|
53
|
-
//#endregion
|
|
54
53
|
export { BYTES_TAG, decodeBinaryValues, describeBinaryValues, encodeBinaryValues, isTaggedBytes };
|
|
55
54
|
|
|
56
55
|
//# sourceMappingURL=binary.js.map
|
package/dist/bytes.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { concatBytes, randomBytes } from "@noble/hashes/utils";
|
|
2
|
-
//#region src/bytes.d.ts
|
|
3
2
|
declare const concatBytes$1: typeof concatBytes;
|
|
4
3
|
declare const randomBytes$1: typeof randomBytes;
|
|
5
4
|
/** A random hex id (default 16 bytes → 32 hex chars). Used for request ids. */
|
|
@@ -15,6 +14,5 @@ declare function u32be(n: number): Uint8Array;
|
|
|
15
14
|
* (`box.open`) and BLS verification both rely on noble's constant-time primitives.
|
|
16
15
|
*/
|
|
17
16
|
declare function equalBytes(a: Uint8Array, b: Uint8Array): boolean;
|
|
18
|
-
//#endregion
|
|
19
17
|
export { bytesToUtf8, concatBytes$1 as concatBytes, equalBytes, randomBytes$1 as randomBytes, randomId, u32be, utf8ToBytes };
|
|
20
18
|
//# sourceMappingURL=bytes.d.ts.map
|
package/dist/bytes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytes.d.ts","names":["concatBytes","nobleConcat","randomBytes","nobleRandom"],"sources":["../src/bytes.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bytes.d.ts","names":["concatBytes","nobleConcat","randomBytes","nobleRandom"],"sources":["../src/bytes.ts"],"mappings":";cAeaA,sBAAWC;cACXC,sBAAWC;;iBAGR,SAAS;iBAIT,YAAY,gBAAgB;iBAI5B,YAAY,OAAO;;iBAKnB,MAAM,YAAY;;;;;;;iBAkBlB,WAAW,GAAG,YAAY,GAAG"}
|
package/dist/bytes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { bytesToHex, concatBytes, randomBytes } from "@noble/hashes/utils";
|
|
2
|
-
|
|
2
|
+
// src/bytes.ts
|
|
3
3
|
/**
|
|
4
4
|
* Small byte helpers, kept isomorphic (Node, browser, React Native/Hermes).
|
|
5
5
|
*
|
|
@@ -42,7 +42,6 @@ function equalBytes(a, b) {
|
|
|
42
42
|
for (let i = 0; i < a.length; i++) diff |= a[i] ^ b[i];
|
|
43
43
|
return diff === 0;
|
|
44
44
|
}
|
|
45
|
-
//#endregion
|
|
46
45
|
export { bytesToUtf8, concatBytes$1 as concatBytes, equalBytes, randomBytes$1 as randomBytes, randomId, u32be, utf8ToBytes };
|
|
47
46
|
|
|
48
47
|
//# sourceMappingURL=bytes.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { AmadeusEventPayloadMap, AmadeusProvider, AmadeusProviderEvent, SignTransactionRequest, SignTransactionResponse } from "../types.js";
|
|
2
|
-
//#region src/client/injected.d.ts
|
|
3
2
|
/** Where a cached api-key lives. Default is in-memory; dApps can pass localStorage-backed. */
|
|
4
3
|
interface ApiKeyStore {
|
|
5
4
|
get(): string | null;
|
|
@@ -36,6 +35,5 @@ interface WalletClient {
|
|
|
36
35
|
* inject a provider (e.g. in tests); otherwise it reads `window.amadeus`.
|
|
37
36
|
*/
|
|
38
37
|
declare function createInjectedWalletClient(providerOverride?: AmadeusProvider): WalletClient;
|
|
39
|
-
//#endregion
|
|
40
38
|
export { ApiKeyStore, WalletClient, createInjectedWalletClient };
|
|
41
39
|
//# sourceMappingURL=injected.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"injected.d.ts","names":[],"sources":["../../src/client/injected.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"injected.d.ts","names":[],"sources":["../../src/client/injected.ts"],"mappings":";;UAyBiB;EAChB;EACA,IAAI;;UAiBY;EAChB;EACA,eAAe;;EAEf,WAAW;EACX,cAAc;EACd,cAAc;EACd,gBAAgB,SAAS,yBAAyB,QAAQ;;EAE1D,cACC,SAAS,wBACT;IAAW;IAAiB;MAC1B;IAAU;IAAgB;;;EAE7B,aAAa;IACZ;IACA;IACA,QAAQ;IACR;MACG;EACJ,GAAG,UAAU,sBACZ,OAAO,GACP,KAAK,MAAM,uBAAuB;EAEnC,IAAI,UAAU,sBACb,OAAO,GACP,KAAK,MAAM,uBAAuB;;;;;;iBAQpB,2BAA2B,mBAAmB,kBAAkB"}
|
package/dist/client/injected.js
CHANGED
|
@@ -2,7 +2,7 @@ import { WalletSdkError } from "../errors.js";
|
|
|
2
2
|
import { submitTransaction } from "../tx.js";
|
|
3
3
|
import { getAmadeusProvider } from "../types.js";
|
|
4
4
|
import { decodeApiKey } from "../crypto/apikey.js";
|
|
5
|
-
|
|
5
|
+
// src/client/injected.ts
|
|
6
6
|
/**
|
|
7
7
|
* A framework-agnostic dApp client over the injected `window.amadeus` provider
|
|
8
8
|
* (the browser extension). It wraps the raw provider with the ergonomics every
|
|
@@ -81,7 +81,6 @@ function createInjectedWalletClient(providerOverride) {
|
|
|
81
81
|
off: (event, cb) => requireProvider().off(event, cb)
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
//#endregion
|
|
85
84
|
export { createInjectedWalletClient };
|
|
86
85
|
|
|
87
86
|
//# sourceMappingURL=injected.js.map
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/constants.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Protocol constants for the Amadeus dApp <-> wallet connection layer.
|
|
4
3
|
*
|
|
@@ -85,6 +84,5 @@ declare const NETWORKS: readonly ["mainnet", "testnet", "custom"];
|
|
|
85
84
|
* wallet rejects non-https bridge URLs via `assertAllowedBridgeUrl`).
|
|
86
85
|
*/
|
|
87
86
|
declare const DEFAULT_BRIDGE_URL = "https://bridge.ama.one";
|
|
88
|
-
//#endregion
|
|
89
87
|
export { API_KEY_DST, CONNECT_DST, CONNECT_TRANSCRIPT_LABEL, DEFAULT_BRIDGE_URL, MAX_API_KEY_STRING_LENGTH, MAX_MESSAGE_LENGTH, MESSAGE_DST, NETWORKS, PROTOCOL_VERSION, PROVIDER_EVENTS, PROVIDER_GLOBAL, PUBLIC_KEY_BYTE_LENGTH, SEED_BYTE_LENGTH, SESSION_NONCE_BYTE_LENGTH, SESSION_PUBLIC_KEY_BYTE_LENGTH, SESSION_SECRET_KEY_BYTE_LENGTH, SIGNATURE_BYTE_LENGTH, TX_DST, WALLET_INITIALIZED_EVENT, WALLET_WINDOW_EVENTS };
|
|
90
88
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","names":[],"sources":["../src/constants.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":[],"sources":["../src/constants.ts"],"mappings":";;;;;;;;;;;;cAaa;;;;;;;cAQA;;;;;;cAOA;;;;;;;;cASA;;cAGA;cACA;cACA;;;;;;;cAQA;;;;;;cAOA;;cAGA;cACA;cACA;;cAGA;;cAGA;;cAGA;;;;;;cAOA;;cAGA;;;;;;;;;cAUA;;cAUA;;;;;;cAOA"}
|
package/dist/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/constants.ts
|
|
2
2
|
/**
|
|
3
3
|
* Protocol constants for the Amadeus dApp <-> wallet connection layer.
|
|
4
4
|
*
|
|
@@ -96,7 +96,6 @@ const NETWORKS = [
|
|
|
96
96
|
* wallet rejects non-https bridge URLs via `assertAllowedBridgeUrl`).
|
|
97
97
|
*/
|
|
98
98
|
const DEFAULT_BRIDGE_URL = "https://bridge.ama.one";
|
|
99
|
-
//#endregion
|
|
100
99
|
export { API_KEY_DST, CONNECT_DST, CONNECT_TRANSCRIPT_LABEL, DEFAULT_BRIDGE_URL, MAX_API_KEY_STRING_LENGTH, MAX_MESSAGE_LENGTH, MESSAGE_DST, NETWORKS, PROTOCOL_VERSION, PROVIDER_EVENTS, PROVIDER_GLOBAL, PUBLIC_KEY_BYTE_LENGTH, SEED_BYTE_LENGTH, SESSION_NONCE_BYTE_LENGTH, SESSION_PUBLIC_KEY_BYTE_LENGTH, SESSION_SECRET_KEY_BYTE_LENGTH, SIGNATURE_BYTE_LENGTH, TX_DST, WALLET_INITIALIZED_EVENT, WALLET_WINDOW_EVENTS };
|
|
101
100
|
|
|
102
101
|
//# sourceMappingURL=constants.js.map
|
package/dist/crypto/apikey.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/crypto/apikey.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* BLS12-381 API-key bearer tokens — the ONE audited implementation, replacing
|
|
4
3
|
* the byte-identical copies currently hand-rolled in the wallet extension
|
|
@@ -67,6 +66,5 @@ type VerifyApiKeyResult = {
|
|
|
67
66
|
* result rather than throwing on the common "invalid" paths.
|
|
68
67
|
*/
|
|
69
68
|
declare function verifyApiKey(apiKey: string, options?: VerifyApiKeyOptions): VerifyApiKeyResult;
|
|
70
|
-
//#endregion
|
|
71
69
|
export { ApiKeyPayload, DecodedApiKey, GenerateApiKeyParams, GenerateApiKeyResult, VerifyApiKeyOptions, VerifyApiKeyResult, decodeApiKey, generateApiKey, verifyApiKey };
|
|
72
70
|
//# sourceMappingURL=apikey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apikey.d.ts","names":[],"sources":["../../src/crypto/apikey.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"apikey.d.ts","names":[],"sources":["../../src/crypto/apikey.ts"],"mappings":";;;;;;;;;;;;;;;;UA6BiB;EAChB;EACA;;UAGgB;;EAEhB;;EAEA;;EAEA;;EAEA;;UAGgB;EAChB;EACA,SAAS;;iBAGM,eAAe,QAAQ,uBAAuB;UAqB7C;EAChB,SAAS;EACT,WAAW;EACX,WAAW;;EAEX,WAAW;;EAEX;;;iBAIe,aAAa,iBAAiB;UAmD7B;;EAEhB;;EAEA;;EAEA;;KAGW;EACP;EAAa,SAAS;EAAe;;EACrC;EAAc;;;;;;;iBAOH,aACf,gBACA,UAAS,sBACP"}
|
package/dist/crypto/apikey.js
CHANGED
|
@@ -3,7 +3,7 @@ import { WalletSdkError } from "../errors.js";
|
|
|
3
3
|
import { bytesToUtf8, concatBytes, utf8ToBytes } from "../bytes.js";
|
|
4
4
|
import { deriveSigner, signHashed, verifyHashed } from "./bls.js";
|
|
5
5
|
import { fromBase58, toBase58 } from "@amadeus-protocol/sdk";
|
|
6
|
-
|
|
6
|
+
// src/crypto/apikey.ts
|
|
7
7
|
/**
|
|
8
8
|
* BLS12-381 API-key bearer tokens — the ONE audited implementation, replacing
|
|
9
9
|
* the byte-identical copies currently hand-rolled in the wallet extension
|
|
@@ -106,7 +106,6 @@ function verifyApiKey(apiKey, options = {}) {
|
|
|
106
106
|
address: decoded.address
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
//#endregion
|
|
110
109
|
export { decodeApiKey, generateApiKey, verifyApiKey };
|
|
111
110
|
|
|
112
111
|
//# sourceMappingURL=apikey.js.map
|
package/dist/crypto/bls.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/crypto/bls.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Low-level BLS12-381 signing primitives, mirroring the exact recipe used by
|
|
4
3
|
* `@amadeus-protocol/sdk` (`signing.ts`) and the wallet extension: hash the
|
|
@@ -26,6 +25,5 @@ declare function verifyHashed(signature: Uint8Array, payload: Uint8Array, public
|
|
|
26
25
|
declare function publicKeyFromAddress(address: string): Uint8Array;
|
|
27
26
|
/** Decode a Base58 signature into its 96 raw bytes, validating length. */
|
|
28
27
|
declare function signatureFromBase58(signature: string): Uint8Array;
|
|
29
|
-
//#endregion
|
|
30
28
|
export { SignerKeys, deriveSigner, publicKeyFromAddress, signHashed, signatureFromBase58, verifyHashed };
|
|
31
29
|
//# sourceMappingURL=bls.d.ts.map
|
package/dist/crypto/bls.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bls.d.ts","names":[],"sources":["../../src/crypto/bls.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bls.d.ts","names":[],"sources":["../../src/crypto/bls.ts"],"mappings":";;;;;;;;UAgBiB;;EAEhB,IAAI;;EAEJ,IAAI;;;iBAIW,aAAa,qBAAqB;;;;;iBAUlC,WAAW,SAAS,YAAY,IAAI,YAAY,cAAc;;iBAM9D,aACf,WAAW,YACX,SAAS,YACT,WAAW,YACX;;iBAWe,qBAAqB,kBAAkB;;iBAiBvC,oBAAoB,oBAAoB"}
|
package/dist/crypto/bls.js
CHANGED
|
@@ -3,7 +3,7 @@ import { WalletSdkError } from "../errors.js";
|
|
|
3
3
|
import { deriveSkAndSeed64FromBase58Seed, fromBase58, getPublicKey } from "@amadeus-protocol/sdk";
|
|
4
4
|
import { bls12_381 } from "@noble/curves/bls12-381";
|
|
5
5
|
import { sha256 } from "@noble/hashes/sha2";
|
|
6
|
-
|
|
6
|
+
// src/crypto/bls.ts
|
|
7
7
|
/**
|
|
8
8
|
* Low-level BLS12-381 signing primitives, mirroring the exact recipe used by
|
|
9
9
|
* `@amadeus-protocol/sdk` (`signing.ts`) and the wallet extension: hash the
|
|
@@ -59,7 +59,6 @@ function signatureFromBase58(signature) {
|
|
|
59
59
|
if (sig.length !== 96) throw new WalletSdkError("INVALID_SIGNATURE", `signature must be 96 bytes, got ${sig.length}`);
|
|
60
60
|
return sig;
|
|
61
61
|
}
|
|
62
|
-
//#endregion
|
|
63
62
|
export { deriveSigner, publicKeyFromAddress, signHashed, signatureFromBase58, verifyHashed };
|
|
64
63
|
|
|
65
64
|
//# sourceMappingURL=bls.js.map
|
package/dist/crypto/box.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/crypto/box.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* End-to-end encrypted session channel for cross-device transports (QR / bridge).
|
|
4
3
|
*
|
|
@@ -38,6 +37,5 @@ declare function seal(sharedKey: Uint8Array, plaintext: Uint8Array, aad?: Uint8A
|
|
|
38
37
|
* i.e. it fails closed.
|
|
39
38
|
*/
|
|
40
39
|
declare function open(sharedKey: Uint8Array, envelope: SealedEnvelope, aad?: Uint8Array): Uint8Array;
|
|
41
|
-
//#endregion
|
|
42
40
|
export { SealedEnvelope, SessionKeypair, deriveSharedKey, generateSessionKeypair, open, seal };
|
|
43
41
|
//# sourceMappingURL=box.d.ts.map
|
package/dist/crypto/box.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.d.ts","names":[],"sources":["../../src/crypto/box.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"box.d.ts","names":[],"sources":["../../src/crypto/box.ts"],"mappings":";;;;;;;;;;;;UA0BiB;;EAEhB;;EAEA,WAAW;;;iBAII,0BAA0B;;;;;iBAU1B,gBAAgB,8BAA8B,aAAa,aAAa;UAyBvE;;EAEhB;;EAEA;;;iBAIe,KACf,WAAW,YACX,WAAW,YACX,MAAM,aACJ;;;;;;iBAWa,KACf,WAAW,YACX,UAAU,gBACV,MAAM,aACJ"}
|
package/dist/crypto/box.js
CHANGED
|
@@ -5,7 +5,7 @@ import { fromBase58, toBase58 } from "@amadeus-protocol/sdk";
|
|
|
5
5
|
import { sha256 } from "@noble/hashes/sha2";
|
|
6
6
|
import { xchacha20poly1305 } from "@noble/ciphers/chacha.js";
|
|
7
7
|
import { x25519 } from "@noble/curves/ed25519";
|
|
8
|
-
|
|
8
|
+
// src/crypto/box.ts
|
|
9
9
|
/**
|
|
10
10
|
* End-to-end encrypted session channel for cross-device transports (QR / bridge).
|
|
11
11
|
*
|
|
@@ -77,7 +77,6 @@ function open(sharedKey, envelope, aad) {
|
|
|
77
77
|
throw new WalletSdkError("DECRYPT_FAILED", "authentication failed (wrong key or tampered)");
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
//#endregion
|
|
81
80
|
export { deriveSharedKey, generateSessionKeypair, open, seal };
|
|
82
81
|
|
|
83
82
|
//# sourceMappingURL=box.js.map
|
package/dist/crypto/connect.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/crypto/connect.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Connection-auth signatures. When a dApp asks the wallet to connect, it must
|
|
4
3
|
* prove control of its address. The wallet signs a TRANSCRIPT that binds the
|
|
@@ -54,6 +53,5 @@ interface VerifyConnectParams {
|
|
|
54
53
|
* Never throws — returns false on any malformed input or verification failure.
|
|
55
54
|
*/
|
|
56
55
|
declare function verifyConnect(params: VerifyConnectParams): boolean;
|
|
57
|
-
//#endregion
|
|
58
56
|
export { ConnectTranscript, SignConnectParams, VerifyConnectParams, buildConnectTranscript, signConnect, verifyConnect };
|
|
59
57
|
//# sourceMappingURL=connect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","names":[],"sources":["../../src/crypto/connect.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"connect.d.ts","names":[],"sources":["../../src/crypto/connect.ts"],"mappings":";;;;;;;;;;;;;;;UA4BiB;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;;;;;iBAWe,uBAAuB,YAAY,oBAAoB;UAiBtD;;EAEhB;EACA,YAAY;;;iBAIG,YAAY,QAAQ;UAMnB;;EAEhB;EACA,YAAY;;EAEZ;;;;;;iBAOe,cAAc,QAAQ"}
|
package/dist/crypto/connect.js
CHANGED
|
@@ -2,7 +2,7 @@ import { CONNECT_DST, CONNECT_TRANSCRIPT_LABEL } from "../constants.js";
|
|
|
2
2
|
import { concatBytes, u32be, utf8ToBytes } from "../bytes.js";
|
|
3
3
|
import { deriveSigner, publicKeyFromAddress, signHashed, signatureFromBase58, verifyHashed } from "./bls.js";
|
|
4
4
|
import { toBase58 } from "@amadeus-protocol/sdk";
|
|
5
|
-
|
|
5
|
+
// src/crypto/connect.ts
|
|
6
6
|
/**
|
|
7
7
|
* Connection-auth signatures. When a dApp asks the wallet to connect, it must
|
|
8
8
|
* prove control of its address. The wallet signs a TRANSCRIPT that binds the
|
|
@@ -67,7 +67,6 @@ function verifyConnect(params) {
|
|
|
67
67
|
}
|
|
68
68
|
return verifyHashed(signature, buildConnectTranscript(params.transcript), publicKey, CONNECT_DST);
|
|
69
69
|
}
|
|
70
|
-
//#endregion
|
|
71
70
|
export { buildConnectTranscript, signConnect, verifyConnect };
|
|
72
71
|
|
|
73
72
|
//# sourceMappingURL=connect.js.map
|
package/dist/crypto/message.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/crypto/message.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Arbitrary-message signing ("personal sign") — the wallet proves control of an
|
|
4
3
|
* account over a human-readable string (a login challenge, a terms acceptance, a
|
|
@@ -42,6 +41,5 @@ interface VerifyMessageParams {
|
|
|
42
41
|
* input (bad Base58, wrong length, over-long message) returns `false`.
|
|
43
42
|
*/
|
|
44
43
|
declare function verifyMessage(params: VerifyMessageParams): boolean;
|
|
45
|
-
//#endregion
|
|
46
44
|
export { SignMessageParams, SignMessageResult, VerifyMessageParams, signMessage, verifyMessage };
|
|
47
45
|
//# sourceMappingURL=message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","names":[],"sources":["../../src/crypto/message.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"message.d.ts","names":[],"sources":["../../src/crypto/message.ts"],"mappings":";;;;;;;;;;;;;;UAsBiB;;EAEhB;;EAEA;;UAGgB;;EAEhB;;EAEA;;EAEA;;;iBAiBe,YAAY,QAAQ,oBAAoB;UAOvC;;EAEhB;;EAEA;;EAEA;;;;;;iBAOe,cAAc,QAAQ"}
|
package/dist/crypto/message.js
CHANGED
|
@@ -3,7 +3,7 @@ import { WalletSdkError } from "../errors.js";
|
|
|
3
3
|
import { utf8ToBytes } from "../bytes.js";
|
|
4
4
|
import { deriveSigner, publicKeyFromAddress, signHashed, signatureFromBase58, verifyHashed } from "./bls.js";
|
|
5
5
|
import { toBase58 } from "@amadeus-protocol/sdk";
|
|
6
|
-
|
|
6
|
+
// src/crypto/message.ts
|
|
7
7
|
/**
|
|
8
8
|
* Arbitrary-message signing ("personal sign") — the wallet proves control of an
|
|
9
9
|
* account over a human-readable string (a login challenge, a terms acceptance, a
|
|
@@ -48,7 +48,6 @@ function verifyMessage(params) {
|
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
//#endregion
|
|
52
51
|
export { signMessage, verifyMessage };
|
|
53
52
|
|
|
54
53
|
//# sourceMappingURL=message.js.map
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
//#region src/errors.d.ts
|
|
2
1
|
/** Stable error codes so callers can branch without string-matching messages. */
|
|
3
2
|
type WalletSdkErrorCode = 'INVALID_API_KEY' | 'BAD_SIGNATURE' | 'EXPIRED' | 'AUD_MISMATCH' | 'INVALID_ADDRESS' | 'INVALID_SIGNATURE' | 'INVALID_ARGUMENT' | 'SUBMIT_FAILED' | 'DECRYPT_FAILED';
|
|
4
3
|
declare class WalletSdkError extends Error {
|
|
5
4
|
readonly code: WalletSdkErrorCode;
|
|
6
5
|
constructor(code: WalletSdkErrorCode, message: string);
|
|
7
6
|
}
|
|
8
|
-
//#endregion
|
|
9
7
|
export { WalletSdkError, WalletSdkErrorCode };
|
|
10
8
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","names":[],"sources":["../src/errors.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.d.ts","names":[],"sources":["../src/errors.ts"],"mappings":";KACY;cAWC,uBAAuB;WAC1B,MAAM;EAEH,YAAA,MAAM,oBAAoB"}
|
package/dist/errors.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/errors.ts
|
|
2
2
|
var WalletSdkError = class WalletSdkError extends Error {
|
|
3
3
|
code;
|
|
4
4
|
constructor(code, message) {
|
|
@@ -8,7 +8,6 @@ var WalletSdkError = class WalletSdkError extends Error {
|
|
|
8
8
|
Object.setPrototypeOf(this, WalletSdkError.prototype);
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { WalletSdkError };
|
|
13
12
|
|
|
14
13
|
//# sourceMappingURL=errors.js.map
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SignTransactionRequest, SignTransactionResponse } from "../types.js";
|
|
2
2
|
import { WalletClient } from "../client/injected.js";
|
|
3
|
-
//#region src/react/index.d.ts
|
|
4
3
|
type WalletStatus = 'unavailable' | 'disconnected' | 'connecting' | 'connected';
|
|
5
4
|
interface UseWalletResult {
|
|
6
5
|
client: WalletClient;
|
|
@@ -15,6 +14,5 @@ interface UseWalletResult {
|
|
|
15
14
|
ensureApiKey: WalletClient['ensureApiKey'];
|
|
16
15
|
}
|
|
17
16
|
declare function useWallet(): UseWalletResult;
|
|
18
|
-
//#endregion
|
|
19
17
|
export { UseWalletResult, WalletStatus, useWallet };
|
|
20
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/react/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/react/index.ts"],"mappings":";;KAoBY;UAEK;EAChB,QAAQ;EACR,QAAQ;EACR;EACA;EACA;EACA,eAAe;EACf;EACA,kBAAkB,SAAS,2BAA2B,QAAQ;EAC9D,eAAe;EACf,cAAc;;iBAGC,aAAa"}
|
package/dist/react/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WALLET_INITIALIZED_EVENT } from "../constants.js";
|
|
2
2
|
import { createInjectedWalletClient } from "../client/injected.js";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
|
-
|
|
4
|
+
// src/react/index.ts
|
|
5
5
|
/**
|
|
6
6
|
* React ergonomics for dApps: a single `useWallet()` hook over the injected
|
|
7
7
|
* provider client. It fixes the `amadeus#initialized` vs `amadeus-wallet#initialized`
|
|
@@ -89,7 +89,6 @@ function useWallet() {
|
|
|
89
89
|
ensureApiKey: client.ensureApiKey
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
//#endregion
|
|
93
92
|
export { useWallet };
|
|
94
93
|
|
|
95
94
|
//# sourceMappingURL=index.js.map
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/schema.d.ts
|
|
3
2
|
/** http(s) origin, matching the extension's `originSchema`. */
|
|
4
3
|
declare const originSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
5
4
|
/** A Base58 string that decodes to a 48-byte Amadeus public key / address. */
|
|
@@ -67,6 +66,5 @@ type SignTransactionRequestInput = z.infer<typeof signTransactionRequestSchema>;
|
|
|
67
66
|
type GenerateApiKeyRequestInput = z.infer<typeof generateApiKeyRequestSchema>;
|
|
68
67
|
type SignMessageRequestInput = z.infer<typeof signMessageRequestSchema>;
|
|
69
68
|
type ConnectTranscriptInput = z.infer<typeof connectTranscriptSchema>;
|
|
70
|
-
//#endregion
|
|
71
69
|
export { ConnectTranscriptInput, GenerateApiKeyRequestInput, SignMessageRequestInput, SignTransactionRequestInput, addressSchema, connectTranscriptSchema, generateApiKeyRequestSchema, networkSchema, originSchema, sessionPublicKeySchema, signMessageRequestSchema, signTransactionRequestSchema };
|
|
72
70
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","names":[],"sources":["../src/schema.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../src/schema.ts"],"mappings":";;cAiCa,cAAY,EAAA,WAAA,EAAA;;cAKZ,eAAa,EAAA,WAAA,EAAA;;cAGb,wBAAsB,EAAA,WAAA,EAAA;cAKtB,eAAa,EAAA;;cAGb,8BAA4B,EAAA;;;;;;;;;;;;;;;;;cAQ5B,6BAA2B,EAAA;;;;;;;;;;;cAM3B,0BAAwB,EAAA;;;;;;;;cAKxB,yBAAuB,EAAA;;;;;;;;;;;;;;;;;;;KAQxB,8BAA8B,EAAE,aAAa;KAC7C,6BAA6B,EAAE,aAAa;KAC5C,0BAA0B,EAAE,aAAa;KACzC,yBAAyB,EAAE,aAAa"}
|
package/dist/schema.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MAX_MESSAGE_LENGTH, NETWORKS } from "./constants.js";
|
|
2
2
|
import { fromBase58 } from "@amadeus-protocol/sdk";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
|
|
4
|
+
// src/schema.ts
|
|
5
5
|
/**
|
|
6
6
|
* Runtime validation for untrusted wire input (deep links, QR payloads, bridge
|
|
7
7
|
* frames, cross-origin messages). Validate BEFORE any request is shown for
|
|
@@ -48,7 +48,6 @@ const connectTranscriptSchema = z.object({
|
|
|
48
48
|
challenge: z.string().min(1),
|
|
49
49
|
requestId: z.string().min(1)
|
|
50
50
|
});
|
|
51
|
-
//#endregion
|
|
52
51
|
export { addressSchema, connectTranscriptSchema, generateApiKeyRequestSchema, networkSchema, originSchema, sessionPublicKeySchema, signMessageRequestSchema, signTransactionRequestSchema };
|
|
53
52
|
|
|
54
53
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/transport/bridge.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Client for the cross-device relay ("bridge"). After the connect handshake both
|
|
4
3
|
* sides hold a shared key; from it they derive TWO SECRET channel ids (one per
|
|
@@ -77,6 +76,5 @@ declare class BridgeClient {
|
|
|
77
76
|
*/
|
|
78
77
|
start(onFrame: (frame: BridgeFrame) => void | Promise<void>, onError?: (error: unknown) => void): () => void;
|
|
79
78
|
}
|
|
80
|
-
//#endregion
|
|
81
79
|
export { BridgeClient, BridgeClientOptions, BridgeFrame, assertAllowedBridgeUrl, deriveBridgeChannels, deriveConnectChannel };
|
|
82
80
|
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","names":[],"sources":["../../src/transport/bridge.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","names":[],"sources":["../../src/transport/bridge.ts"],"mappings":";;;;;;;;;;;;UAsBiB;;EAEhB;;EAEA;;EAEA;;;;;;;EAOA;;;;;;iBAOe,qBAAqB,WAAW;;EAE/C;;EAEA;;;;;;;;;iBAgBe,qBAAqB;;;;;;iBAarB,uBAAuB;UAetB;;EAEhB;;EAEA;;EAEA,mBAAmB;;EAEnB;;cAGY;mBACK;mBACA;mBACA;mBACA;EAEL,YAAA,SAAS;;EAaf,KAAK,YAAY,YAAY,mBAAmB;;;;;;;;EAmBtD,MACC,UAAU,OAAO,uBAAuB,eACxC,WAAW"}
|
package/dist/transport/bridge.js
CHANGED
|
@@ -2,7 +2,7 @@ import { WalletSdkError } from "../errors.js";
|
|
|
2
2
|
import { concatBytes, utf8ToBytes } from "../bytes.js";
|
|
3
3
|
import { fromBase58, toBase58 } from "@amadeus-protocol/sdk";
|
|
4
4
|
import { sha256 } from "@noble/hashes/sha2";
|
|
5
|
-
|
|
5
|
+
// src/transport/bridge.ts
|
|
6
6
|
/**
|
|
7
7
|
* Client for the cross-device relay ("bridge"). After the connect handshake both
|
|
8
8
|
* sides hold a shared key; from it they derive TWO SECRET channel ids (one per
|
|
@@ -119,7 +119,6 @@ var BridgeClient = class {
|
|
|
119
119
|
return () => controller.abort();
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
|
-
//#endregion
|
|
123
122
|
export { BridgeClient, assertAllowedBridgeUrl, deriveBridgeChannels, deriveConnectChannel };
|
|
124
123
|
|
|
125
124
|
//# sourceMappingURL=bridge.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SealedEnvelope } from "../crypto/box.js";
|
|
2
|
-
//#region src/transport/envelope.d.ts
|
|
3
2
|
declare const WALLET_METHODS: readonly ["amadeus_signTransaction", "amadeus_signMessage", "amadeus_getAccounts", "amadeus_generateApiKey", "amadeus_switchNetwork"];
|
|
4
3
|
type WalletMethod = (typeof WALLET_METHODS)[number];
|
|
5
4
|
interface WalletRequest {
|
|
@@ -75,6 +74,5 @@ declare function createMemorySeenStore(maxEntries?: number): SeenStore;
|
|
|
75
74
|
* Throws `EXPIRED` or `INVALID_ARGUMENT` (duplicate).
|
|
76
75
|
*/
|
|
77
76
|
declare function guardRequest(request: WalletRequest, store: SeenStore, now?: number): void;
|
|
78
|
-
//#endregion
|
|
79
77
|
export { SeenStore, WALLET_METHODS, WalletMethod, WalletRequest, WalletResponse, createMemorySeenStore, guardRequest, makeRequest, openRequest, openResponse, sealRequest, sealResponse };
|
|
80
78
|
//# sourceMappingURL=envelope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.d.ts","names":[],"sources":["../../src/transport/envelope.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"envelope.d.ts","names":[],"sources":["../../src/transport/envelope.ts"],"mappings":";cAiBa;KAQD,uBAAuB;UAElB;;EAEhB;;EAEA;EACA,QAAQ;;EAER;EACA;;EAEA;;;;;;EAMA;;KAGW;EACP;EAAW;EAAY;EAAU;;EACjC;EAAW;EAAY;EAAW;IAAS;IAAc;;;;iBA4B9C,YAAY;EAC3B;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA;IACG;iBAaY,YAAY,WAAW,YAAY,SAAS,gBAAgB;;;;;;;iBAU5D,YAAY,WAAW,YAAY,UAAU,iBAAiB;iBAe9D,aAAa,WAAW,YAAY,UAAU,iBAAiB;;;;;iBAQ/D,aACf,WAAW,YACX,UAAU,gBACV,sBACE;;;;;;;UAyBc;EAChB,IAAI;EACJ,IAAI;;iBAGW,sBAAsB,sBAAsB;;;;;;iBAgB5C,aAAa,SAAS,eAAe,OAAO,WAAW"}
|
|
@@ -3,7 +3,7 @@ import { WalletSdkError } from "../errors.js";
|
|
|
3
3
|
import { bytesToUtf8, utf8ToBytes } from "../bytes.js";
|
|
4
4
|
import { open, seal } from "../crypto/box.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
|
|
6
|
+
// src/transport/envelope.ts
|
|
7
7
|
/**
|
|
8
8
|
* The encrypted request/response envelope that flows over ANY transport (deep
|
|
9
9
|
* link, QR, or the cross-device bridge). Post-connect, both sides hold the x25519
|
|
@@ -119,7 +119,6 @@ function guardRequest(request, store, now) {
|
|
|
119
119
|
if (store.has(request.id)) throw new WalletSdkError("INVALID_ARGUMENT", "duplicate request id (replay)");
|
|
120
120
|
store.add(request.id);
|
|
121
121
|
}
|
|
122
|
-
//#endregion
|
|
123
122
|
export { WALLET_METHODS, createMemorySeenStore, guardRequest, makeRequest, openRequest, openResponse, sealRequest, sealResponse };
|
|
124
123
|
|
|
125
124
|
//# sourceMappingURL=envelope.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { SessionKeypair } from "../crypto/box.js";
|
|
2
2
|
import { ConnectRequestParams, ConnectResponseParams } from "./uri.js";
|
|
3
|
-
//#region src/transport/session.d.ts
|
|
4
3
|
/** State the dApp keeps locally between issuing a connect request and completing it. */
|
|
5
4
|
interface PendingConnect {
|
|
6
5
|
requestId: string;
|
|
@@ -65,6 +64,5 @@ declare function approveConnect(request: ConnectRequestParams, options: {
|
|
|
65
64
|
}): WalletSession;
|
|
66
65
|
/** Whether a parsed connect request has expired (wallet should reject/re-park). */
|
|
67
66
|
declare function isConnectRequestExpired(request: ConnectRequestParams, now?: number): boolean;
|
|
68
|
-
//#endregion
|
|
69
67
|
export { EstablishedSession, PendingConnect, WalletSession, approveConnect, completeConnect, createConnectRequest, isConnectRequestExpired };
|
|
70
68
|
//# sourceMappingURL=session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","names":[],"sources":["../../src/transport/session.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"session.d.ts","names":[],"sources":["../../src/transport/session.ts"],"mappings":";;;UA6BiB;EAChB;EACA;EACA;;EAEA,aAAa;EACb;EACA;;UAGgB;;EAEhB;;EAEA,WAAW;;EAEX;;EAEA;EACA;;EAEA;;;iBAIe,qBAAqB;EACpC;EACA;EACA;EACA;EACA;;EACK;EAAa,SAAS;;;;;;;iBAoCZ,gBACf,SAAS,gBACT,UAAU,wBACR;UA4Bc;;EAEhB,UAAU;;EAEV,WAAW;;EAEX,eAAe;;EAEf;;EAEA;;;;;;;;iBASe,eACf,SAAS,sBACT;EAAW;EAAc;IACvB;;iBA4Ba,wBAAwB,SAAS,sBAAsB"}
|
|
@@ -5,7 +5,7 @@ import { signConnect, verifyConnect } from "../crypto/connect.js";
|
|
|
5
5
|
import { deriveSharedKey, generateSessionKeypair } from "../crypto/box.js";
|
|
6
6
|
import { buildConnectUri } from "./uri.js";
|
|
7
7
|
import { toBase58 } from "@amadeus-protocol/sdk";
|
|
8
|
-
|
|
8
|
+
// src/transport/session.ts
|
|
9
9
|
/**
|
|
10
10
|
* The connect handshake, orchestrated for both sides. This is where the crypto
|
|
11
11
|
* primitives (connect transcript signing + x25519 box) and the URI transport
|
|
@@ -116,7 +116,6 @@ function approveConnect(request, options) {
|
|
|
116
116
|
function isConnectRequestExpired(request, now) {
|
|
117
117
|
return request.exp <= Math.floor((now ?? Date.now()) / 1e3);
|
|
118
118
|
}
|
|
119
|
-
//#endregion
|
|
120
119
|
export { approveConnect, completeConnect, createConnectRequest, isConnectRequestExpired };
|
|
121
120
|
|
|
122
121
|
//# sourceMappingURL=session.js.map
|
package/dist/transport/uri.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/transport/uri.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Deep-link / QR URI construction and parsing for the connect handshake.
|
|
4
3
|
*
|
|
@@ -44,6 +43,5 @@ declare function parseConnectUri(uri: string): ConnectRequestParams;
|
|
|
44
43
|
declare function buildConnectResponseUri(redirectLink: string, response: ConnectResponseParams): string;
|
|
45
44
|
/** Parse a connect response from a callback URL's query string. */
|
|
46
45
|
declare function parseConnectResponseUri(uri: string): ConnectResponseParams;
|
|
47
|
-
//#endregion
|
|
48
46
|
export { ConnectRequestParams, ConnectResponseParams, URI_SCHEME, buildConnectResponseUri, buildConnectUri, parseConnectResponseUri, parseConnectUri };
|
|
49
47
|
//# sourceMappingURL=uri.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uri.d.ts","names":[],"sources":["../../src/transport/uri.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"uri.d.ts","names":[],"sources":["../../src/transport/uri.ts"],"mappings":";;;;;;;;;;;cAea;UAEI;EAChB;;EAEA;EACA;EACA;;EAEA;;EAEA;;EAEA;;UAGgB;EAChB;EACA;;EAEA;;EAEA;;;iBAsCe,gBAAgB,QAAQ;;iBAcxB,gBAAgB,cAAc;;;;;;iBA6B9B,wBACf,sBACA,UAAU;;iBAaK,wBAAwB,cAAc"}
|
package/dist/transport/uri.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../constants.js";
|
|
2
2
|
import { WalletSdkError } from "../errors.js";
|
|
3
|
-
|
|
3
|
+
// src/transport/uri.ts
|
|
4
4
|
/**
|
|
5
5
|
* Deep-link / QR URI construction and parsing for the connect handshake.
|
|
6
6
|
*
|
|
@@ -95,7 +95,6 @@ function parseConnectResponseUri(uri) {
|
|
|
95
95
|
signature: q.sig
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
//#endregion
|
|
99
98
|
export { URI_SCHEME, buildConnectResponseUri, buildConnectUri, parseConnectResponseUri, parseConnectUri };
|
|
100
99
|
|
|
101
100
|
//# sourceMappingURL=uri.js.map
|
package/dist/tx.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { NetworkType } from "@amadeus-protocol/sdk";
|
|
2
|
-
//#region src/tx.d.ts
|
|
3
2
|
interface SignTransactionParams {
|
|
4
3
|
/** Base58 wallet seed (private key). */
|
|
5
4
|
seed: string;
|
|
@@ -31,6 +30,5 @@ interface SubmitTransactionOptions {
|
|
|
31
30
|
* dApps do today. Returns the parsed JSON body when possible, else raw text.
|
|
32
31
|
*/
|
|
33
32
|
declare function submitTransaction(txPacked: number[] | Uint8Array, options: SubmitTransactionOptions): Promise<unknown>;
|
|
34
|
-
//#endregion
|
|
35
33
|
export { SignTransactionParams, SignedTransaction, SubmitTransactionOptions, signTransaction, submitTransaction };
|
|
36
34
|
//# sourceMappingURL=tx.d.ts.map
|
package/dist/tx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx.d.ts","names":[],"sources":["../src/tx.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tx.d.ts","names":[],"sources":["../src/tx.ts"],"mappings":";UAqBiB;;EAEhB;EACA;EACA;;EAEA;EACA;;EAEA,UAAU;;UAGM;;EAEhB;;EAEA;;iBAGe,gBAAgB,QAAQ,wBAAwB;UA0B/C;;EAEhB;;EAEA;;EAEA;;;;;;iBAOqB,kBACrB,qBAAqB,YACrB,SAAS,2BACP"}
|
package/dist/tx.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WalletSdkError } from "./errors.js";
|
|
2
2
|
import { decodeBinaryValues } from "./binary.js";
|
|
3
3
|
import { fromBase58, signContractCall } from "@amadeus-protocol/sdk";
|
|
4
|
-
|
|
4
|
+
// src/tx.ts
|
|
5
5
|
/**
|
|
6
6
|
* Transaction signing + submission.
|
|
7
7
|
*
|
|
@@ -59,7 +59,6 @@ async function submitTransaction(txPacked, options) {
|
|
|
59
59
|
clearTimeout(timer);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
//#endregion
|
|
63
62
|
export { signTransaction, submitTransaction };
|
|
64
63
|
|
|
65
64
|
//# sourceMappingURL=tx.js.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { NETWORKS, PROVIDER_EVENTS } from "./constants.js";
|
|
2
|
-
//#region src/types.d.ts
|
|
3
2
|
type AmadeusNetwork = (typeof NETWORKS)[number];
|
|
4
3
|
type AmadeusProviderEvent = (typeof PROVIDER_EVENTS)[number];
|
|
5
4
|
interface SignTransactionRequest {
|
|
@@ -75,6 +74,5 @@ declare global {
|
|
|
75
74
|
declare function getAmadeusProvider(): AmadeusProvider | null;
|
|
76
75
|
/** Whether a genuine Amadeus provider is currently injected. */
|
|
77
76
|
declare function isProviderAvailable(): boolean;
|
|
78
|
-
//#endregion
|
|
79
77
|
export { AmadeusEventPayloadMap, AmadeusNetwork, AmadeusProvider, AmadeusProviderEvent, GenerateApiKeyRequest, GenerateApiKeyResponse, SignTransactionRequest, SignTransactionResponse, getAmadeusProvider, isProviderAvailable };
|
|
80
78
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";KASY,yBAAyB;KAEzB,+BAA+B;UAE1B;EAChB;EACA;EAEA;EACA;;UAGgB;EAChB;;EAEA;;UAGgB;EAChB;;EAEA;;UAGgB;EAChB;;;UAIgB;EAChB;IAAmB;IAAoB;IAA4B;;EACnE;IAAW;IAAoB;IAAiB;;EAChD;IAAc;IAAiB;;EAC/B;IAAQ;IAAiB;;EACzB;IAAU;IAAoB;IAAiB;;EAC/C;IAAkB;IAAiB;IAAyB;;;;;;;UAO5C;WACP;EACT,eAAe;EACf,cAAc;EACd,cAAc;EACd,mBAAmB;EACnB,qBAAqB,kBAAkB;EACvC,gBAAgB,QAAQ,yBAAyB,QAAQ;EACzD,eAAe,QAAQ,wBAAwB,QAAQ;EACvD,GAAG,UAAU,sBACZ,OAAO,GACP,WAAW,MAAM,uBAAuB;EAEzC,IAAI,UAAU,sBACb,OAAO,GACP,WAAW,MAAM,uBAAuB;;QAIlC;MACH,SAAS;;;iBAIE,sBAAsB;;iBAMtB"}
|
package/dist/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/types.ts
|
|
2
2
|
/** Return the injected provider if present and genuine, else null. Browser-only. */
|
|
3
3
|
function getAmadeusProvider() {
|
|
4
4
|
const candidate = globalThis.amadeus;
|
|
@@ -8,7 +8,6 @@ function getAmadeusProvider() {
|
|
|
8
8
|
function isProviderAvailable() {
|
|
9
9
|
return getAmadeusProvider() !== null;
|
|
10
10
|
}
|
|
11
|
-
//#endregion
|
|
12
11
|
export { getAmadeusProvider, isProviderAvailable };
|
|
13
12
|
|
|
14
13
|
//# sourceMappingURL=types.js.map
|
package/dist/wallet/handler.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { WalletRequest, WalletResponse } from "../transport/envelope.js";
|
|
2
2
|
import { NetworkType } from "@amadeus-protocol/sdk";
|
|
3
|
-
//#region src/wallet/handler.d.ts
|
|
4
3
|
interface WalletHandlerContext {
|
|
5
4
|
/** Seed (private key) of the account bound to this session. */
|
|
6
5
|
seed: string;
|
|
@@ -19,6 +18,5 @@ interface WalletHandlerContext {
|
|
|
19
18
|
* wallet runtime state), signalled with a distinct error the caller can branch on.
|
|
20
19
|
*/
|
|
21
20
|
declare function handleRequest(request: WalletRequest, ctx: WalletHandlerContext): WalletResponse;
|
|
22
|
-
//#endregion
|
|
23
21
|
export { WalletHandlerContext, handleRequest };
|
|
24
22
|
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","names":[],"sources":["../../src/wallet/handler.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"handler.d.ts","names":[],"sources":["../../src/wallet/handler.ts"],"mappings":";;UAyBiB;;EAEhB;;EAEA;;;;;EAKA,UAAU;;;;;;;;iBAmBK,cAAc,SAAS,eAAe,KAAK,uBAAuB"}
|
package/dist/wallet/handler.js
CHANGED
|
@@ -4,7 +4,7 @@ import { signTransaction } from "../tx.js";
|
|
|
4
4
|
import { generateApiKeyRequestSchema, signMessageRequestSchema, signTransactionRequestSchema } from "../schema.js";
|
|
5
5
|
import { generateApiKey } from "../crypto/apikey.js";
|
|
6
6
|
import { signMessage } from "../crypto/message.js";
|
|
7
|
-
|
|
7
|
+
// src/wallet/handler.ts
|
|
8
8
|
function ok(id, result) {
|
|
9
9
|
return {
|
|
10
10
|
v: 1,
|
|
@@ -73,7 +73,6 @@ function handleRequest(request, ctx) {
|
|
|
73
73
|
return fail(request.id, error);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
//#endregion
|
|
77
76
|
export { handleRequest };
|
|
78
77
|
|
|
79
78
|
//# sourceMappingURL=handler.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amadeus-protocol/wallet-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Shared dApp <-> wallet connection layer for Amadeus Protocol: BLS API-key tokens, transaction signing, message/connect signing, and the typed provider contract. One audited implementation for the wallet, the extension, and every dApp.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"zod": "^3.24.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
|
-
"@amadeus-protocol/sdk": "^1.
|
|
70
|
+
"@amadeus-protocol/sdk": "^1.3.0",
|
|
71
71
|
"react": ">=18.0.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependenciesMeta": {
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@amadeus-protocol/sdk": "^1.
|
|
79
|
+
"@amadeus-protocol/sdk": "^1.6.0",
|
|
80
80
|
"@eslint/js": "^9.21.0",
|
|
81
81
|
"@types/node": "^22.14.0",
|
|
82
82
|
"@types/react": "^19.0.0",
|