@bananalink-sdk/protocol 1.2.8 → 1.4.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/dist/{chunk-32OWUOZ3.js → chunk-KJ7QIHAY.js} +11 -7
- package/dist/chunk-KJ7QIHAY.js.map +1 -0
- package/dist/{chunk-VXLUSU5B.cjs → chunk-MUYKP6UQ.cjs} +63 -8
- package/dist/chunk-MUYKP6UQ.cjs.map +1 -0
- package/dist/{chunk-MCZG7QEM.cjs → chunk-NGPP7HUR.cjs} +11 -7
- package/dist/chunk-NGPP7HUR.cjs.map +1 -0
- package/dist/{chunk-LELPCIE7.js → chunk-OBJR2TL4.js} +54 -4
- package/dist/chunk-OBJR2TL4.js.map +1 -0
- package/dist/{chunk-KNGZKGRS.cjs → chunk-RZPN2GDJ.cjs} +13 -4
- package/dist/chunk-RZPN2GDJ.cjs.map +1 -0
- package/dist/{chunk-7KYDLL3B.js → chunk-XCMAKN3P.js} +13 -5
- package/dist/chunk-XCMAKN3P.js.map +1 -0
- package/dist/{client-session-claim-C4lUik3b.d.cts → client-session-claim-CkRKTG50.d.cts} +12 -2
- package/dist/{client-session-claim-3QF3noOr.d.ts → client-session-claim-CrIDASkZ.d.ts} +12 -2
- package/dist/crypto/providers/noble-provider.cjs +2 -3
- package/dist/crypto/providers/noble-provider.d.cts +0 -7
- package/dist/crypto/providers/noble-provider.d.ts +0 -7
- package/dist/crypto/providers/noble-provider.js +1 -2
- package/dist/crypto/providers/node-provider.cjs +7 -29
- package/dist/crypto/providers/node-provider.cjs.map +1 -1
- package/dist/crypto/providers/node-provider.d.cts +0 -7
- package/dist/crypto/providers/node-provider.d.ts +0 -7
- package/dist/crypto/providers/node-provider.js +7 -29
- package/dist/crypto/providers/node-provider.js.map +1 -1
- package/dist/crypto/providers/quickcrypto-provider.cjs +8 -46
- package/dist/crypto/providers/quickcrypto-provider.cjs.map +1 -1
- package/dist/crypto/providers/quickcrypto-provider.d.cts +0 -9
- package/dist/crypto/providers/quickcrypto-provider.d.ts +0 -9
- package/dist/crypto/providers/quickcrypto-provider.js +7 -45
- package/dist/crypto/providers/quickcrypto-provider.js.map +1 -1
- package/dist/crypto/providers/webcrypto-provider.cjs +0 -2
- package/dist/crypto/providers/webcrypto-provider.cjs.map +1 -1
- package/dist/crypto/providers/webcrypto-provider.d.cts +0 -7
- package/dist/crypto/providers/webcrypto-provider.d.ts +0 -7
- package/dist/crypto/providers/webcrypto-provider.js +0 -2
- package/dist/crypto/providers/webcrypto-provider.js.map +1 -1
- package/dist/{crypto-BUS06Qz-.d.cts → crypto-BK0Ile6V.d.cts} +1 -1
- package/dist/{crypto-BUS06Qz-.d.ts → crypto-BK0Ile6V.d.ts} +1 -1
- package/dist/crypto-export.cjs +50 -51
- package/dist/crypto-export.cjs.map +1 -1
- package/dist/crypto-export.d.cts +1 -1
- package/dist/crypto-export.d.ts +1 -1
- package/dist/crypto-export.js +2 -4
- package/dist/crypto-export.js.map +1 -1
- package/dist/index.cjs +8 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -4
- package/dist/index.d.ts +31 -4
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/schemas-export.cjs +76 -72
- package/dist/schemas-export.d.cts +116 -1
- package/dist/schemas-export.d.ts +116 -1
- package/dist/schemas-export.js +1 -1
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/validation-export.cjs +76 -72
- package/dist/validation-export.d.cts +1 -1
- package/dist/validation-export.d.ts +1 -1
- package/dist/validation-export.js +1 -1
- package/package.json +1 -1
- package/src/crypto/providers/noble-provider.ts +44 -49
- package/src/crypto/providers/node-provider.ts +18 -59
- package/src/crypto/providers/quickcrypto-provider.ts +25 -84
- package/src/crypto/providers/registry.ts +14 -9
- package/src/crypto/providers/webcrypto-provider.ts +28 -43
- package/src/index.ts +1 -0
- package/src/schemas/client-messages.ts +14 -0
- package/src/schemas/wallet-messages.ts +4 -0
- package/src/types/client-messages.ts +26 -1
- package/src/types/index.ts +9 -0
- package/src/types/persistence.ts +32 -0
- package/src/types/wallet-messages.ts +6 -2
- package/dist/chunk-32OWUOZ3.js.map +0 -1
- package/dist/chunk-7KYDLL3B.js.map +0 -1
- package/dist/chunk-A6FLEJ7R.cjs +0 -62
- package/dist/chunk-A6FLEJ7R.cjs.map +0 -1
- package/dist/chunk-KNGZKGRS.cjs.map +0 -1
- package/dist/chunk-LELPCIE7.js.map +0 -1
- package/dist/chunk-MCZG7QEM.cjs.map +0 -1
- package/dist/chunk-TCVKC227.js +0 -56
- package/dist/chunk-TCVKC227.js.map +0 -1
- package/dist/chunk-VXLUSU5B.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMUYKP6UQ_cjs = require('./chunk-MUYKP6UQ.cjs');
|
|
4
4
|
var chunkGI3BUPIH_cjs = require('./chunk-GI3BUPIH.cjs');
|
|
5
|
-
require('./chunk-A6FLEJ7R.cjs');
|
|
6
5
|
var chunkWGEGR3DF_cjs = require('./chunk-WGEGR3DF.cjs');
|
|
7
6
|
|
|
8
7
|
// src/types/wallet-messages.ts
|
|
@@ -48,6 +47,10 @@ function isCloseSessionPayload(payload) {
|
|
|
48
47
|
return payload?.type === "close_session";
|
|
49
48
|
}
|
|
50
49
|
chunkWGEGR3DF_cjs.__name(isCloseSessionPayload, "isCloseSessionPayload");
|
|
50
|
+
function isClientHandshakeMessage(message) {
|
|
51
|
+
return message?.type === "client_handshake";
|
|
52
|
+
}
|
|
53
|
+
chunkWGEGR3DF_cjs.__name(isClientHandshakeMessage, "isClientHandshakeMessage");
|
|
51
54
|
|
|
52
55
|
// src/types/relay-messages.ts
|
|
53
56
|
function isSessionClosedAck(message) {
|
|
@@ -479,7 +482,7 @@ chunkWGEGR3DF_cjs.__name(validateClientMessageEnvelope, "validateClientMessageEn
|
|
|
479
482
|
|
|
480
483
|
// src/utils/index.ts
|
|
481
484
|
function generateSessionId() {
|
|
482
|
-
return
|
|
485
|
+
return chunkMUYKP6UQ_cjs.generateUUID();
|
|
483
486
|
}
|
|
484
487
|
chunkWGEGR3DF_cjs.__name(generateSessionId, "generateSessionId");
|
|
485
488
|
function isValidProtocolVersion(version) {
|
|
@@ -494,7 +497,7 @@ chunkWGEGR3DF_cjs.__name(isValidSessionId, "isValidSessionId");
|
|
|
494
497
|
|
|
495
498
|
// package.json
|
|
496
499
|
var package_default = {
|
|
497
|
-
version: "1.
|
|
500
|
+
version: "1.4.0"};
|
|
498
501
|
|
|
499
502
|
// src/index.ts
|
|
500
503
|
var VERSION = package_default.version;
|
|
@@ -590,6 +593,7 @@ exports.encodeUrlParameter = encodeUrlParameter;
|
|
|
590
593
|
exports.generateSessionId = generateSessionId;
|
|
591
594
|
exports.isAuthenticateConnectionPayload = isAuthenticateConnectionPayload;
|
|
592
595
|
exports.isClaimSessionPayload = isClaimSessionPayload;
|
|
596
|
+
exports.isClientHandshakeMessage = isClientHandshakeMessage;
|
|
593
597
|
exports.isClientReconnectPayload = isClientReconnectPayload;
|
|
594
598
|
exports.isCloseSessionPayload = isCloseSessionPayload;
|
|
595
599
|
exports.isConnectionAuthenticatedMessage = isConnectionAuthenticatedMessage;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/wallet-messages.ts","../src/types/client-messages.ts","../src/types/relay-messages.ts","../src/utils/public-keys.ts","../src/utils/url-encoding.ts","../src/utils/url-decoding.ts","../src/utils/wallet-session-claim.ts","../src/utils/client-session-claim.ts","../src/utils/index.ts","../package.json","../src/index.ts"],"names":["__name","DEEPLINK_SCHEME","generateUUID"],"mappings":";;;;;;;;AAyNO,SAAS,sBAAsB,OAAA,EAA+D;AACnG,EAAA,OAAO,SAAS,IAAA,KAAS,eAAA;AAC3B;AAFgBA,wBAAA,CAAA,qBAAA,EAAA,uBAAA,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CAAA;;;ACpIT,SAAS,iBAAA,GAA4B;AAC1C,EAAA,OAAOE,8BAAA,EAAa;AACtB;AAFgBF,wBAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA;AAKT,SAAS,uBAAuB,OAAA,EAA0B;AAE/D,EAAA,OAAO,OAAA,KAAY,GAAA;AACrB;AAHgBA,wBAAA,CAAA,sBAAA,EAAA,wBAAA,CAAA;AAMT,SAAS,iBAAiB,SAAA,EAA4B;AAE3D,EAAA,MAAM,SAAA,GAAY,4EAAA;AAClB,EAAA,OAAO,SAAA,CAAU,KAAK,SAAS,CAAA;AACjC;AAJgBA,wBAAA,CAAA,gBAAA,EAAA,kBAAA,CAAA;;;AChChB,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,OAyIb,CAAA;;;ACvGO,IAAM,UAAU,eAAA,CAAY;AAC5B,IAAM,YAAA,GAAe","file":"index.cjs","sourcesContent":["/**\n * Wallet message types for BananaLink protocol v2.0\n * These types define the communication between wallets and the relay server\n */\n\nimport type { EncryptedPayload } from './discovery';\nimport type { DAppMetadata, SessionConfig } from './core';\nimport type { CloseSessionPayload } from './client-messages';\nimport type {\n RequestFulfilledPayload,\n RequestRejectedPayload,\n} from './post-auth-operations';\n\n/**\n * Wallet session claim credential for claiming and reconnection\n * NEVER forwarded to dApp - relay server only\n */\nexport interface WalletSessionClaim {\n /**\n * Unique nonce for this session claim\n * - Generated once by wallet when claiming session\n * - Stored locally by wallet for reconnection\n * - Used by relay to validate session ownership\n * - Different for each session (no cross-session tracking)\n */\n sessionNonce: string;\n\n /** Claim timestamp (used for replay attack prevention) */\n timestamp: number;\n}\n\n/**\n * Wallet message envelope structure\n * All wallet-to-relay messages use this envelope\n */\nexport interface WalletMessageEnvelope {\n /** Session identifier */\n sessionId: string;\n\n /** Wallet session claim credential - ONLY visible to relay server */\n walletSessionClaim: WalletSessionClaim;\n\n /** Actual message payload */\n payload: WalletMessagePayload;\n}\n\n/**\n * Claim session payload\n * Used to claim exclusive ownership of a session\n */\nexport interface ClaimSessionPayload {\n type: 'claim_session';\n /** Wallet's public key for ECDH key exchange in format \"algorithm:base64_public_key\" (e.g., \"AES-GCM:...\") */\n walletPublicKey: string;\n}\n\n/**\n * Prefetch metadata payload\n * Used to retrieve dApp metadata for user approval\n */\nexport interface PrefetchMetadataPayload {\n type: 'prefetch_metadata';\n}\n\n/**\n * Connection rejected payload\n * Notifies dApp that user rejected connection\n */\nexport interface ConnectionRejectedPayload {\n type: 'connection_rejected';\n encrypted: EncryptedPayload;\n}\n\n/**\n * Authenticate connection payload\n * Completes authentication with signed message\n */\nexport interface AuthenticateConnectionPayload {\n type: 'authenticate_connection';\n encrypted: EncryptedPayload;\n}\n\n/**\n * Wallet reconnect payload\n * Used to reconnect after network interruption\n */\nexport interface WalletReconnectPayload {\n type: 'wallet_reconnect';\n}\n\n/**\n * Union type for all wallet message payloads\n */\nexport type WalletMessagePayload =\n // Connection flow payloads\n | ClaimSessionPayload\n | PrefetchMetadataPayload\n | ConnectionRejectedPayload\n | AuthenticateConnectionPayload\n | WalletReconnectPayload\n | CloseSessionPayload\n // Post-authentication operation payloads (v2.1+)\n | RequestFulfilledPayload\n | RequestRejectedPayload;\n\n/**\n * Decrypted rejection data (visible only to dApp after decryption)\n */\nexport interface RejectionData {\n reason?: string;\n timestamp: number;\n}\n\n/**\n * Decrypted authentication data (visible only to dApp after decryption)\n */\nexport interface AuthenticationData {\n /** Wallet address */\n address: string;\n\n /** Signature of the SIWE message */\n signature: string;\n\n /** Full SIWE message that was signed */\n message: string;\n\n /** Chain ID (EIP-155) */\n chainId: number;\n\n /** Network identifier (e.g., \"ethereum\", \"polygon\") */\n network?: string;\n\n /** Signing algorithm (e.g., \"ECDSA\", \"EdDSA\") */\n signingAlgo?: string;\n\n /** Optional wallet metadata */\n walletMetadata?: WalletMetadata;\n}\n\n/**\n * Wallet metadata\n */\nexport interface WalletMetadata {\n /** Wallet name */\n name: string;\n\n /** Wallet version */\n version?: string;\n\n /** Wallet icon URL */\n icon?: string;\n\n /** Wallet description */\n description?: string;\n\n /** Wallet website URL */\n url?: string;\n\n /** Wallet provider type */\n provider?: string;\n}\n\n/**\n * Messages sent from relay to dApp (session claim stripped)\n */\n\n/**\n * Wallet handshake message\n * Initiates cryptographic handshake by sharing wallet's public key\n * and notifying dApp that wallet is reviewing connection\n */\nexport interface WalletHandshakeMessage {\n type: 'wallet_handshake';\n status: 'reviewing';\n /** Wallet's public key in format \"algorithm:base64_public_key\" (e.g., \"AES-GCM:...\") */\n walletPublicKey: string;\n timestamp: number;\n}\n\n/**\n * Connection rejected message\n * Forwards rejection to dApp (encrypted)\n */\nexport interface ConnectionRejectedMessage {\n type: 'connection_rejected';\n encrypted: EncryptedPayload;\n}\n\n/**\n * Connection authenticated message\n * Forwards authentication data to dApp (encrypted)\n */\nexport interface ConnectionAuthenticatedMessage {\n type: 'connection_authenticated';\n encrypted: EncryptedPayload;\n}\n\n/**\n * Prefetch metadata response\n * Returns dApp metadata to wallet\n */\nexport interface PrefetchMetadataResponse {\n dappMetadata: DAppMetadata;\n sessionConfig?: SessionConfig;\n}\n\n/**\n * Union type for relay-to-dApp messages\n */\nexport type RelayToDAppMessage =\n | WalletHandshakeMessage\n | ConnectionRejectedMessage\n | ConnectionAuthenticatedMessage;\n\n/**\n * Type guards for wallet messages\n */\nexport function isClaimSessionPayload(payload: WalletMessagePayload): payload is ClaimSessionPayload {\n return payload?.type === 'claim_session';\n}\n\nexport function isPrefetchMetadataPayload(payload: WalletMessagePayload): payload is PrefetchMetadataPayload {\n return payload?.type === 'prefetch_metadata';\n}\n\nexport function isConnectionRejectedPayload(payload: WalletMessagePayload): payload is ConnectionRejectedPayload {\n return payload?.type === 'connection_rejected';\n}\n\nexport function isAuthenticateConnectionPayload(payload: WalletMessagePayload): payload is AuthenticateConnectionPayload {\n return payload?.type === 'authenticate_connection';\n}\n\nexport function isWalletReconnectPayload(payload: WalletMessagePayload): payload is WalletReconnectPayload {\n return payload?.type === 'wallet_reconnect';\n}\n\n/**\n * Type guards for relay-to-dApp messages\n */\nexport function isWalletHandshakeMessage(message: RelayToDAppMessage): message is WalletHandshakeMessage {\n return message?.type === 'wallet_handshake';\n}\n\nexport function isConnectionRejectedMessage(message: RelayToDAppMessage): message is ConnectionRejectedMessage {\n return message?.type === 'connection_rejected';\n}\n\nexport function isConnectionAuthenticatedMessage(message: RelayToDAppMessage): message is ConnectionAuthenticatedMessage {\n return message?.type === 'connection_authenticated';\n}\n","/**\n * Client message types for BananaLink protocol v2.0\n * These types define the communication between dApp clients and the relay server\n */\n\nimport type {\n SignMessageRequestPayload,\n SignTypedDataRequestPayload,\n SignTransactionRequestPayload,\n} from './post-auth-operations';\n\n/**\n * Client session claim credential for authentication and reconnection\n * Stored by client, validated by relay server\n */\nexport interface ClientSessionClaim {\n /**\n * Unique nonce for this client session\n * - Generated once by client during session creation\n * - Stored locally by client for reconnection\n * - Used by relay to validate client ownership\n * - Different for each session\n */\n claimNonce: string;\n\n /** Claim generation timestamp */\n timestamp: number;\n}\n\n/**\n * Client reconnect payload\n * Used to reconnect after network interruption\n */\nexport interface ClientReconnectPayload {\n type: 'client_reconnect';\n}\n\n/**\n * Close session payload\n * Used to gracefully close a session (bidirectional)\n */\nexport interface CloseSessionPayload {\n type: 'close_session';\n /** Optional reason for closing the session */\n reason?: string;\n}\n\n/**\n * Union type for all client message payloads\n */\nexport type ClientMessagePayload =\n // Session management payloads\n | ClientReconnectPayload\n | CloseSessionPayload\n // Post-authentication operation request payloads (v2.1+)\n | SignMessageRequestPayload\n | SignTypedDataRequestPayload\n | SignTransactionRequestPayload;\n\n/**\n * Client message envelope structure\n * All client-to-relay messages use this envelope\n */\nexport interface ClientMessageEnvelope {\n /** Session identifier */\n sessionId: string;\n\n /** Client session claim - validated by relay server */\n clientSessionClaim: ClientSessionClaim;\n\n /** Actual message payload */\n payload: ClientMessagePayload;\n}\n\n/**\n * Type guards for client messages\n */\nexport function isClientReconnectPayload(payload: ClientMessagePayload): payload is ClientReconnectPayload {\n return payload?.type === 'client_reconnect';\n}\n\nexport function isCloseSessionPayload(payload: ClientMessagePayload): payload is CloseSessionPayload {\n return payload?.type === 'close_session';\n}\n","/**\n * Relay notification message types for BananaLink protocol v2.0\n * These are messages sent from relay server to clients/wallets\n */\n\n/**\n * Session closed acknowledgment\n * Sent to acknowledge a close_session request\n */\nexport interface SessionClosedAck {\n type: 'session_closed_ack';\n timestamp: number;\n}\n\n/**\n * Session closed notification\n * Sent to notify the other party that peer closed the session\n */\nexport interface SessionClosedNotification {\n type: 'session_closed_notification';\n /** Which party closed the session */\n closedBy: 'client' | 'wallet';\n /** Optional reason for closure */\n reason?: string;\n timestamp: number;\n}\n\n/**\n * Reconnected confirmation message\n * Sent after successful reconnection\n */\nexport interface ReconnectedMessage {\n type: 'reconnected';\n /** Number of messages that were queued during disconnection */\n queuedMessages: number;\n timestamp: number;\n}\n\n/**\n * Union type for relay notification messages\n */\nexport type RelayNotificationMessage =\n | SessionClosedAck\n | SessionClosedNotification\n | ReconnectedMessage;\n\n/**\n * Type guards for relay notification messages\n */\nexport function isSessionClosedAck(message: RelayNotificationMessage): message is SessionClosedAck {\n return message?.type === 'session_closed_ack';\n}\n\nexport function isSessionClosedNotification(message: RelayNotificationMessage): message is SessionClosedNotification {\n return message?.type === 'session_closed_notification';\n}\n\nexport function isReconnectedMessage(message: RelayNotificationMessage): message is ReconnectedMessage {\n return message?.type === 'reconnected';\n}\n","/**\n * Public key compression utilities for compact URL encoding\n *\n * These utilities convert public keys between standard base64 format\n * and compact base64url format for use in QR codes and URLs.\n */\n\n/**\n * Compress a public key for compact URLs\n * Removes AES-GCM: prefix and uses base64url without padding\n *\n * @param publicKey - Public key in format \"AES-GCM:base64string\" or \"base64string\"\n * @returns Compressed public key in base64url format without padding\n */\nexport function compressPublicKey(publicKey: string): string {\n // Remove AES-GCM: prefix if present\n const keyWithoutPrefix = publicKey.startsWith('AES-GCM:')\n ? publicKey.slice(8)\n : publicKey;\n\n // Convert base64 to base64url (replace + with -, / with _, remove padding)\n return keyWithoutPrefix\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n}\n\n/**\n * Decompress a public key from compact format\n * Adds back AES-GCM: prefix and restores base64 padding\n *\n * @param compressedKey - Compressed public key in base64url format\n * @returns Public key in format \"AES-GCM:base64string\"\n */\nexport function decompressPublicKey(compressedKey: string): string {\n // Convert base64url back to base64\n let base64Key = compressedKey\n .replace(/-/g, '+')\n .replace(/_/g, '/');\n\n // Add padding if needed\n const padding = base64Key.length % 4;\n if (padding > 0) {\n base64Key += '='.repeat(4 - padding);\n }\n\n // Add AES-GCM prefix if not already present\n return base64Key.startsWith('AES-GCM:') ? base64Key : `AES-GCM:${base64Key}`;\n}\n","import type { QRPayload } from '../types/discovery';\nimport { DEEPLINK_SCHEME } from '../constants';\nimport { compressPublicKey } from './public-keys';\n\n/**\n * Provider shortcodes for compact URLs\n */\nconst PROVIDER_SHORTCODES: Record<string, string> = {\n 'uwebsockets': 'u', // Legacy - API may still return this\n 'websocket': 'w',\n 'pusher': 'p',\n 'ably': 'a',\n};\n\n/**\n * Production relay URLs that should be omitted in compact format (most common case)\n */\nconst PRODUCTION_RELAY_URLS = [\n 'wss://relay.banana.link/v1',\n 'https://relay.banana.link/v1',\n];\n\n/**\n * Environment shortcodes for non-production relay URLs\n */\nconst RELAY_SHORTCODES: Record<string, string> = {\n 'wss://relay.dev.banana.link/v1': 'd',\n 'https://relay.dev.banana.link/v1': 'd',\n 'wss://relay.staging.banana.link/v1': 's', // Future staging environment\n 'https://relay.staging.banana.link/v1': 's',\n};\n\n/**\n * Safely encode a URL parameter value\n * Uses encodeURIComponent to handle special characters like +, /, =\n */\nexport function encodeUrlParameter(value: string): string {\n return encodeURIComponent(value);\n}\n\n/**\n * Build a query string with properly encoded parameters\n */\nexport function buildQueryString(params: Record<string, string | undefined>): string {\n const pairs: string[] = [];\n\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined) {\n pairs.push(`${encodeUrlParameter(key)}=${encodeUrlParameter(value)}`);\n }\n }\n\n return pairs.join('&');\n}\n\n/**\n * Create a compact deep link URL with shortened parameters\n * Uses single-letter parameters to minimize QR code size\n */\nexport function encodeCompactConnectionString(payload: QRPayload): string {\n const params: Record<string, string | undefined> = {\n s: payload.sessionId, // sessionId -> s\n k: compressPublicKey(payload.publicKey), // publicKey -> k (compressed)\n };\n\n // Add optional parameters with shortcodes\n if (payload.providerId) {\n params.p = PROVIDER_SHORTCODES[payload.providerId] || payload.providerId;\n }\n\n // Handle relay URL compression:\n // - Production: omit entirely (most common case)\n // - Development/Staging: use shortcode (r=d, r=s)\n // - Custom: use full URL\n if (payload.relayUrl) {\n if (PRODUCTION_RELAY_URLS.includes(payload.relayUrl)) {\n // Production relay - omit parameter entirely for maximum compression\n // This will be the most common case, so QR codes will be smallest\n } else if (RELAY_SHORTCODES[payload.relayUrl]) {\n // Known environment (dev/staging) - use shortcode\n params.r = RELAY_SHORTCODES[payload.relayUrl];\n } else {\n // Custom relay URL - include full URL\n params.r = payload.relayUrl;\n }\n }\n\n const queryString = buildQueryString(params);\n return `${DEEPLINK_SCHEME}://connect?${queryString}`;\n}\n\n/**\n * Create a deep link URL with properly encoded parameters\n * Uses full parameter names for readability\n */\nexport function encodeConnectionString(payload: QRPayload): string {\n const params: Record<string, string | undefined> = {\n sessionId: payload.sessionId,\n publicKey: payload.publicKey,\n };\n\n // Add optional parameters\n if (payload.providerId) {\n params.providerId = payload.providerId;\n }\n\n if (payload.relayUrl) {\n params.relay = payload.relayUrl;\n }\n\n const queryString = buildQueryString(params);\n return `${DEEPLINK_SCHEME}://connect?${queryString}`;\n}\n\n/**\n * Create a universal link (HTTPS) with properly encoded parameters\n */\nexport function encodeUniversalLink(payload: QRPayload, options: {\n baseUrl?: string;\n fallbackUrl?: string;\n} = {}): string {\n const {\n baseUrl = 'https://banana.link',\n fallbackUrl = 'https://banana.link/download',\n } = options;\n\n const params: Record<string, string | undefined> = {\n sessionId: payload.sessionId,\n key: payload.publicKey, // Use 'key' instead of 'publicKey' for universal links\n fallback: fallbackUrl,\n };\n\n // Add optional parameters\n if (payload.providerId) {\n params.provider = payload.providerId;\n }\n\n if (payload.relayUrl) {\n params.relay = payload.relayUrl;\n }\n\n const queryString = buildQueryString(params);\n return `${baseUrl}/connect?${queryString}`;\n}\n","import type { QRPayload } from '../types/discovery';\nimport { decompressPublicKey } from './public-keys';\n\n/**\n * Provider shortcodes reverse mapping for compact URL decoding\n */\nconst PROVIDER_SHORTCODES_REVERSE: Record<string, string> = {\n 'u': 'websocket', // Decode legacy 'u' to new 'websocket' name\n 'w': 'websocket',\n 'p': 'pusher',\n 'a': 'ably',\n};\n\n/**\n * Environment shortcodes reverse mapping for relay URL decoding\n */\nconst RELAY_SHORTCODES_REVERSE: Record<string, string> = {\n 'd': 'wss://relay.dev.banana.link/v1',\n 's': 'wss://relay.staging.banana.link/v1',\n};\n\n/**\n * Safely decode a URL parameter value\n * Uses decodeURIComponent to restore special characters\n */\nexport function decodeUrlParameter(value: string): string {\n return decodeURIComponent(value);\n}\n\n/**\n * Parse a query string with properly decoded parameters\n */\nexport function parseQueryString(query: string): Record<string, string> {\n const params: Record<string, string> = {};\n\n // Remove leading ? if present\n const cleanQuery = query.startsWith('?') ? query.slice(1) : query;\n\n if (!cleanQuery) {\n return params;\n }\n\n for (const pair of cleanQuery.split('&')) {\n const [key, ...valueParts] = pair.split('=');\n if (key) {\n const value = valueParts.join('='); // Handle values that contain =\n params[decodeUrlParameter(key)] = decodeUrlParameter(value);\n }\n }\n\n return params;\n}\n\n/**\n * Parse a connection string and extract the QRPayload with proper decoding\n * Supports both full format and compact format\n */\nexport function decodeConnectionString(connectionString: string): QRPayload {\n let url: URL;\n\n try {\n url = new URL(connectionString);\n } catch {\n throw new Error(`Invalid connection string format: ${connectionString}`);\n }\n\n // Parse query parameters using our safe decoder\n const params = parseQueryString(url.search);\n\n // Support both compact and full parameter formats\n const sessionId = params.sessionId || params.s; // full or compact\n let publicKey = params.publicKey || params.key || params.k; // full, universal, or compact\n let providerId = params.providerId || params.provider || params.p; // full, alt, or compact\n let relayUrl = params.relay || params.r; // full or compact\n\n if (!sessionId || !publicKey) {\n throw new Error('Missing required parameters: sessionId and publicKey');\n }\n\n // If we have a compact format public key (params.k), decompress it\n if (params.k && !params.publicKey && !params.key) {\n publicKey = decompressPublicKey(params.k);\n }\n\n // If we have a compact format provider, expand it\n if (params.p && !params.providerId && !params.provider) {\n providerId = PROVIDER_SHORTCODES_REVERSE[params.p] || params.p;\n }\n\n // Handle relay URL decompression:\n // - No relay parameter = production (default)\n // - Shortcode (d, s) = expand to full environment URL\n // - Full URL = use as-is\n if (!relayUrl) {\n // No relay parameter means production (most common case)\n relayUrl = 'wss://relay.banana.link/v1';\n } else if (RELAY_SHORTCODES_REVERSE[relayUrl]) {\n // Environment shortcode - expand to full URL\n relayUrl = RELAY_SHORTCODES_REVERSE[relayUrl];\n }\n // else: already a full URL, use as-is\n\n // Ensure public key has AES-GCM prefix for backward compatibility\n if (publicKey && !publicKey.startsWith('AES-GCM:')) {\n publicKey = `AES-GCM:${publicKey}`;\n }\n\n return {\n sessionId,\n publicKey,\n providerId: providerId || undefined,\n relayUrl: relayUrl || undefined,\n };\n}\n\n/**\n * Validate that a string is a valid connection string\n */\nexport function isValidConnectionString(connectionString: string): boolean {\n try {\n decodeConnectionString(connectionString);\n return true;\n } catch {\n return false;\n }\n}\n","/**\n * Session claiming mechanism utilities for BananaLink protocol v2.0\n * Implements secure session ownership and reconnection logic\n */\n\nimport type { WalletSessionClaim, WalletMessageEnvelope } from '../types/wallet-messages';\n\n/**\n * Wallet session claim storage interface\n * Implementations should provide secure storage for wallet session claims\n */\nexport interface WalletSessionClaimStorage {\n store(sessionId: string, claim: WalletSessionClaim): Promise<void>;\n retrieve(sessionId: string): Promise<WalletSessionClaim | null>;\n remove(sessionId: string): Promise<void>;\n clear(): Promise<void>;\n}\n\n/**\n * Wallet session claim manager for handling claim generation and validation\n */\nexport class WalletSessionClaimManager {\n constructor(private storage: WalletSessionClaimStorage) {}\n\n /**\n * Generate a new wallet session claim with provided nonce\n * @param sessionId - Session identifier\n * @param sessionNonce - Pre-generated cryptographically secure nonce (use @bananalink-sdk/crypto)\n * @returns Generated wallet session claim\n */\n async generateClaim(sessionId: string, sessionNonce: string): Promise<WalletSessionClaim> {\n const claim: WalletSessionClaim = {\n sessionNonce,\n timestamp: Date.now(),\n };\n\n // Store the claim for future reconnection\n await this.storage.store(sessionId, claim);\n\n return claim;\n }\n\n /**\n * Retrieve an existing wallet session claim\n * @param sessionId - Session identifier\n * @returns Stored wallet session claim or null if not found\n */\n async getClaim(sessionId: string): Promise<WalletSessionClaim | null> {\n return this.storage.retrieve(sessionId);\n }\n\n /**\n * Validate a wallet session claim for reconnection\n * @param claim - Claim to validate\n * @param storedClaim - Previously stored claim\n * @returns Validation result\n */\n validateReconnectionClaim(\n claim: WalletSessionClaim,\n storedClaim: WalletSessionClaim\n ): { valid: boolean; reason?: string } {\n // Check nonce match\n if (claim.sessionNonce !== storedClaim.sessionNonce) {\n return {\n valid: false,\n reason: 'Session nonce mismatch - invalid reconnection attempt',\n };\n }\n\n // Check timestamp validity (prevent very old reconnection attempts)\n const MAX_RECONNECTION_AGE = 24 * 60 * 60 * 1000; // 24 hours\n const claimAge = Date.now() - claim.timestamp;\n if (claimAge > MAX_RECONNECTION_AGE) {\n return {\n valid: false,\n reason: 'Session claim too old - please create a new session',\n };\n }\n\n return { valid: true };\n }\n\n /**\n * Remove a wallet session claim (on session end)\n * @param sessionId - Session identifier\n */\n async removeClaim(sessionId: string): Promise<void> {\n await this.storage.remove(sessionId);\n }\n\n /**\n * Clear all stored claims\n */\n async clearAllClaims(): Promise<void> {\n await this.storage.clear();\n }\n}\n\n// NOTE: Nonce generation moved to @bananalink-sdk/crypto package to avoid circular dependencies\n// SDKs should use crypto.generateSessionNonce() before creating session claims\n\n/**\n * Create a wallet message envelope with wallet session claim\n * @param sessionId - Session identifier\n * @param claim - Wallet session claim\n * @param payload - Message payload\n * @returns Complete wallet message envelope\n */\nexport function createWalletMessageEnvelope(\n sessionId: string,\n claim: WalletSessionClaim,\n payload: WalletMessageEnvelope['payload']\n): WalletMessageEnvelope {\n return {\n sessionId,\n walletSessionClaim: claim,\n payload,\n };\n}\n\n/**\n * Strip wallet session claim from wallet message for forwarding to dApp\n * @param envelope - Original wallet message envelope\n * @returns Message without wallet session claim\n */\nexport function stripWalletSessionClaim(\n envelope: WalletMessageEnvelope\n): Omit<WalletMessageEnvelope, 'walletSessionClaim'> {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { walletSessionClaim, ...messageWithoutClaim } = envelope;\n return messageWithoutClaim;\n}\n\n/**\n * Validate session claim timestamp for replay attack prevention\n * @param timestamp - Claim timestamp\n * @param maxAge - Maximum age in milliseconds (default: 30 seconds)\n * @returns True if timestamp is within valid range\n */\nexport function validateClaimTimestamp(\n timestamp: number,\n maxAge: number = 30 * 1000\n): boolean {\n const now = Date.now();\n const age = Math.abs(now - timestamp);\n return age <= maxAge;\n}\n\n/**\n * Validate wallet message envelope\n * @param envelope - Message envelope to validate\n * @returns Validation result\n */\nexport function validateWalletMessageEnvelope(\n envelope: WalletMessageEnvelope\n): { valid: boolean; errors: string[] } {\n const errors: string[] = [];\n\n // Check required fields\n if (!envelope.sessionId) {\n errors.push('Missing session ID');\n }\n\n if (!envelope.walletSessionClaim) {\n errors.push('Missing wallet session claim');\n } else {\n // Validate claim structure\n if (!envelope.walletSessionClaim.sessionNonce) {\n errors.push('Missing session nonce in wallet session claim');\n }\n if (!envelope.walletSessionClaim.timestamp) {\n errors.push('Missing timestamp in wallet session claim');\n } else if (!validateClaimTimestamp(envelope.walletSessionClaim.timestamp)) {\n errors.push('Wallet session claim timestamp is too old or invalid');\n }\n }\n\n if (!envelope.payload) {\n errors.push('Missing message payload');\n } else if (!envelope.payload.type) {\n errors.push('Missing payload type');\n }\n\n return {\n valid: errors.length === 0,\n errors,\n };\n}\n","/**\n * Client session claim utilities for BananaLink protocol v2.0\n * Implements secure client session ownership and reconnection logic\n */\n\nimport type { ClientSessionClaim, ClientMessageEnvelope } from '../types/client-messages';\n\n/**\n * Client session claim storage interface\n * Implementations should provide secure storage for client session claims\n */\nexport interface ClientSessionClaimStorage {\n store(sessionId: string, claim: ClientSessionClaim): Promise<void>;\n retrieve(sessionId: string): Promise<ClientSessionClaim | null>;\n remove(sessionId: string): Promise<void>;\n clear(): Promise<void>;\n}\n\n/**\n * Client session claim manager for handling claim generation and validation\n */\nexport class ClientSessionClaimManager {\n constructor(private storage: ClientSessionClaimStorage) {}\n\n /**\n * Generate a new client session claim with provided nonce\n * @param sessionId - Session identifier\n * @param claimNonce - Pre-generated cryptographically secure nonce (use @bananalink-sdk/crypto)\n * @returns Generated client session claim\n */\n async generateClaim(sessionId: string, claimNonce: string): Promise<ClientSessionClaim> {\n const claim: ClientSessionClaim = {\n claimNonce,\n timestamp: Date.now(),\n };\n\n // Store the claim for future reconnection\n await this.storage.store(sessionId, claim);\n\n return claim;\n }\n\n /**\n * Retrieve an existing client session claim\n * @param sessionId - Session identifier\n * @returns Stored client session claim or null if not found\n */\n async getClaim(sessionId: string): Promise<ClientSessionClaim | null> {\n return this.storage.retrieve(sessionId);\n }\n\n /**\n * Validate a client session claim for reconnection\n * @param claim - Claim to validate\n * @param storedClaim - Previously stored claim\n * @returns Validation result\n */\n validateReconnectionClaim(\n claim: ClientSessionClaim,\n storedClaim: ClientSessionClaim\n ): { valid: boolean; reason?: string } {\n // Check nonce match\n if (claim.claimNonce !== storedClaim.claimNonce) {\n return {\n valid: false,\n reason: 'Client claim nonce mismatch - invalid reconnection attempt',\n };\n }\n\n // Check timestamp validity (prevent very old reconnection attempts)\n const MAX_RECONNECTION_AGE = 24 * 60 * 60 * 1000; // 24 hours\n const claimAge = Date.now() - claim.timestamp;\n if (claimAge > MAX_RECONNECTION_AGE) {\n return {\n valid: false,\n reason: 'Client session claim too old - please create a new session',\n };\n }\n\n return { valid: true };\n }\n\n /**\n * Remove a client session claim (on session end)\n * @param sessionId - Session identifier\n */\n async removeClaim(sessionId: string): Promise<void> {\n await this.storage.remove(sessionId);\n }\n\n /**\n * Clear all stored claims\n */\n async clearAllClaims(): Promise<void> {\n await this.storage.clear();\n }\n}\n\n// NOTE: Nonce generation moved to @bananalink-sdk/crypto package to avoid circular dependencies\n// SDKs should use crypto.generateClientClaimNonce() before creating client session claims\n\n/**\n * Create a client message envelope with session claim\n * @param sessionId - Session identifier\n * @param claim - Client session claim\n * @param payload - Message payload\n * @returns Complete client message envelope\n */\nexport function createClientMessageEnvelope(\n sessionId: string,\n claim: ClientSessionClaim,\n payload: ClientMessageEnvelope['payload']\n): ClientMessageEnvelope {\n return {\n sessionId,\n clientSessionClaim: claim,\n payload,\n };\n}\n\n/**\n * Strip client session claim from client message for forwarding\n * @param envelope - Original client message envelope\n * @returns Message without client session claim\n */\nexport function stripClientSessionClaim(\n envelope: ClientMessageEnvelope\n): Omit<ClientMessageEnvelope, 'clientSessionClaim'> {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { clientSessionClaim, ...messageWithoutClaim } = envelope;\n return messageWithoutClaim;\n}\n\n/**\n * Validate client session claim timestamp for replay attack prevention\n * @param timestamp - Claim timestamp\n * @param maxAge - Maximum age in milliseconds (default: 30 seconds)\n * @returns True if timestamp is within valid range\n */\nexport function validateClientClaimTimestamp(\n timestamp: number,\n maxAge: number = 30 * 1000\n): boolean {\n const now = Date.now();\n const age = Math.abs(now - timestamp);\n return age <= maxAge;\n}\n\n/**\n * Validate client message envelope\n * @param envelope - Message envelope to validate\n * @returns Validation result\n */\nexport function validateClientMessageEnvelope(\n envelope: ClientMessageEnvelope\n): { valid: boolean; errors: string[] } {\n const errors: string[] = [];\n\n // Check required fields\n if (!envelope.sessionId) {\n errors.push('Missing session ID');\n }\n\n if (!envelope.clientSessionClaim) {\n errors.push('Missing client session claim');\n } else {\n // Validate claim structure\n if (!envelope.clientSessionClaim.claimNonce) {\n errors.push('Missing claim nonce in client session claim');\n }\n if (!envelope.clientSessionClaim.timestamp) {\n errors.push('Missing timestamp in client session claim');\n } else if (!validateClientClaimTimestamp(envelope.clientSessionClaim.timestamp)) {\n errors.push('Client session claim timestamp is too old or invalid');\n }\n }\n\n if (!envelope.payload) {\n errors.push('Missing message payload');\n } else if (!envelope.payload.type) {\n errors.push('Missing payload type');\n }\n\n return {\n valid: errors.length === 0,\n errors,\n };\n}\n","/**\n * Protocol utility functions\n *\n * This module provides utility functions that are specific to the BananaLink protocol.\n * SDK-specific utilities are implemented in their respective packages.\n */\n\nimport { generateUUID } from '../crypto/utils';\n\n/**\n * Generate a cryptographically secure session ID in RFC 4122 UUID v4 format\n *\n * This function delegates to the protocol crypto layer for mobile-safe UUID generation.\n * For direct access to UUID generation, prefer importing from @bananalink-sdk/protocol/crypto.\n *\n * @returns UUID v4 string (e.g., \"550e8400-e29b-41d4-a716-446655440000\")\n *\n * @example\n * const sessionId = generateSessionId();\n * // => \"a3bb189e-8bf9-4bdc-9f16-9f48a6a1e3e7\"\n */\nexport function generateSessionId(): string {\n return generateUUID();\n}\n\n// Protocol-specific utility that might be needed across packages\nexport function isValidProtocolVersion(version: string): boolean {\n // Only support version \"1\" for now\n return version === '1';\n}\n\n// Protocol-specific session ID validation\nexport function isValidSessionId(sessionId: string): boolean {\n // Session IDs should be valid UUIDs\n const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n return uuidRegex.test(sessionId);\n}\n\n// Export public key compression utilities\nexport * from './public-keys';\n\n// Export URL encoding and decoding utilities\nexport * from './url-encoding';\nexport * from './url-decoding';\n\n// Note: SIWE utilities have been moved to '@bananalink-sdk/protocol/siwe'\n// For ERC-4361 message construction and validation, import from '@bananalink-sdk/protocol/siwe'\n// Type-only definitions (SIWEFields, SIWEMessageOptions) remain available from main export\n\n// Export wallet session claiming utilities\nexport * from './wallet-session-claim';\n\n// Export client session claiming utilities\nexport * from './client-session-claim';\n","{\n \"name\": \"@bananalink-sdk/protocol\",\n \"version\": \"1.2.7\",\n \"description\": \"Core protocol definitions for BananaLink. Provides TypeScript types, Zod validation schemas, cryptographic utilities, and shared constants for wallet connections.\",\n \"type\": \"module\",\n \"keywords\": [\n \"bananalink\",\n \"protocol\",\n \"types\",\n \"schemas\",\n \"validation\",\n \"cryptography\",\n \"web3\"\n ],\n \"bugs\": {\n \"url\": \"https://github.com/bananalink/bananalink/issues\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/bananalink/bananalink.git\",\n \"directory\": \"packages/protocol\"\n },\n \"license\": \"ISC\",\n \"author\": \"BananaLink Team <team@banana.link>\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"react-native\": \"./dist/index.js\",\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"./schemas\": {\n \"types\": \"./dist/schemas-export.d.ts\",\n \"react-native\": \"./dist/schemas-export.js\",\n \"import\": \"./dist/schemas-export.js\",\n \"require\": \"./dist/schemas-export.cjs\"\n },\n \"./validators\": {\n \"types\": \"./dist/validators-export.d.ts\",\n \"react-native\": \"./dist/validators-export.js\",\n \"import\": \"./dist/validators-export.js\",\n \"require\": \"./dist/validators-export.cjs\"\n },\n \"./validation\": {\n \"types\": \"./dist/validation-export.d.ts\",\n \"react-native\": \"./dist/validation-export.js\",\n \"import\": \"./dist/validation-export.js\",\n \"require\": \"./dist/validation-export.cjs\"\n },\n \"./siwe\": {\n \"types\": \"./dist/siwe-export.d.ts\",\n \"react-native\": \"./dist/siwe-export.js\",\n \"import\": \"./dist/siwe-export.js\",\n \"require\": \"./dist/siwe-export.cjs\"\n },\n \"./crypto\": {\n \"types\": \"./dist/crypto-export.d.ts\",\n \"react-native\": \"./dist/crypto-export.js\",\n \"import\": \"./dist/crypto-export.js\",\n \"require\": \"./dist/crypto-export.cjs\"\n },\n \"./crypto/provider/webcrypto\": {\n \"types\": \"./dist/crypto/providers/webcrypto-provider.d.ts\",\n \"react-native\": \"./dist/crypto/providers/webcrypto-provider.js\",\n \"import\": \"./dist/crypto/providers/webcrypto-provider.js\",\n \"require\": \"./dist/crypto/providers/webcrypto-provider.cjs\"\n },\n \"./crypto/provider/node\": {\n \"types\": \"./dist/crypto/providers/node-provider.d.ts\",\n \"react-native\": \"./dist/crypto/providers/node-provider.js\",\n \"import\": \"./dist/crypto/providers/node-provider.js\",\n \"require\": \"./dist/crypto/providers/node-provider.cjs\"\n },\n \"./crypto/provider/noble\": {\n \"types\": \"./dist/crypto/providers/noble-provider.d.ts\",\n \"react-native\": \"./dist/crypto/providers/noble-provider.js\",\n \"import\": \"./dist/crypto/providers/noble-provider.js\",\n \"require\": \"./dist/crypto/providers/noble-provider.cjs\"\n },\n \"./crypto/provider/quickcrypto\": {\n \"types\": \"./dist/crypto/providers/quickcrypto-provider.d.ts\",\n \"react-native\": \"./dist/crypto/providers/quickcrypto-provider.js\",\n \"import\": \"./dist/crypto/providers/quickcrypto-provider.js\",\n \"require\": \"./dist/crypto/providers/quickcrypto-provider.cjs\"\n },\n \"./testing\": {\n \"types\": \"./dist/testing.d.ts\",\n \"react-native\": \"./dist/testing.js\",\n \"import\": \"./dist/testing.js\",\n \"require\": \"./dist/testing.cjs\"\n }\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"files\": [\n \"dist\",\n \"src\",\n \"!src/__tests__\"\n ],\n \"publishConfig\": {\n \"access\": \"restricted\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"clean\": \"rm -rf dist node_modules\",\n \"dev\": \"tsup --watch\",\n \"lint\": \"eslint src --ext .ts\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"typecheck\": \"tsc --noEmit\"\n },\n \"dependencies\": {\n \"@bananalink-sdk/logger\": \"workspace:*\",\n \"@noble/ciphers\": \"^2.0.0\",\n \"@noble/curves\": \"^2.0.0\",\n \"@noble/hashes\": \"^2.0.0\",\n \"zod\": \"^3.25.67\"\n },\n \"devDependencies\": {\n \"@bananalink-sdk/eslint-config\": \"workspace:*\",\n \"@bananalink-sdk/typescript-config\": \"workspace:*\",\n \"@types/node\": \"^24.1.0\",\n \"@vitest/coverage-v8\": \"^3.2.4\",\n \"eslint\": \"^9.29.0\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.8.3\",\n \"vitest\": \"^3.2.4\"\n },\n \"peerDependencies\": {\n \"react-native-quick-crypto\": \"^0.7.0\"\n },\n \"peerDependenciesMeta\": {\n \"react-native-quick-crypto\": {\n \"optional\": true\n }\n },\n \"packageManager\": \"pnpm@10.15.1\"\n}\n","/**\n * BananaLink Protocol Package\n *\n * Core TypeScript implementation of the BananaLink protocol for dApp-to-wallet communication.\n * Provides types, schemas, constants, and utilities for implementing BananaLink clients and wallets.\n *\n * @packageDocumentation\n */\n\n// Core protocol types\nexport * from './types/core';\nexport * from './types/auth';\nexport * from './types/crypto';\nexport * from './types/discovery';\nexport * from './types/errors';\nexport * from './types/providers';\nexport * from './types/wallet-messages';\nexport * from './types/client-messages';\nexport * from './types/relay-messages';\n\n// Note: Zod validation schemas have been moved to '@bananalink-sdk/protocol/schemas'\n// For runtime validation, import from '@bananalink-sdk/protocol/schemas'\n// Type-only definitions remain available from this main export\n\n// Note: SIWE utilities have been moved to '@bananalink-sdk/protocol/siwe'\n// For ERC-4361 message construction/parsing, import from '@bananalink-sdk/protocol/siwe'\n// Export SIWE types for convenience (type-only, no runtime code)\nexport type { SIWEMessageOptions } from './utils/siwe';\n\n// Constants and utilities\nexport * from './constants';\nexport * from './utils';\n\n// Package metadata\n// Note: Version is imported from package.json to ensure consistency\nimport packageJson from '../package.json';\nexport const VERSION = packageJson.version;\nexport const PACKAGE_NAME = \"@bananalink-sdk/protocol\";\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/types/wallet-messages.ts","../src/types/client-messages.ts","../src/types/relay-messages.ts","../src/utils/public-keys.ts","../src/utils/url-encoding.ts","../src/utils/url-decoding.ts","../src/utils/wallet-session-claim.ts","../src/utils/client-session-claim.ts","../src/utils/index.ts","../package.json","../src/index.ts"],"names":["__name","DEEPLINK_SCHEME","generateUUID"],"mappings":";;;;;;;AA6NO,SAAS,sBAAsB,OAAA,EAA+D;AACnG,EAAA,OAAO,SAAS,IAAA,KAAS,eAAA;AAC3B;AAFgBA,wBAAA,CAAA,qBAAA,EAAA,uBAAA,CAAA;AAIT,SAAS,0BAA0B,OAAA,EAAmE;AAC3G,EAAA,OAAO,SAAS,IAAA,KAAS,mBAAA;AAC3B;AAFgBA,wBAAA,CAAA,yBAAA,EAAA,2BAAA,CAAA;AAIT,SAAS,4BAA4B,OAAA,EAAqE;AAC/G,EAAA,OAAO,SAAS,IAAA,KAAS,qBAAA;AAC3B;AAFgBA,wBAAA,CAAA,2BAAA,EAAA,6BAAA,CAAA;AAIT,SAAS,gCAAgC,OAAA,EAAyE;AACvH,EAAA,OAAO,SAAS,IAAA,KAAS,yBAAA;AAC3B;AAFgBA,wBAAA,CAAA,+BAAA,EAAA,iCAAA,CAAA;AAIT,SAAS,yBAAyB,OAAA,EAAkE;AACzG,EAAA,OAAO,SAAS,IAAA,KAAS,kBAAA;AAC3B;AAFgBA,wBAAA,CAAA,wBAAA,EAAA,0BAAA,CAAA;AAOT,SAAS,yBAAyB,OAAA,EAAgE;AACvG,EAAA,OAAO,SAAS,IAAA,KAAS,kBAAA;AAC3B;AAFgBA,wBAAA,CAAA,wBAAA,EAAA,0BAAA,CAAA;AAIT,SAAS,4BAA4B,OAAA,EAAmE;AAC7G,EAAA,OAAO,SAAS,IAAA,KAAS,qBAAA;AAC3B;AAFgBA,wBAAA,CAAA,2BAAA,EAAA,6BAAA,CAAA;AAIT,SAAS,iCAAiC,OAAA,EAAwE;AACvH,EAAA,OAAO,SAAS,IAAA,KAAS,0BAAA;AAC3B;AAFgBA,wBAAA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QAAA,CAAS,kBAAA,CAAmB,SAAS,CAAA,EAAG;AAC/E,MAAA,MAAA,CAAO,KAAK,sDAAsD,CAAA;AAAA,IACpE;AAAA,EACF;AAEA,EAAA,IAAI,CAAC,SAAS,OAAA,EAAS;AACrB,IAAA,MAAA,CAAO,KAAK,yBAAyB,CAAA;AAAA,EACvC,CAAA,MAAA,IAAW,CAAC,QAAA,CAAS,OAAA,CAAQ,IAAA,EAAM;AACjC,IAAA,MAAA,CAAO,KAAK,sBAAsB,CAAA;AAAA,EACpC;AAEA,EAAA,OAAO;AAAA,IACL,KAAA,EAAO,OAAO,MAAA,KAAW,CAAA;AAAA,IACzB;AAAA,GACF;AACF;AAlCgBA,wBAAA,CAAA,6BAAA,EAAA,+BAAA,CAAA;;;ACpIT,SAAS,iBAAA,GAA4B;AAC1C,EAAA,OAAOE,8BAAA,EAAa;AACtB;AAFgBF,wBAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA;AAKT,SAAS,uBAAuB,OAAA,EAA0B;AAE/D,EAAA,OAAO,OAAA,KAAY,GAAA;AACrB;AAHgBA,wBAAA,CAAA,sBAAA,EAAA,wBAAA,CAAA;AAMT,SAAS,iBAAiB,SAAA,EAA4B;AAE3D,EAAA,MAAM,SAAA,GAAY,4EAAA;AAClB,EAAA,OAAO,SAAA,CAAU,KAAK,SAAS,CAAA;AACjC;AAJgBA,wBAAA,CAAA,gBAAA,EAAA,kBAAA,CAAA;;;AChChB,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,OAyIb,CAAA;;;ACtGO,IAAM,UAAU,eAAA,CAAY;AAC5B,IAAM,YAAA,GAAe","file":"index.cjs","sourcesContent":["/**\n * Wallet message types for BananaLink protocol v2.0\n * These types define the communication between wallets and the relay server\n */\n\nimport type { EncryptedPayload } from './discovery';\nimport type { DAppMetadata, SessionConfig } from './core';\nimport type { CloseSessionPayload, ClientHandshakeMessage } from './client-messages';\nimport type {\n RequestFulfilledPayload,\n RequestRejectedPayload,\n} from './post-auth-operations';\n\n/**\n * Wallet session claim credential for claiming and reconnection\n * NEVER forwarded to dApp - relay server only\n */\nexport interface WalletSessionClaim {\n /**\n * Unique nonce for this session claim\n * - Generated once by wallet when claiming session\n * - Stored locally by wallet for reconnection\n * - Used by relay to validate session ownership\n * - Different for each session (no cross-session tracking)\n */\n sessionNonce: string;\n\n /** Claim timestamp (used for replay attack prevention) */\n timestamp: number;\n}\n\n/**\n * Wallet message envelope structure\n * All wallet-to-relay messages use this envelope\n */\nexport interface WalletMessageEnvelope {\n /** Session identifier */\n sessionId: string;\n\n /** Wallet session claim credential - ONLY visible to relay server */\n walletSessionClaim: WalletSessionClaim;\n\n /** Actual message payload */\n payload: WalletMessagePayload;\n}\n\n/**\n * Claim session payload\n * Used to claim exclusive ownership of a session\n */\nexport interface ClaimSessionPayload {\n type: 'claim_session';\n /** Wallet's public key for ECDH key exchange in format \"algorithm:base64_public_key\" (e.g., \"AES-GCM:...\") */\n walletPublicKey: string;\n}\n\n/**\n * Prefetch metadata payload\n * Used to retrieve dApp metadata for user approval\n */\nexport interface PrefetchMetadataPayload {\n type: 'prefetch_metadata';\n}\n\n/**\n * Connection rejected payload\n * Notifies dApp that user rejected connection\n */\nexport interface ConnectionRejectedPayload {\n type: 'connection_rejected';\n encrypted: EncryptedPayload;\n}\n\n/**\n * Authenticate connection payload\n * Completes authentication with signed message\n */\nexport interface AuthenticateConnectionPayload {\n type: 'authenticate_connection';\n encrypted: EncryptedPayload;\n}\n\n/**\n * Wallet reconnect payload\n * Used to reconnect after network interruption with re-handshake support\n */\nexport interface WalletReconnectPayload {\n type: 'wallet_reconnect';\n /** Wallet's public key for ECDH key exchange in format \"algorithm:base64_public_key\" (e.g., \"AES-GCM:...\") */\n walletPublicKey: string;\n}\n\n/**\n * Union type for all wallet message payloads\n */\nexport type WalletMessagePayload =\n // Connection flow payloads\n | ClaimSessionPayload\n | PrefetchMetadataPayload\n | ConnectionRejectedPayload\n | AuthenticateConnectionPayload\n | WalletReconnectPayload\n | CloseSessionPayload\n // Post-authentication operation payloads (v2.1+)\n | RequestFulfilledPayload\n | RequestRejectedPayload;\n\n/**\n * Decrypted rejection data (visible only to dApp after decryption)\n */\nexport interface RejectionData {\n reason?: string;\n timestamp: number;\n}\n\n/**\n * Decrypted authentication data (visible only to dApp after decryption)\n */\nexport interface AuthenticationData {\n /** Wallet address */\n address: string;\n\n /** Signature of the SIWE message */\n signature: string;\n\n /** Full SIWE message that was signed */\n message: string;\n\n /** Chain ID (EIP-155) */\n chainId: number;\n\n /** Network identifier (e.g., \"ethereum\", \"polygon\") */\n network?: string;\n\n /** Signing algorithm (e.g., \"ECDSA\", \"EdDSA\") */\n signingAlgo?: string;\n\n /** Optional wallet metadata */\n walletMetadata?: WalletMetadata;\n}\n\n/**\n * Wallet metadata\n */\nexport interface WalletMetadata {\n /** Wallet name */\n name: string;\n\n /** Wallet version */\n version?: string;\n\n /** Wallet icon URL */\n icon?: string;\n\n /** Wallet description */\n description?: string;\n\n /** Wallet website URL */\n url?: string;\n\n /** Wallet provider type */\n provider?: string;\n}\n\n/**\n * Messages sent from relay to dApp (session claim stripped)\n */\n\n/**\n * Wallet handshake message\n * Initiates cryptographic handshake by sharing wallet's public key\n * and notifying dApp that wallet is reviewing connection\n */\nexport interface WalletHandshakeMessage {\n type: 'wallet_handshake';\n status: 'reviewing';\n /** Wallet's public key in format \"algorithm:base64_public_key\" (e.g., \"AES-GCM:...\") */\n walletPublicKey: string;\n timestamp: number;\n}\n\n/**\n * Connection rejected message\n * Forwards rejection to dApp (encrypted)\n */\nexport interface ConnectionRejectedMessage {\n type: 'connection_rejected';\n encrypted: EncryptedPayload;\n}\n\n/**\n * Connection authenticated message\n * Forwards authentication data to dApp (encrypted)\n */\nexport interface ConnectionAuthenticatedMessage {\n type: 'connection_authenticated';\n encrypted: EncryptedPayload;\n}\n\n/**\n * Prefetch metadata response\n * Returns dApp metadata to wallet\n */\nexport interface PrefetchMetadataResponse {\n dappMetadata: DAppMetadata;\n sessionConfig?: SessionConfig;\n}\n\n/**\n * Union type for relay-to-dApp messages\n */\nexport type RelayToDAppMessage =\n | WalletHandshakeMessage\n | ConnectionRejectedMessage\n | ConnectionAuthenticatedMessage;\n\nexport type RelayToWalletMessage = ClientHandshakeMessage;\n\n/**\n * Type guards for wallet messages\n */\nexport function isClaimSessionPayload(payload: WalletMessagePayload): payload is ClaimSessionPayload {\n return payload?.type === 'claim_session';\n}\n\nexport function isPrefetchMetadataPayload(payload: WalletMessagePayload): payload is PrefetchMetadataPayload {\n return payload?.type === 'prefetch_metadata';\n}\n\nexport function isConnectionRejectedPayload(payload: WalletMessagePayload): payload is ConnectionRejectedPayload {\n return payload?.type === 'connection_rejected';\n}\n\nexport function isAuthenticateConnectionPayload(payload: WalletMessagePayload): payload is AuthenticateConnectionPayload {\n return payload?.type === 'authenticate_connection';\n}\n\nexport function isWalletReconnectPayload(payload: WalletMessagePayload): payload is WalletReconnectPayload {\n return payload?.type === 'wallet_reconnect';\n}\n\n/**\n * Type guards for relay-to-dApp messages\n */\nexport function isWalletHandshakeMessage(message: RelayToDAppMessage): message is WalletHandshakeMessage {\n return message?.type === 'wallet_handshake';\n}\n\nexport function isConnectionRejectedMessage(message: RelayToDAppMessage): message is ConnectionRejectedMessage {\n return message?.type === 'connection_rejected';\n}\n\nexport function isConnectionAuthenticatedMessage(message: RelayToDAppMessage): message is ConnectionAuthenticatedMessage {\n return message?.type === 'connection_authenticated';\n}\n","/**\n * Client message types for BananaLink protocol v2.0\n * These types define the communication between dApp clients and the relay server\n */\n\nimport type {\n SignMessageRequestPayload,\n SignTypedDataRequestPayload,\n SignTransactionRequestPayload,\n} from './post-auth-operations';\n\n/**\n * Client session claim credential for authentication and reconnection\n * Stored by client, validated by relay server\n */\nexport interface ClientSessionClaim {\n /**\n * Unique nonce for this client session\n * - Generated once by client during session creation\n * - Stored locally by client for reconnection\n * - Used by relay to validate client ownership\n * - Different for each session\n */\n claimNonce: string;\n\n /** Claim generation timestamp */\n timestamp: number;\n}\n\n/**\n * Client reconnect payload\n * Used to reconnect after network interruption with re-handshake support\n */\nexport interface ClientReconnectPayload {\n type: 'client_reconnect';\n /** Client session claim for authentication */\n sessionClaim: ClientSessionClaim;\n /** Client's public key for ECDH key exchange in format \"algorithm:base64_public_key\" (e.g., \"AES-GCM:...\") */\n clientPublicKey: string;\n}\n\n/**\n * Client handshake message\n * Sent during re-handshake when client is the connected party responding to wallet reconnect\n */\nexport interface ClientHandshakeMessage {\n type: 'client_handshake';\n /** Client's public key for ECDH key exchange in format \"algorithm:base64_public_key\" (e.g., \"AES-GCM:...\") */\n clientPublicKey: string;\n /** Message timestamp */\n timestamp: number;\n}\n\n/**\n * Close session payload\n * Used to gracefully close a session (bidirectional)\n */\nexport interface CloseSessionPayload {\n type: 'close_session';\n /** Optional reason for closing the session */\n reason?: string;\n}\n\n/**\n * Union type for all client message payloads\n */\nexport type ClientMessagePayload =\n // Session management payloads\n | ClientReconnectPayload\n | CloseSessionPayload\n // Re-handshake payload (sent by connected client when wallet reconnects)\n | ClientHandshakeMessage\n // Post-authentication operation request payloads (v2.1+)\n | SignMessageRequestPayload\n | SignTypedDataRequestPayload\n | SignTransactionRequestPayload;\n\n/**\n * Client message envelope structure\n * All client-to-relay messages use this envelope\n */\nexport interface ClientMessageEnvelope {\n /** Session identifier */\n sessionId: string;\n\n /** Client session claim - validated by relay server */\n clientSessionClaim: ClientSessionClaim;\n\n /** Actual message payload */\n payload: ClientMessagePayload;\n}\n\n/**\n * Type guards for client messages\n */\nexport function isClientReconnectPayload(payload: ClientMessagePayload): payload is ClientReconnectPayload {\n return payload?.type === 'client_reconnect';\n}\n\nexport function isCloseSessionPayload(payload: ClientMessagePayload): payload is CloseSessionPayload {\n return payload?.type === 'close_session';\n}\n\n/**\n * Type guard for client handshake message (used during re-handshake)\n */\nexport function isClientHandshakeMessage(message: unknown): message is ClientHandshakeMessage {\n return (message as ClientHandshakeMessage)?.type === 'client_handshake';\n}\n","/**\n * Relay notification message types for BananaLink protocol v2.0\n * These are messages sent from relay server to clients/wallets\n */\n\n/**\n * Session closed acknowledgment\n * Sent to acknowledge a close_session request\n */\nexport interface SessionClosedAck {\n type: 'session_closed_ack';\n timestamp: number;\n}\n\n/**\n * Session closed notification\n * Sent to notify the other party that peer closed the session\n */\nexport interface SessionClosedNotification {\n type: 'session_closed_notification';\n /** Which party closed the session */\n closedBy: 'client' | 'wallet';\n /** Optional reason for closure */\n reason?: string;\n timestamp: number;\n}\n\n/**\n * Reconnected confirmation message\n * Sent after successful reconnection\n */\nexport interface ReconnectedMessage {\n type: 'reconnected';\n /** Number of messages that were queued during disconnection */\n queuedMessages: number;\n timestamp: number;\n}\n\n/**\n * Union type for relay notification messages\n */\nexport type RelayNotificationMessage =\n | SessionClosedAck\n | SessionClosedNotification\n | ReconnectedMessage;\n\n/**\n * Type guards for relay notification messages\n */\nexport function isSessionClosedAck(message: RelayNotificationMessage): message is SessionClosedAck {\n return message?.type === 'session_closed_ack';\n}\n\nexport function isSessionClosedNotification(message: RelayNotificationMessage): message is SessionClosedNotification {\n return message?.type === 'session_closed_notification';\n}\n\nexport function isReconnectedMessage(message: RelayNotificationMessage): message is ReconnectedMessage {\n return message?.type === 'reconnected';\n}\n","/**\n * Public key compression utilities for compact URL encoding\n *\n * These utilities convert public keys between standard base64 format\n * and compact base64url format for use in QR codes and URLs.\n */\n\n/**\n * Compress a public key for compact URLs\n * Removes AES-GCM: prefix and uses base64url without padding\n *\n * @param publicKey - Public key in format \"AES-GCM:base64string\" or \"base64string\"\n * @returns Compressed public key in base64url format without padding\n */\nexport function compressPublicKey(publicKey: string): string {\n // Remove AES-GCM: prefix if present\n const keyWithoutPrefix = publicKey.startsWith('AES-GCM:')\n ? publicKey.slice(8)\n : publicKey;\n\n // Convert base64 to base64url (replace + with -, / with _, remove padding)\n return keyWithoutPrefix\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n}\n\n/**\n * Decompress a public key from compact format\n * Adds back AES-GCM: prefix and restores base64 padding\n *\n * @param compressedKey - Compressed public key in base64url format\n * @returns Public key in format \"AES-GCM:base64string\"\n */\nexport function decompressPublicKey(compressedKey: string): string {\n // Convert base64url back to base64\n let base64Key = compressedKey\n .replace(/-/g, '+')\n .replace(/_/g, '/');\n\n // Add padding if needed\n const padding = base64Key.length % 4;\n if (padding > 0) {\n base64Key += '='.repeat(4 - padding);\n }\n\n // Add AES-GCM prefix if not already present\n return base64Key.startsWith('AES-GCM:') ? base64Key : `AES-GCM:${base64Key}`;\n}\n","import type { QRPayload } from '../types/discovery';\nimport { DEEPLINK_SCHEME } from '../constants';\nimport { compressPublicKey } from './public-keys';\n\n/**\n * Provider shortcodes for compact URLs\n */\nconst PROVIDER_SHORTCODES: Record<string, string> = {\n 'uwebsockets': 'u', // Legacy - API may still return this\n 'websocket': 'w',\n 'pusher': 'p',\n 'ably': 'a',\n};\n\n/**\n * Production relay URLs that should be omitted in compact format (most common case)\n */\nconst PRODUCTION_RELAY_URLS = [\n 'wss://relay.banana.link/v1',\n 'https://relay.banana.link/v1',\n];\n\n/**\n * Environment shortcodes for non-production relay URLs\n */\nconst RELAY_SHORTCODES: Record<string, string> = {\n 'wss://relay.dev.banana.link/v1': 'd',\n 'https://relay.dev.banana.link/v1': 'd',\n 'wss://relay.staging.banana.link/v1': 's', // Future staging environment\n 'https://relay.staging.banana.link/v1': 's',\n};\n\n/**\n * Safely encode a URL parameter value\n * Uses encodeURIComponent to handle special characters like +, /, =\n */\nexport function encodeUrlParameter(value: string): string {\n return encodeURIComponent(value);\n}\n\n/**\n * Build a query string with properly encoded parameters\n */\nexport function buildQueryString(params: Record<string, string | undefined>): string {\n const pairs: string[] = [];\n\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined) {\n pairs.push(`${encodeUrlParameter(key)}=${encodeUrlParameter(value)}`);\n }\n }\n\n return pairs.join('&');\n}\n\n/**\n * Create a compact deep link URL with shortened parameters\n * Uses single-letter parameters to minimize QR code size\n */\nexport function encodeCompactConnectionString(payload: QRPayload): string {\n const params: Record<string, string | undefined> = {\n s: payload.sessionId, // sessionId -> s\n k: compressPublicKey(payload.publicKey), // publicKey -> k (compressed)\n };\n\n // Add optional parameters with shortcodes\n if (payload.providerId) {\n params.p = PROVIDER_SHORTCODES[payload.providerId] || payload.providerId;\n }\n\n // Handle relay URL compression:\n // - Production: omit entirely (most common case)\n // - Development/Staging: use shortcode (r=d, r=s)\n // - Custom: use full URL\n if (payload.relayUrl) {\n if (PRODUCTION_RELAY_URLS.includes(payload.relayUrl)) {\n // Production relay - omit parameter entirely for maximum compression\n // This will be the most common case, so QR codes will be smallest\n } else if (RELAY_SHORTCODES[payload.relayUrl]) {\n // Known environment (dev/staging) - use shortcode\n params.r = RELAY_SHORTCODES[payload.relayUrl];\n } else {\n // Custom relay URL - include full URL\n params.r = payload.relayUrl;\n }\n }\n\n const queryString = buildQueryString(params);\n return `${DEEPLINK_SCHEME}://connect?${queryString}`;\n}\n\n/**\n * Create a deep link URL with properly encoded parameters\n * Uses full parameter names for readability\n */\nexport function encodeConnectionString(payload: QRPayload): string {\n const params: Record<string, string | undefined> = {\n sessionId: payload.sessionId,\n publicKey: payload.publicKey,\n };\n\n // Add optional parameters\n if (payload.providerId) {\n params.providerId = payload.providerId;\n }\n\n if (payload.relayUrl) {\n params.relay = payload.relayUrl;\n }\n\n const queryString = buildQueryString(params);\n return `${DEEPLINK_SCHEME}://connect?${queryString}`;\n}\n\n/**\n * Create a universal link (HTTPS) with properly encoded parameters\n */\nexport function encodeUniversalLink(payload: QRPayload, options: {\n baseUrl?: string;\n fallbackUrl?: string;\n} = {}): string {\n const {\n baseUrl = 'https://banana.link',\n fallbackUrl = 'https://banana.link/download',\n } = options;\n\n const params: Record<string, string | undefined> = {\n sessionId: payload.sessionId,\n key: payload.publicKey, // Use 'key' instead of 'publicKey' for universal links\n fallback: fallbackUrl,\n };\n\n // Add optional parameters\n if (payload.providerId) {\n params.provider = payload.providerId;\n }\n\n if (payload.relayUrl) {\n params.relay = payload.relayUrl;\n }\n\n const queryString = buildQueryString(params);\n return `${baseUrl}/connect?${queryString}`;\n}\n","import type { QRPayload } from '../types/discovery';\nimport { decompressPublicKey } from './public-keys';\n\n/**\n * Provider shortcodes reverse mapping for compact URL decoding\n */\nconst PROVIDER_SHORTCODES_REVERSE: Record<string, string> = {\n 'u': 'websocket', // Decode legacy 'u' to new 'websocket' name\n 'w': 'websocket',\n 'p': 'pusher',\n 'a': 'ably',\n};\n\n/**\n * Environment shortcodes reverse mapping for relay URL decoding\n */\nconst RELAY_SHORTCODES_REVERSE: Record<string, string> = {\n 'd': 'wss://relay.dev.banana.link/v1',\n 's': 'wss://relay.staging.banana.link/v1',\n};\n\n/**\n * Safely decode a URL parameter value\n * Uses decodeURIComponent to restore special characters\n */\nexport function decodeUrlParameter(value: string): string {\n return decodeURIComponent(value);\n}\n\n/**\n * Parse a query string with properly decoded parameters\n */\nexport function parseQueryString(query: string): Record<string, string> {\n const params: Record<string, string> = {};\n\n // Remove leading ? if present\n const cleanQuery = query.startsWith('?') ? query.slice(1) : query;\n\n if (!cleanQuery) {\n return params;\n }\n\n for (const pair of cleanQuery.split('&')) {\n const [key, ...valueParts] = pair.split('=');\n if (key) {\n const value = valueParts.join('='); // Handle values that contain =\n params[decodeUrlParameter(key)] = decodeUrlParameter(value);\n }\n }\n\n return params;\n}\n\n/**\n * Parse a connection string and extract the QRPayload with proper decoding\n * Supports both full format and compact format\n */\nexport function decodeConnectionString(connectionString: string): QRPayload {\n let url: URL;\n\n try {\n url = new URL(connectionString);\n } catch {\n throw new Error(`Invalid connection string format: ${connectionString}`);\n }\n\n // Parse query parameters using our safe decoder\n const params = parseQueryString(url.search);\n\n // Support both compact and full parameter formats\n const sessionId = params.sessionId || params.s; // full or compact\n let publicKey = params.publicKey || params.key || params.k; // full, universal, or compact\n let providerId = params.providerId || params.provider || params.p; // full, alt, or compact\n let relayUrl = params.relay || params.r; // full or compact\n\n if (!sessionId || !publicKey) {\n throw new Error('Missing required parameters: sessionId and publicKey');\n }\n\n // If we have a compact format public key (params.k), decompress it\n if (params.k && !params.publicKey && !params.key) {\n publicKey = decompressPublicKey(params.k);\n }\n\n // If we have a compact format provider, expand it\n if (params.p && !params.providerId && !params.provider) {\n providerId = PROVIDER_SHORTCODES_REVERSE[params.p] || params.p;\n }\n\n // Handle relay URL decompression:\n // - No relay parameter = production (default)\n // - Shortcode (d, s) = expand to full environment URL\n // - Full URL = use as-is\n if (!relayUrl) {\n // No relay parameter means production (most common case)\n relayUrl = 'wss://relay.banana.link/v1';\n } else if (RELAY_SHORTCODES_REVERSE[relayUrl]) {\n // Environment shortcode - expand to full URL\n relayUrl = RELAY_SHORTCODES_REVERSE[relayUrl];\n }\n // else: already a full URL, use as-is\n\n // Ensure public key has AES-GCM prefix for backward compatibility\n if (publicKey && !publicKey.startsWith('AES-GCM:')) {\n publicKey = `AES-GCM:${publicKey}`;\n }\n\n return {\n sessionId,\n publicKey,\n providerId: providerId || undefined,\n relayUrl: relayUrl || undefined,\n };\n}\n\n/**\n * Validate that a string is a valid connection string\n */\nexport function isValidConnectionString(connectionString: string): boolean {\n try {\n decodeConnectionString(connectionString);\n return true;\n } catch {\n return false;\n }\n}\n","/**\n * Session claiming mechanism utilities for BananaLink protocol v2.0\n * Implements secure session ownership and reconnection logic\n */\n\nimport type { WalletSessionClaim, WalletMessageEnvelope } from '../types/wallet-messages';\n\n/**\n * Wallet session claim storage interface\n * Implementations should provide secure storage for wallet session claims\n */\nexport interface WalletSessionClaimStorage {\n store(sessionId: string, claim: WalletSessionClaim): Promise<void>;\n retrieve(sessionId: string): Promise<WalletSessionClaim | null>;\n remove(sessionId: string): Promise<void>;\n clear(): Promise<void>;\n}\n\n/**\n * Wallet session claim manager for handling claim generation and validation\n */\nexport class WalletSessionClaimManager {\n constructor(private storage: WalletSessionClaimStorage) {}\n\n /**\n * Generate a new wallet session claim with provided nonce\n * @param sessionId - Session identifier\n * @param sessionNonce - Pre-generated cryptographically secure nonce (use @bananalink-sdk/crypto)\n * @returns Generated wallet session claim\n */\n async generateClaim(sessionId: string, sessionNonce: string): Promise<WalletSessionClaim> {\n const claim: WalletSessionClaim = {\n sessionNonce,\n timestamp: Date.now(),\n };\n\n // Store the claim for future reconnection\n await this.storage.store(sessionId, claim);\n\n return claim;\n }\n\n /**\n * Retrieve an existing wallet session claim\n * @param sessionId - Session identifier\n * @returns Stored wallet session claim or null if not found\n */\n async getClaim(sessionId: string): Promise<WalletSessionClaim | null> {\n return this.storage.retrieve(sessionId);\n }\n\n /**\n * Validate a wallet session claim for reconnection\n * @param claim - Claim to validate\n * @param storedClaim - Previously stored claim\n * @returns Validation result\n */\n validateReconnectionClaim(\n claim: WalletSessionClaim,\n storedClaim: WalletSessionClaim\n ): { valid: boolean; reason?: string } {\n // Check nonce match\n if (claim.sessionNonce !== storedClaim.sessionNonce) {\n return {\n valid: false,\n reason: 'Session nonce mismatch - invalid reconnection attempt',\n };\n }\n\n // Check timestamp validity (prevent very old reconnection attempts)\n const MAX_RECONNECTION_AGE = 24 * 60 * 60 * 1000; // 24 hours\n const claimAge = Date.now() - claim.timestamp;\n if (claimAge > MAX_RECONNECTION_AGE) {\n return {\n valid: false,\n reason: 'Session claim too old - please create a new session',\n };\n }\n\n return { valid: true };\n }\n\n /**\n * Remove a wallet session claim (on session end)\n * @param sessionId - Session identifier\n */\n async removeClaim(sessionId: string): Promise<void> {\n await this.storage.remove(sessionId);\n }\n\n /**\n * Clear all stored claims\n */\n async clearAllClaims(): Promise<void> {\n await this.storage.clear();\n }\n}\n\n// NOTE: Nonce generation moved to @bananalink-sdk/crypto package to avoid circular dependencies\n// SDKs should use crypto.generateSessionNonce() before creating session claims\n\n/**\n * Create a wallet message envelope with wallet session claim\n * @param sessionId - Session identifier\n * @param claim - Wallet session claim\n * @param payload - Message payload\n * @returns Complete wallet message envelope\n */\nexport function createWalletMessageEnvelope(\n sessionId: string,\n claim: WalletSessionClaim,\n payload: WalletMessageEnvelope['payload']\n): WalletMessageEnvelope {\n return {\n sessionId,\n walletSessionClaim: claim,\n payload,\n };\n}\n\n/**\n * Strip wallet session claim from wallet message for forwarding to dApp\n * @param envelope - Original wallet message envelope\n * @returns Message without wallet session claim\n */\nexport function stripWalletSessionClaim(\n envelope: WalletMessageEnvelope\n): Omit<WalletMessageEnvelope, 'walletSessionClaim'> {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { walletSessionClaim, ...messageWithoutClaim } = envelope;\n return messageWithoutClaim;\n}\n\n/**\n * Validate session claim timestamp for replay attack prevention\n * @param timestamp - Claim timestamp\n * @param maxAge - Maximum age in milliseconds (default: 30 seconds)\n * @returns True if timestamp is within valid range\n */\nexport function validateClaimTimestamp(\n timestamp: number,\n maxAge: number = 30 * 1000\n): boolean {\n const now = Date.now();\n const age = Math.abs(now - timestamp);\n return age <= maxAge;\n}\n\n/**\n * Validate wallet message envelope\n * @param envelope - Message envelope to validate\n * @returns Validation result\n */\nexport function validateWalletMessageEnvelope(\n envelope: WalletMessageEnvelope\n): { valid: boolean; errors: string[] } {\n const errors: string[] = [];\n\n // Check required fields\n if (!envelope.sessionId) {\n errors.push('Missing session ID');\n }\n\n if (!envelope.walletSessionClaim) {\n errors.push('Missing wallet session claim');\n } else {\n // Validate claim structure\n if (!envelope.walletSessionClaim.sessionNonce) {\n errors.push('Missing session nonce in wallet session claim');\n }\n if (!envelope.walletSessionClaim.timestamp) {\n errors.push('Missing timestamp in wallet session claim');\n } else if (!validateClaimTimestamp(envelope.walletSessionClaim.timestamp)) {\n errors.push('Wallet session claim timestamp is too old or invalid');\n }\n }\n\n if (!envelope.payload) {\n errors.push('Missing message payload');\n } else if (!envelope.payload.type) {\n errors.push('Missing payload type');\n }\n\n return {\n valid: errors.length === 0,\n errors,\n };\n}\n","/**\n * Client session claim utilities for BananaLink protocol v2.0\n * Implements secure client session ownership and reconnection logic\n */\n\nimport type { ClientSessionClaim, ClientMessageEnvelope } from '../types/client-messages';\n\n/**\n * Client session claim storage interface\n * Implementations should provide secure storage for client session claims\n */\nexport interface ClientSessionClaimStorage {\n store(sessionId: string, claim: ClientSessionClaim): Promise<void>;\n retrieve(sessionId: string): Promise<ClientSessionClaim | null>;\n remove(sessionId: string): Promise<void>;\n clear(): Promise<void>;\n}\n\n/**\n * Client session claim manager for handling claim generation and validation\n */\nexport class ClientSessionClaimManager {\n constructor(private storage: ClientSessionClaimStorage) {}\n\n /**\n * Generate a new client session claim with provided nonce\n * @param sessionId - Session identifier\n * @param claimNonce - Pre-generated cryptographically secure nonce (use @bananalink-sdk/crypto)\n * @returns Generated client session claim\n */\n async generateClaim(sessionId: string, claimNonce: string): Promise<ClientSessionClaim> {\n const claim: ClientSessionClaim = {\n claimNonce,\n timestamp: Date.now(),\n };\n\n // Store the claim for future reconnection\n await this.storage.store(sessionId, claim);\n\n return claim;\n }\n\n /**\n * Retrieve an existing client session claim\n * @param sessionId - Session identifier\n * @returns Stored client session claim or null if not found\n */\n async getClaim(sessionId: string): Promise<ClientSessionClaim | null> {\n return this.storage.retrieve(sessionId);\n }\n\n /**\n * Validate a client session claim for reconnection\n * @param claim - Claim to validate\n * @param storedClaim - Previously stored claim\n * @returns Validation result\n */\n validateReconnectionClaim(\n claim: ClientSessionClaim,\n storedClaim: ClientSessionClaim\n ): { valid: boolean; reason?: string } {\n // Check nonce match\n if (claim.claimNonce !== storedClaim.claimNonce) {\n return {\n valid: false,\n reason: 'Client claim nonce mismatch - invalid reconnection attempt',\n };\n }\n\n // Check timestamp validity (prevent very old reconnection attempts)\n const MAX_RECONNECTION_AGE = 24 * 60 * 60 * 1000; // 24 hours\n const claimAge = Date.now() - claim.timestamp;\n if (claimAge > MAX_RECONNECTION_AGE) {\n return {\n valid: false,\n reason: 'Client session claim too old - please create a new session',\n };\n }\n\n return { valid: true };\n }\n\n /**\n * Remove a client session claim (on session end)\n * @param sessionId - Session identifier\n */\n async removeClaim(sessionId: string): Promise<void> {\n await this.storage.remove(sessionId);\n }\n\n /**\n * Clear all stored claims\n */\n async clearAllClaims(): Promise<void> {\n await this.storage.clear();\n }\n}\n\n// NOTE: Nonce generation moved to @bananalink-sdk/crypto package to avoid circular dependencies\n// SDKs should use crypto.generateClientClaimNonce() before creating client session claims\n\n/**\n * Create a client message envelope with session claim\n * @param sessionId - Session identifier\n * @param claim - Client session claim\n * @param payload - Message payload\n * @returns Complete client message envelope\n */\nexport function createClientMessageEnvelope(\n sessionId: string,\n claim: ClientSessionClaim,\n payload: ClientMessageEnvelope['payload']\n): ClientMessageEnvelope {\n return {\n sessionId,\n clientSessionClaim: claim,\n payload,\n };\n}\n\n/**\n * Strip client session claim from client message for forwarding\n * @param envelope - Original client message envelope\n * @returns Message without client session claim\n */\nexport function stripClientSessionClaim(\n envelope: ClientMessageEnvelope\n): Omit<ClientMessageEnvelope, 'clientSessionClaim'> {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { clientSessionClaim, ...messageWithoutClaim } = envelope;\n return messageWithoutClaim;\n}\n\n/**\n * Validate client session claim timestamp for replay attack prevention\n * @param timestamp - Claim timestamp\n * @param maxAge - Maximum age in milliseconds (default: 30 seconds)\n * @returns True if timestamp is within valid range\n */\nexport function validateClientClaimTimestamp(\n timestamp: number,\n maxAge: number = 30 * 1000\n): boolean {\n const now = Date.now();\n const age = Math.abs(now - timestamp);\n return age <= maxAge;\n}\n\n/**\n * Validate client message envelope\n * @param envelope - Message envelope to validate\n * @returns Validation result\n */\nexport function validateClientMessageEnvelope(\n envelope: ClientMessageEnvelope\n): { valid: boolean; errors: string[] } {\n const errors: string[] = [];\n\n // Check required fields\n if (!envelope.sessionId) {\n errors.push('Missing session ID');\n }\n\n if (!envelope.clientSessionClaim) {\n errors.push('Missing client session claim');\n } else {\n // Validate claim structure\n if (!envelope.clientSessionClaim.claimNonce) {\n errors.push('Missing claim nonce in client session claim');\n }\n if (!envelope.clientSessionClaim.timestamp) {\n errors.push('Missing timestamp in client session claim');\n } else if (!validateClientClaimTimestamp(envelope.clientSessionClaim.timestamp)) {\n errors.push('Client session claim timestamp is too old or invalid');\n }\n }\n\n if (!envelope.payload) {\n errors.push('Missing message payload');\n } else if (!envelope.payload.type) {\n errors.push('Missing payload type');\n }\n\n return {\n valid: errors.length === 0,\n errors,\n };\n}\n","/**\n * Protocol utility functions\n *\n * This module provides utility functions that are specific to the BananaLink protocol.\n * SDK-specific utilities are implemented in their respective packages.\n */\n\nimport { generateUUID } from '../crypto/utils';\n\n/**\n * Generate a cryptographically secure session ID in RFC 4122 UUID v4 format\n *\n * This function delegates to the protocol crypto layer for mobile-safe UUID generation.\n * For direct access to UUID generation, prefer importing from @bananalink-sdk/protocol/crypto.\n *\n * @returns UUID v4 string (e.g., \"550e8400-e29b-41d4-a716-446655440000\")\n *\n * @example\n * const sessionId = generateSessionId();\n * // => \"a3bb189e-8bf9-4bdc-9f16-9f48a6a1e3e7\"\n */\nexport function generateSessionId(): string {\n return generateUUID();\n}\n\n// Protocol-specific utility that might be needed across packages\nexport function isValidProtocolVersion(version: string): boolean {\n // Only support version \"1\" for now\n return version === '1';\n}\n\n// Protocol-specific session ID validation\nexport function isValidSessionId(sessionId: string): boolean {\n // Session IDs should be valid UUIDs\n const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n return uuidRegex.test(sessionId);\n}\n\n// Export public key compression utilities\nexport * from './public-keys';\n\n// Export URL encoding and decoding utilities\nexport * from './url-encoding';\nexport * from './url-decoding';\n\n// Note: SIWE utilities have been moved to '@bananalink-sdk/protocol/siwe'\n// For ERC-4361 message construction and validation, import from '@bananalink-sdk/protocol/siwe'\n// Type-only definitions (SIWEFields, SIWEMessageOptions) remain available from main export\n\n// Export wallet session claiming utilities\nexport * from './wallet-session-claim';\n\n// Export client session claiming utilities\nexport * from './client-session-claim';\n","{\n \"name\": \"@bananalink-sdk/protocol\",\n \"version\": \"1.4.0\",\n \"description\": \"Core protocol definitions for BananaLink. Provides TypeScript types, Zod validation schemas, cryptographic utilities, and shared constants for wallet connections.\",\n \"type\": \"module\",\n \"keywords\": [\n \"bananalink\",\n \"protocol\",\n \"types\",\n \"schemas\",\n \"validation\",\n \"cryptography\",\n \"web3\"\n ],\n \"bugs\": {\n \"url\": \"https://github.com/bananalink/bananalink/issues\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/bananalink/bananalink.git\",\n \"directory\": \"packages/protocol\"\n },\n \"license\": \"ISC\",\n \"author\": \"BananaLink Team <team@banana.link>\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"react-native\": \"./dist/index.js\",\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n },\n \"./schemas\": {\n \"types\": \"./dist/schemas-export.d.ts\",\n \"react-native\": \"./dist/schemas-export.js\",\n \"import\": \"./dist/schemas-export.js\",\n \"require\": \"./dist/schemas-export.cjs\"\n },\n \"./validators\": {\n \"types\": \"./dist/validators-export.d.ts\",\n \"react-native\": \"./dist/validators-export.js\",\n \"import\": \"./dist/validators-export.js\",\n \"require\": \"./dist/validators-export.cjs\"\n },\n \"./validation\": {\n \"types\": \"./dist/validation-export.d.ts\",\n \"react-native\": \"./dist/validation-export.js\",\n \"import\": \"./dist/validation-export.js\",\n \"require\": \"./dist/validation-export.cjs\"\n },\n \"./siwe\": {\n \"types\": \"./dist/siwe-export.d.ts\",\n \"react-native\": \"./dist/siwe-export.js\",\n \"import\": \"./dist/siwe-export.js\",\n \"require\": \"./dist/siwe-export.cjs\"\n },\n \"./crypto\": {\n \"types\": \"./dist/crypto-export.d.ts\",\n \"react-native\": \"./dist/crypto-export.js\",\n \"import\": \"./dist/crypto-export.js\",\n \"require\": \"./dist/crypto-export.cjs\"\n },\n \"./crypto/provider/webcrypto\": {\n \"types\": \"./dist/crypto/providers/webcrypto-provider.d.ts\",\n \"react-native\": \"./dist/crypto/providers/webcrypto-provider.js\",\n \"import\": \"./dist/crypto/providers/webcrypto-provider.js\",\n \"require\": \"./dist/crypto/providers/webcrypto-provider.cjs\"\n },\n \"./crypto/provider/node\": {\n \"types\": \"./dist/crypto/providers/node-provider.d.ts\",\n \"react-native\": \"./dist/crypto/providers/node-provider.js\",\n \"import\": \"./dist/crypto/providers/node-provider.js\",\n \"require\": \"./dist/crypto/providers/node-provider.cjs\"\n },\n \"./crypto/provider/noble\": {\n \"types\": \"./dist/crypto/providers/noble-provider.d.ts\",\n \"react-native\": \"./dist/crypto/providers/noble-provider.js\",\n \"import\": \"./dist/crypto/providers/noble-provider.js\",\n \"require\": \"./dist/crypto/providers/noble-provider.cjs\"\n },\n \"./crypto/provider/quickcrypto\": {\n \"types\": \"./dist/crypto/providers/quickcrypto-provider.d.ts\",\n \"react-native\": \"./dist/crypto/providers/quickcrypto-provider.js\",\n \"import\": \"./dist/crypto/providers/quickcrypto-provider.js\",\n \"require\": \"./dist/crypto/providers/quickcrypto-provider.cjs\"\n },\n \"./testing\": {\n \"types\": \"./dist/testing.d.ts\",\n \"react-native\": \"./dist/testing.js\",\n \"import\": \"./dist/testing.js\",\n \"require\": \"./dist/testing.cjs\"\n }\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"files\": [\n \"dist\",\n \"src\",\n \"!src/__tests__\"\n ],\n \"publishConfig\": {\n \"access\": \"restricted\"\n },\n \"scripts\": {\n \"build\": \"tsup\",\n \"clean\": \"rm -rf dist node_modules\",\n \"dev\": \"tsup --watch\",\n \"lint\": \"eslint src --ext .ts\",\n \"test\": \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"typecheck\": \"tsc --noEmit\"\n },\n \"dependencies\": {\n \"@bananalink-sdk/logger\": \"workspace:*\",\n \"@noble/ciphers\": \"^2.0.0\",\n \"@noble/curves\": \"^2.0.0\",\n \"@noble/hashes\": \"^2.0.0\",\n \"zod\": \"^3.25.67\"\n },\n \"devDependencies\": {\n \"@bananalink-sdk/eslint-config\": \"workspace:*\",\n \"@bananalink-sdk/typescript-config\": \"workspace:*\",\n \"@types/node\": \"^24.1.0\",\n \"@vitest/coverage-v8\": \"^3.2.4\",\n \"eslint\": \"^9.29.0\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.8.3\",\n \"vitest\": \"^3.2.4\"\n },\n \"peerDependencies\": {\n \"react-native-quick-crypto\": \"^0.7.0\"\n },\n \"peerDependenciesMeta\": {\n \"react-native-quick-crypto\": {\n \"optional\": true\n }\n },\n \"packageManager\": \"pnpm@10.15.1\"\n}\n","/**\n * BananaLink Protocol Package\n *\n * Core TypeScript implementation of the BananaLink protocol for dApp-to-wallet communication.\n * Provides types, schemas, constants, and utilities for implementing BananaLink clients and wallets.\n *\n * @packageDocumentation\n */\n\n// Core protocol types\nexport * from './types/core';\nexport * from './types/auth';\nexport * from './types/crypto';\nexport * from './types/discovery';\nexport * from './types/errors';\nexport * from './types/providers';\nexport * from './types/wallet-messages';\nexport * from './types/client-messages';\nexport * from './types/relay-messages';\nexport * from './types/persistence';\n\n// Note: Zod validation schemas have been moved to '@bananalink-sdk/protocol/schemas'\n// For runtime validation, import from '@bananalink-sdk/protocol/schemas'\n// Type-only definitions remain available from this main export\n\n// Note: SIWE utilities have been moved to '@bananalink-sdk/protocol/siwe'\n// For ERC-4361 message construction/parsing, import from '@bananalink-sdk/protocol/siwe'\n// Export SIWE types for convenience (type-only, no runtime code)\nexport type { SIWEMessageOptions } from './utils/siwe';\n\n// Constants and utilities\nexport * from './constants';\nexport * from './utils';\n\n// Package metadata\n// Note: Version is imported from package.json to ensure consistency\nimport packageJson from '../package.json';\nexport const VERSION = packageJson.version;\nexport const PACKAGE_NAME = \"@bananalink-sdk/protocol\";\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { D as DAppMetadata, S as SessionConfig } from './core-DMhuNfoz.cjs';
|
|
2
2
|
export { C as CreateSessionRequest, e as CreateSessionResponse, a as SIWEFields, c as SecurityPolicy, d as SessionMetadata, b as SessionOptions } from './core-DMhuNfoz.cjs';
|
|
3
|
-
export {
|
|
4
|
-
import { Q as QRPayload } from './client-session-claim-
|
|
5
|
-
export { A as AuthenticateConnectionPayload, j as AuthenticationData, e as ClaimSessionPayload,
|
|
3
|
+
export { a as CryptoParameters, C as CryptoPayload, E as Encryption, b as KeyDerivation, K as KeyExchange, P as PublicKeyJWK } from './crypto-BK0Ile6V.cjs';
|
|
4
|
+
import { C as ClientSessionClaim, W as WalletSessionClaim, Q as QRPayload } from './client-session-claim-CkRKTG50.cjs';
|
|
5
|
+
export { A as AuthenticateConnectionPayload, j as AuthenticationData, e as ClaimSessionPayload, B as ClientHandshakeMessage, H as ClientMessageEnvelope, G as ClientMessagePayload, z as ClientReconnectPayload, T as ClientSessionClaimManager, b as ClientSessionClaimStorage, F as CloseSessionPayload, n as ConnectionAuthenticatedMessage, m as ConnectionRejectedMessage, f as ConnectionRejectedPayload, D as DisplayInfo, E as EncryptedPayload, P as PrefetchMetadataPayload, o as PrefetchMetadataResponse, i as RejectionData, c as RelayMessage, R as RelayMessageType, p as RelayToDAppMessage, q as RelayToWalletMessage, l as WalletHandshakeMessage, d as WalletMessageEnvelope, h as WalletMessagePayload, k as WalletMetadata, g as WalletReconnectPayload, L as WalletSessionClaimManager, a as WalletSessionClaimStorage, U as createClientMessageEnvelope, M as createWalletMessageEnvelope, u as isAuthenticateConnectionPayload, r as isClaimSessionPayload, K as isClientHandshakeMessage, I as isClientReconnectPayload, J as isCloseSessionPayload, y as isConnectionAuthenticatedMessage, x as isConnectionRejectedMessage, t as isConnectionRejectedPayload, s as isPrefetchMetadataPayload, w as isWalletHandshakeMessage, v as isWalletReconnectPayload, V as stripClientSessionClaim, N as stripWalletSessionClaim, O as validateClaimTimestamp, X as validateClientClaimTimestamp, Y as validateClientMessageEnvelope, S as validateWalletMessageEnvelope } from './client-session-claim-CkRKTG50.cjs';
|
|
6
6
|
export { SIWEMessageOptions } from './siwe-export.cjs';
|
|
7
7
|
|
|
8
8
|
type ProviderType = 'uwebsockets' | 'websocket' | 'pusher' | 'ably';
|
|
@@ -80,6 +80,33 @@ type WalletRejectionReason = 'user_declined' | 'untrusted_dapp' | 'unsupported_c
|
|
|
80
80
|
type RelayRejectionReason = 'session_already_claimed' | 'invalid_credentials' | 'session_expired' | 'session_closed' | 'dapp_metadata_missing' | 'encryption_mismatch' | 'relay_overloaded';
|
|
81
81
|
type RejectionReason = WalletRejectionReason | RelayRejectionReason;
|
|
82
82
|
|
|
83
|
+
interface PersistedClientSession {
|
|
84
|
+
sessionId: string;
|
|
85
|
+
clientSessionClaim: ClientSessionClaim;
|
|
86
|
+
peerPublicKey: string;
|
|
87
|
+
createdAt: number;
|
|
88
|
+
lastConnectedAt: number;
|
|
89
|
+
dAppMetadata?: {
|
|
90
|
+
name: string;
|
|
91
|
+
url: string;
|
|
92
|
+
icon?: string;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
interface PersistedWalletSession {
|
|
96
|
+
sessionId: string;
|
|
97
|
+
walletSessionClaim: WalletSessionClaim;
|
|
98
|
+
peerPublicKey: string;
|
|
99
|
+
createdAt: number;
|
|
100
|
+
lastConnectedAt: number;
|
|
101
|
+
dAppMetadata?: DAppMetadata;
|
|
102
|
+
}
|
|
103
|
+
interface SessionStorage {
|
|
104
|
+
get(key: string): Promise<string | null>;
|
|
105
|
+
set(key: string, value: string): Promise<void>;
|
|
106
|
+
remove(key: string): Promise<void>;
|
|
107
|
+
getAllKeys(): Promise<string[]>;
|
|
108
|
+
}
|
|
109
|
+
|
|
83
110
|
type SessionState = 'created' | 'claimed' | 'authenticated' | 'active' | 'disconnected' | 'closed' | 'expired' | 'rejected';
|
|
84
111
|
interface SessionInfo {
|
|
85
112
|
sessionId: string;
|
|
@@ -376,4 +403,4 @@ declare function isValidSessionId(sessionId: string): boolean;
|
|
|
376
403
|
declare const VERSION: string;
|
|
377
404
|
declare const PACKAGE_NAME = "@bananalink-sdk/protocol";
|
|
378
405
|
|
|
379
|
-
export { type AblyConfig, BANANALINK_CONSTANTS, type BananaLinkErrorCode, CRYPTO_CONSTANTS, DAppMetadata, DEEPLINK_SCHEME, DEEP_LINK_CONFIG, DEFAULT_RELAY_URL, DEFAULT_TIMEOUTS, DEV_CONFIG, ERROR_MESSAGES, FRUITS, HTTP_ENDPOINTS, MESSAGE_FORMAT, MESSAGE_QUEUE_CONFIG, NETWORK_CONFIG, type OriginProof, PACKAGE_NAME, PROTOCOL_V2_TIMEOUTS, PROTOCOL_VERSION, type ProtocolErrorResponse, type ProviderConfig, type ProviderConfigResponse, type ProviderType, type PusherConfig, QRPayload, QR_CONFIG, type ReconnectedMessage, type RejectionReason, type RelayNotificationMessage, type RelayRejectionReason, SECURITY_LIMITS, type SessionClosedAck, type SessionClosedNotification, SessionConfig, type SessionInfo, type SessionSecurity, type SessionState, type UWebSocketConfig, VERSION, WS_MESSAGE_TYPES, type WalletRejectionReason, buildQueryString, compressPublicKey, decodeConnectionString, decodeUrlParameter, decompressPublicKey, encodeCompactConnectionString, encodeConnectionString, encodeUniversalLink, encodeUrlParameter, generateSessionId, isReconnectedMessage, isSessionClosedAck, isSessionClosedNotification, isValidConnectionString, isValidProtocolVersion, isValidSessionId, parseQueryString };
|
|
406
|
+
export { type AblyConfig, BANANALINK_CONSTANTS, type BananaLinkErrorCode, CRYPTO_CONSTANTS, ClientSessionClaim, DAppMetadata, DEEPLINK_SCHEME, DEEP_LINK_CONFIG, DEFAULT_RELAY_URL, DEFAULT_TIMEOUTS, DEV_CONFIG, ERROR_MESSAGES, FRUITS, HTTP_ENDPOINTS, MESSAGE_FORMAT, MESSAGE_QUEUE_CONFIG, NETWORK_CONFIG, type OriginProof, PACKAGE_NAME, PROTOCOL_V2_TIMEOUTS, PROTOCOL_VERSION, type PersistedClientSession, type PersistedWalletSession, type ProtocolErrorResponse, type ProviderConfig, type ProviderConfigResponse, type ProviderType, type PusherConfig, QRPayload, QR_CONFIG, type ReconnectedMessage, type RejectionReason, type RelayNotificationMessage, type RelayRejectionReason, SECURITY_LIMITS, type SessionClosedAck, type SessionClosedNotification, SessionConfig, type SessionInfo, type SessionSecurity, type SessionState, type SessionStorage, type UWebSocketConfig, VERSION, WS_MESSAGE_TYPES, type WalletRejectionReason, WalletSessionClaim, buildQueryString, compressPublicKey, decodeConnectionString, decodeUrlParameter, decompressPublicKey, encodeCompactConnectionString, encodeConnectionString, encodeUniversalLink, encodeUrlParameter, generateSessionId, isReconnectedMessage, isSessionClosedAck, isSessionClosedNotification, isValidConnectionString, isValidProtocolVersion, isValidSessionId, parseQueryString };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { D as DAppMetadata, S as SessionConfig } from './core-DMhuNfoz.js';
|
|
2
2
|
export { C as CreateSessionRequest, e as CreateSessionResponse, a as SIWEFields, c as SecurityPolicy, d as SessionMetadata, b as SessionOptions } from './core-DMhuNfoz.js';
|
|
3
|
-
export {
|
|
4
|
-
import { Q as QRPayload } from './client-session-claim-
|
|
5
|
-
export { A as AuthenticateConnectionPayload, j as AuthenticationData, e as ClaimSessionPayload,
|
|
3
|
+
export { a as CryptoParameters, C as CryptoPayload, E as Encryption, b as KeyDerivation, K as KeyExchange, P as PublicKeyJWK } from './crypto-BK0Ile6V.js';
|
|
4
|
+
import { C as ClientSessionClaim, W as WalletSessionClaim, Q as QRPayload } from './client-session-claim-CrIDASkZ.js';
|
|
5
|
+
export { A as AuthenticateConnectionPayload, j as AuthenticationData, e as ClaimSessionPayload, B as ClientHandshakeMessage, H as ClientMessageEnvelope, G as ClientMessagePayload, z as ClientReconnectPayload, T as ClientSessionClaimManager, b as ClientSessionClaimStorage, F as CloseSessionPayload, n as ConnectionAuthenticatedMessage, m as ConnectionRejectedMessage, f as ConnectionRejectedPayload, D as DisplayInfo, E as EncryptedPayload, P as PrefetchMetadataPayload, o as PrefetchMetadataResponse, i as RejectionData, c as RelayMessage, R as RelayMessageType, p as RelayToDAppMessage, q as RelayToWalletMessage, l as WalletHandshakeMessage, d as WalletMessageEnvelope, h as WalletMessagePayload, k as WalletMetadata, g as WalletReconnectPayload, L as WalletSessionClaimManager, a as WalletSessionClaimStorage, U as createClientMessageEnvelope, M as createWalletMessageEnvelope, u as isAuthenticateConnectionPayload, r as isClaimSessionPayload, K as isClientHandshakeMessage, I as isClientReconnectPayload, J as isCloseSessionPayload, y as isConnectionAuthenticatedMessage, x as isConnectionRejectedMessage, t as isConnectionRejectedPayload, s as isPrefetchMetadataPayload, w as isWalletHandshakeMessage, v as isWalletReconnectPayload, V as stripClientSessionClaim, N as stripWalletSessionClaim, O as validateClaimTimestamp, X as validateClientClaimTimestamp, Y as validateClientMessageEnvelope, S as validateWalletMessageEnvelope } from './client-session-claim-CrIDASkZ.js';
|
|
6
6
|
export { SIWEMessageOptions } from './siwe-export.js';
|
|
7
7
|
|
|
8
8
|
type ProviderType = 'uwebsockets' | 'websocket' | 'pusher' | 'ably';
|
|
@@ -80,6 +80,33 @@ type WalletRejectionReason = 'user_declined' | 'untrusted_dapp' | 'unsupported_c
|
|
|
80
80
|
type RelayRejectionReason = 'session_already_claimed' | 'invalid_credentials' | 'session_expired' | 'session_closed' | 'dapp_metadata_missing' | 'encryption_mismatch' | 'relay_overloaded';
|
|
81
81
|
type RejectionReason = WalletRejectionReason | RelayRejectionReason;
|
|
82
82
|
|
|
83
|
+
interface PersistedClientSession {
|
|
84
|
+
sessionId: string;
|
|
85
|
+
clientSessionClaim: ClientSessionClaim;
|
|
86
|
+
peerPublicKey: string;
|
|
87
|
+
createdAt: number;
|
|
88
|
+
lastConnectedAt: number;
|
|
89
|
+
dAppMetadata?: {
|
|
90
|
+
name: string;
|
|
91
|
+
url: string;
|
|
92
|
+
icon?: string;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
interface PersistedWalletSession {
|
|
96
|
+
sessionId: string;
|
|
97
|
+
walletSessionClaim: WalletSessionClaim;
|
|
98
|
+
peerPublicKey: string;
|
|
99
|
+
createdAt: number;
|
|
100
|
+
lastConnectedAt: number;
|
|
101
|
+
dAppMetadata?: DAppMetadata;
|
|
102
|
+
}
|
|
103
|
+
interface SessionStorage {
|
|
104
|
+
get(key: string): Promise<string | null>;
|
|
105
|
+
set(key: string, value: string): Promise<void>;
|
|
106
|
+
remove(key: string): Promise<void>;
|
|
107
|
+
getAllKeys(): Promise<string[]>;
|
|
108
|
+
}
|
|
109
|
+
|
|
83
110
|
type SessionState = 'created' | 'claimed' | 'authenticated' | 'active' | 'disconnected' | 'closed' | 'expired' | 'rejected';
|
|
84
111
|
interface SessionInfo {
|
|
85
112
|
sessionId: string;
|
|
@@ -376,4 +403,4 @@ declare function isValidSessionId(sessionId: string): boolean;
|
|
|
376
403
|
declare const VERSION: string;
|
|
377
404
|
declare const PACKAGE_NAME = "@bananalink-sdk/protocol";
|
|
378
405
|
|
|
379
|
-
export { type AblyConfig, BANANALINK_CONSTANTS, type BananaLinkErrorCode, CRYPTO_CONSTANTS, DAppMetadata, DEEPLINK_SCHEME, DEEP_LINK_CONFIG, DEFAULT_RELAY_URL, DEFAULT_TIMEOUTS, DEV_CONFIG, ERROR_MESSAGES, FRUITS, HTTP_ENDPOINTS, MESSAGE_FORMAT, MESSAGE_QUEUE_CONFIG, NETWORK_CONFIG, type OriginProof, PACKAGE_NAME, PROTOCOL_V2_TIMEOUTS, PROTOCOL_VERSION, type ProtocolErrorResponse, type ProviderConfig, type ProviderConfigResponse, type ProviderType, type PusherConfig, QRPayload, QR_CONFIG, type ReconnectedMessage, type RejectionReason, type RelayNotificationMessage, type RelayRejectionReason, SECURITY_LIMITS, type SessionClosedAck, type SessionClosedNotification, SessionConfig, type SessionInfo, type SessionSecurity, type SessionState, type UWebSocketConfig, VERSION, WS_MESSAGE_TYPES, type WalletRejectionReason, buildQueryString, compressPublicKey, decodeConnectionString, decodeUrlParameter, decompressPublicKey, encodeCompactConnectionString, encodeConnectionString, encodeUniversalLink, encodeUrlParameter, generateSessionId, isReconnectedMessage, isSessionClosedAck, isSessionClosedNotification, isValidConnectionString, isValidProtocolVersion, isValidSessionId, parseQueryString };
|
|
406
|
+
export { type AblyConfig, BANANALINK_CONSTANTS, type BananaLinkErrorCode, CRYPTO_CONSTANTS, ClientSessionClaim, DAppMetadata, DEEPLINK_SCHEME, DEEP_LINK_CONFIG, DEFAULT_RELAY_URL, DEFAULT_TIMEOUTS, DEV_CONFIG, ERROR_MESSAGES, FRUITS, HTTP_ENDPOINTS, MESSAGE_FORMAT, MESSAGE_QUEUE_CONFIG, NETWORK_CONFIG, type OriginProof, PACKAGE_NAME, PROTOCOL_V2_TIMEOUTS, PROTOCOL_VERSION, type PersistedClientSession, type PersistedWalletSession, type ProtocolErrorResponse, type ProviderConfig, type ProviderConfigResponse, type ProviderType, type PusherConfig, QRPayload, QR_CONFIG, type ReconnectedMessage, type RejectionReason, type RelayNotificationMessage, type RelayRejectionReason, SECURITY_LIMITS, type SessionClosedAck, type SessionClosedNotification, SessionConfig, type SessionInfo, type SessionSecurity, type SessionState, type SessionStorage, type UWebSocketConfig, VERSION, WS_MESSAGE_TYPES, type WalletRejectionReason, WalletSessionClaim, buildQueryString, compressPublicKey, decodeConnectionString, decodeUrlParameter, decompressPublicKey, encodeCompactConnectionString, encodeConnectionString, encodeUniversalLink, encodeUrlParameter, generateSessionId, isReconnectedMessage, isSessionClosedAck, isSessionClosedNotification, isValidConnectionString, isValidProtocolVersion, isValidSessionId, parseQueryString };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { generateUUID } from './chunk-
|
|
1
|
+
import { generateUUID } from './chunk-OBJR2TL4.js';
|
|
2
2
|
import { DEEPLINK_SCHEME } from './chunk-CUJK7ZTS.js';
|
|
3
3
|
export { BANANALINK_CONSTANTS, CRYPTO_CONSTANTS, DEEPLINK_SCHEME, DEEP_LINK_CONFIG, DEFAULT_RELAY_URL, DEFAULT_TIMEOUTS, DEV_CONFIG, ERROR_MESSAGES, FRUITS, HTTP_ENDPOINTS, MESSAGE_FORMAT, MESSAGE_QUEUE_CONFIG, NETWORK_CONFIG, PROTOCOL_V2_TIMEOUTS, PROTOCOL_VERSION, QR_CONFIG, SECURITY_LIMITS, WS_MESSAGE_TYPES } from './chunk-CUJK7ZTS.js';
|
|
4
|
-
import './chunk-TCVKC227.js';
|
|
5
4
|
import { __name } from './chunk-WCQVDF3K.js';
|
|
6
5
|
|
|
7
6
|
// src/types/wallet-messages.ts
|
|
@@ -47,6 +46,10 @@ function isCloseSessionPayload(payload) {
|
|
|
47
46
|
return payload?.type === "close_session";
|
|
48
47
|
}
|
|
49
48
|
__name(isCloseSessionPayload, "isCloseSessionPayload");
|
|
49
|
+
function isClientHandshakeMessage(message) {
|
|
50
|
+
return message?.type === "client_handshake";
|
|
51
|
+
}
|
|
52
|
+
__name(isClientHandshakeMessage, "isClientHandshakeMessage");
|
|
50
53
|
|
|
51
54
|
// src/types/relay-messages.ts
|
|
52
55
|
function isSessionClosedAck(message) {
|
|
@@ -493,12 +496,12 @@ __name(isValidSessionId, "isValidSessionId");
|
|
|
493
496
|
|
|
494
497
|
// package.json
|
|
495
498
|
var package_default = {
|
|
496
|
-
version: "1.
|
|
499
|
+
version: "1.4.0"};
|
|
497
500
|
|
|
498
501
|
// src/index.ts
|
|
499
502
|
var VERSION = package_default.version;
|
|
500
503
|
var PACKAGE_NAME = "@bananalink-sdk/protocol";
|
|
501
504
|
|
|
502
|
-
export { ClientSessionClaimManager, PACKAGE_NAME, VERSION, WalletSessionClaimManager, buildQueryString, compressPublicKey, createClientMessageEnvelope, createWalletMessageEnvelope, decodeConnectionString, decodeUrlParameter, decompressPublicKey, encodeCompactConnectionString, encodeConnectionString, encodeUniversalLink, encodeUrlParameter, generateSessionId, isAuthenticateConnectionPayload, isClaimSessionPayload, isClientReconnectPayload, isCloseSessionPayload, isConnectionAuthenticatedMessage, isConnectionRejectedMessage, isConnectionRejectedPayload, isPrefetchMetadataPayload, isReconnectedMessage, isSessionClosedAck, isSessionClosedNotification, isValidConnectionString, isValidProtocolVersion, isValidSessionId, isWalletHandshakeMessage, isWalletReconnectPayload, parseQueryString, stripClientSessionClaim, stripWalletSessionClaim, validateClaimTimestamp, validateClientClaimTimestamp, validateClientMessageEnvelope, validateWalletMessageEnvelope };
|
|
505
|
+
export { ClientSessionClaimManager, PACKAGE_NAME, VERSION, WalletSessionClaimManager, buildQueryString, compressPublicKey, createClientMessageEnvelope, createWalletMessageEnvelope, decodeConnectionString, decodeUrlParameter, decompressPublicKey, encodeCompactConnectionString, encodeConnectionString, encodeUniversalLink, encodeUrlParameter, generateSessionId, isAuthenticateConnectionPayload, isClaimSessionPayload, isClientHandshakeMessage, isClientReconnectPayload, isCloseSessionPayload, isConnectionAuthenticatedMessage, isConnectionRejectedMessage, isConnectionRejectedPayload, isPrefetchMetadataPayload, isReconnectedMessage, isSessionClosedAck, isSessionClosedNotification, isValidConnectionString, isValidProtocolVersion, isValidSessionId, isWalletHandshakeMessage, isWalletReconnectPayload, parseQueryString, stripClientSessionClaim, stripWalletSessionClaim, validateClaimTimestamp, validateClientClaimTimestamp, validateClientMessageEnvelope, validateWalletMessageEnvelope };
|
|
503
506
|
//# sourceMappingURL=index.js.map
|
|
504
507
|
//# sourceMappingURL=index.js.map
|