@joeywallet/wallet-sdk 0.2.0 → 0.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/README.md CHANGED
@@ -372,32 +372,91 @@ that screen. Both are unambiguous; only the pair "transaction 2 of 5" next to
372
372
 
373
373
  ## Sign in
374
374
 
375
- `signIn` authenticates a user without a transaction. The default mode signs a
376
- [CAIP-122](https://namespaces.chainagnostic.org/xrpl/caip122) message under a
377
- non-transaction domain separator, so the signature is cryptographically
375
+ `signIn` authenticates a user without a transaction. For a software account it
376
+ signs a [CAIP-122](https://namespaces.chainagnostic.org/xrpl/caip122) message
377
+ under a non-transaction domain separator, so the signature is cryptographically
378
378
  incapable of being replayed as a transaction signature.
379
379
 
380
+ **It has two result shapes, and you must narrow before reading either.** Which
381
+ one you get is the wallet’s decision, not yours: it depends on the account the
382
+ user picks, and they pick it inside the wallet after your call has been made.
383
+
380
384
  ```ts
385
+ import { isChallengeSignIn } from '@joeywallet/wallet-sdk'
386
+
381
387
  const result = await joey.signIn({
382
388
  statement: 'Sign in to Example Exchange',
383
389
  // nonce defaults to one the wallet generates; supply your own if your
384
390
  // backend issues it.
385
391
  })
386
392
 
387
- await fetch('/api/session', {
388
- method: 'POST',
389
- headers: { 'content-type': 'application/json' },
390
- body: JSON.stringify({
391
- address: result.address,
392
- publicKey: result.publicKey,
393
- message: result.message,
394
- signature: result.signature,
395
- }),
396
- })
393
+ if (isChallengeSignIn(result)) {
394
+ // A hardware account. Verify the signed transaction.
395
+ await fetch('/api/session/tx', {
396
+ method: 'POST',
397
+ headers: { 'content-type': 'application/json' },
398
+ body: JSON.stringify({ address: result.address, signedTx: result.signedTx }),
399
+ })
400
+ } else {
401
+ await fetch('/api/session', {
402
+ method: 'POST',
403
+ headers: { 'content-type': 'application/json' },
404
+ body: JSON.stringify({
405
+ address: result.address,
406
+ publicKey: result.publicKey,
407
+ message: result.message,
408
+ signature: result.signature,
409
+ }),
410
+ })
411
+ }
397
412
  ```
398
413
 
399
- Verify the signature server-side against `result.message` and check the nonce,
400
- the domain and the issue time inside that message before trusting it.
414
+ Verify the CAIP-122 signature server-side against `result.message` and check the
415
+ nonce, the domain and the issue time inside that message before trusting it.
416
+
417
+ ### Hardware accounts sign a transaction instead
418
+
419
+ A Ledger cannot produce the result above. The XRP app signs transactions and has
420
+ no message primitive at all, so there is no command to ask it for a CAIP-122
421
+ signature. Rather than refuse the sign-in, the wallet proves ownership by having
422
+ the device sign a canonical 1-drop Payment and hands you the signed transaction
423
+ as `signedTx`.
424
+
425
+ That transaction is built entirely by the wallet and is unsubmittable twice
426
+ over: `Sequence` is `0`, which is never valid for a funded account, and the
427
+ destination is the signing account itself, which `rippled` refuses as
428
+ `temREDUNDANT`. Your challenge travels in a memo as
429
+ `{"wallet":"joey","challenge":"<nonce>"}`, hex-encoded.
430
+
431
+ `signedTx` is `JSON.stringify` of the **bare** decoded transaction — not wrapped
432
+ in `{ tx_json: … }` — so `JSON.parse` it and use the result as a transaction
433
+ object. To verify one, re-encode it and check the signature, then check the
434
+ signer is the address you are about to trust:
435
+
436
+ ```ts
437
+ import { encode } from 'ripple-binary-codec'
438
+ import { verifySignature } from 'ripple-keypairs' // or your verifier of choice
439
+
440
+ const tx = JSON.parse(signedTx)
441
+ const ok = verifySignature(encode(tx)) // signatureValid, signedBy
442
+ // Bind the session to the address that actually signed, never to one the
443
+ // client claimed: without that check a valid signature made with any key can
444
+ // mint a session for any account.
445
+ ```
446
+
447
+ This is byte-identical to what the Joey mobile wallet puts in a WalletConnect
448
+ session's `xrpl_signin_v1_signed_tx`, so a backend that already verifies mobile
449
+ Joey sign-ins verifies these unchanged.
450
+
451
+ Narrow with `isChallengeSignIn`, which tests for the `signedTx` field rather
452
+ than for `mode`. Wallets older than this shape send no `mode` at all, so a check
453
+ written the other way round misroutes every one of them.
454
+
455
+ > **If you skip the narrowing**, a verifier written for the CAIP-122 shape reads
456
+ > `publicKey`, `message` and `signature` as `undefined`, posts them, and reports
457
+ > "signature did not verify" — for a signature the user made correctly on their
458
+ > device, seconds earlier. The failure is silent on the wallet side and looks
459
+ > like a rejected login on yours.
401
460
 
402
461
  Pass `resources` to name the scope you are asking for. It is shown on the
403
462
  approval screen and written into the message's `Resources:` section, so it is
@@ -672,13 +731,23 @@ a one-line import change.
672
731
 
673
732
  ### Transactions Joey will not sign for a dapp
674
733
 
675
- Six types, rejected whichever method carries them and at every nesting level,
676
- with a message saying so. Read the list rather than discovering it by rejection:
734
+ `JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES` is now **empty**, and no longer tells
735
+ you what will be rejected:
677
736
 
678
737
  ```ts
679
738
  import { JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES } from '@joeywallet/wallet-sdk'
739
+ // readonly string[] — []
680
740
  ```
681
741
 
742
+ It was always a published mirror rather than a gate: no SDK method reads it, and
743
+ `signTransaction`, `signTransactionFor` and `signTransactionBulk` hand your
744
+ `tx_json` to the provider unread. Emptying it removed the advance notice, not an
745
+ enforcement point. **A passing check against this constant is not permission to
746
+ sign.**
747
+
748
+ The wallet keeps its own rules and applies them at approval time, at every
749
+ nesting level. At the time of writing it still refuses:
750
+
682
751
  | Type | Why |
683
752
  | ---- | --- |
684
753
  | `SetRegularKey` | Grants permanent signing authority over the account. |
@@ -688,7 +757,7 @@ import { JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES } from '@joeywallet/wallet-sdk'
688
757
  | `SetHook` | Installs code that runs on every future transaction. |
689
758
  | `Batch` | Carries other transactions inside `RawTransactions`, which the approval screen cannot render — see the note under bulk signing. |
690
759
 
691
- Two more rules are not expressible as a type name and are enforced anyway:
760
+ Plus two rules that were never expressible as a type name:
692
761
 
693
762
  - **`AccountSet` is conditionally refused.** It is permitted for routine flags
694
763
  (`asfDefaultRipple` and the rest) and refused when it sets or clears one that
@@ -700,6 +769,9 @@ Two more rules are not expressible as a type name and are enforced anyway:
700
769
  `rippled` rejects one submitted over the network.
701
770
 
702
771
  None of these is distinguishable from an ordinary transaction in a confirmation
703
- dialog someone is skimming, which is why they are refused rather than surfaced
704
- for approval. Users perform them from the Joey UI, where the wording can be as
705
- blunt as it needs to be.
772
+ dialog someone is skimming, which is why the wallet refuses them rather than
773
+ surfacing them for approval. Users perform them from the Joey UI, where the
774
+ wording can be as blunt as it needs to be.
775
+
776
+ Because the constant no longer lists them, expect these to arrive as a `4100`
777
+ from the approval queue and handle them there.
package/dist/index.d.ts CHANGED
@@ -8,6 +8,6 @@ export { getJoey, isJoeyAvailable, requireJoey, resetJoeyDetection, waitForJoey,
8
8
  export { createJoeyClient, readAccounts, readChain, readNetwork, type Joey, } from './client.js';
9
9
  export { JOEY_ERROR_CODES, JoeyRpcError, isUserRejection, notInstalledError, userRejectedError, type JoeyErrorCode, } from './errors.js';
10
10
  export { APPROVAL_TIMEOUT_MS, CAIP294_ANNOUNCE_EVENT, CAIP294_PROMPT_EVENT, JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES, JOEY_RDNS, JOEY_RPC_METHODS, JOEY_WALLET_NAME, MAX_BULK_TRANSACTIONS, REQUEST_TIMEOUT_MS, WALLET_STANDARD_APP_READY_EVENT, WALLET_STANDARD_REGISTER_EVENT, invoke, isJoeyInjectedProvider, subscribe, type JoeyInjectedProvider, type JoeyProviderEventName, type JoeyRequestArguments, type JoeyRpcMethod, } from './provider.js';
11
- export { JOEY_CHAINS, chainForNetworkId, isJoeyChain, networkIdForChain, type Amount, type AnyTransaction, type ConnectParams, type ConnectResult, type IssuedCurrencyAmount, type JoeyAccount, type JoeyChain, type JoeyEventListener, type JoeyEventMap, type JoeyEventName, type JoeyNetwork, type Memo, type MPTAmount, type Path, type PathStep, type SignAndSubmitTransactionResult, type SigningContextParams, type SignInMode, type SignInParams, type SignInResult, type BulkEntryResult, type BulkEntryStatus, type SignTransactionBulkFailure, type SignTransactionBulkParams, type SignTransactionForParams, type SignTransactionParams, type SignTransactionResult, type Signer, type TransactionLike, } from './types.js';
11
+ export { JOEY_CHAINS, chainForNetworkId, isChallengeSignIn, isJoeyChain, networkIdForChain, type Amount, type AnyTransaction, type ConnectParams, type ConnectResult, type IssuedCurrencyAmount, type JoeyAccount, type JoeyChain, type JoeyEventListener, type JoeyEventMap, type JoeyEventName, type JoeyNetwork, type Memo, type MPTAmount, type Path, type PathStep, type SignAndSubmitTransactionResult, type SigningContextParams, type Caip122SignInResult, type ChallengeSignInResult, type SignInMode, type SignInParams, type SignInResult, type BulkEntryResult, type BulkEntryStatus, type SignTransactionBulkFailure, type SignTransactionBulkParams, type SignTransactionForParams, type SignTransactionParams, type SignTransactionResult, type Signer, type TransactionLike, } from './types.js';
12
12
  export { initialMutationState, mutationReducer, toPublicState, type MutationAction, type MutationState, type MutationStatus, } from './mutation.js';
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,OAAO,EACP,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,KAAK,kBAAkB,GACxB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,WAAW,EACX,KAAK,IAAI,GACV,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,qCAAqC,EACrC,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC9B,MAAM,EACN,sBAAsB,EACtB,SAAS,EACT,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,aAAa,GACnB,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,8BAA8B,EACnC,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACX,KAAK,eAAe,GACrB,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,OAAO,EACP,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,KAAK,kBAAkB,GACxB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,WAAW,EACX,KAAK,IAAI,GACV,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,qCAAqC,EACrC,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC9B,MAAM,EACN,sBAAsB,EACtB,SAAS,EACT,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,aAAa,GACnB,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,KAAK,MAAM,EACX,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,QAAQ,EACb,KAAK,8BAA8B,EACnC,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACX,KAAK,eAAe,GACrB,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAA"}
package/dist/index.js CHANGED
@@ -8,6 +8,6 @@ export { getJoey, isJoeyAvailable, requireJoey, resetJoeyDetection, waitForJoey,
8
8
  export { createJoeyClient, readAccounts, readChain, readNetwork, } from './client.js';
9
9
  export { JOEY_ERROR_CODES, JoeyRpcError, isUserRejection, notInstalledError, userRejectedError, } from './errors.js';
10
10
  export { APPROVAL_TIMEOUT_MS, CAIP294_ANNOUNCE_EVENT, CAIP294_PROMPT_EVENT, JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES, JOEY_RDNS, JOEY_RPC_METHODS, JOEY_WALLET_NAME, MAX_BULK_TRANSACTIONS, REQUEST_TIMEOUT_MS, WALLET_STANDARD_APP_READY_EVENT, WALLET_STANDARD_REGISTER_EVENT, invoke, isJoeyInjectedProvider, subscribe, } from './provider.js';
11
- export { JOEY_CHAINS, chainForNetworkId, isJoeyChain, networkIdForChain, } from './types.js';
11
+ export { JOEY_CHAINS, chainForNetworkId, isChallengeSignIn, isJoeyChain, networkIdForChain, } from './types.js';
12
12
  export { initialMutationState, mutationReducer, toPublicState, } from './mutation.js';
13
13
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,OAAO,EACP,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,WAAW,GAEZ,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,WAAW,GAEZ,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,qCAAqC,EACrC,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC9B,MAAM,EACN,sBAAsB,EACtB,SAAS,GAKV,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,iBAAiB,GA8BlB,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,aAAa,GAId,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,OAAO,EACP,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,WAAW,GAEZ,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,WAAW,GAEZ,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GAElB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,EACpB,qCAAqC,EACrC,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,+BAA+B,EAC/B,8BAA8B,EAC9B,MAAM,EACN,sBAAsB,EACtB,SAAS,GAKV,MAAM,eAAe,CAAA;AAEtB,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,GAgClB,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,aAAa,GAId,MAAM,eAAe,CAAA"}
@@ -117,30 +117,30 @@ export declare const APPROVAL_TIMEOUT_MS = 300000;
117
117
  */
118
118
  export declare const MAX_BULK_TRANSACTIONS = 32;
119
119
  /**
120
- * Transaction types Joey refuses to sign for a website, whatever the user
121
- * clicks and whichever method carries them.
120
+ * Transaction types this SDK declares as refused for a website. Now empty.
122
121
  *
123
- * Published so a dapp can check before it builds a flow around one, and so the
124
- * refusal is a documented rule rather than a surprise `4100`. Every entry hands
125
- * over or destroys the account itself:
122
+ * **This list no longer describes what the wallet does.** It is a published
123
+ * constant, not a gate: nothing in this SDK reads it, and no signing method
124
+ * consults it `signTransaction`, `signTransactionFor` and
125
+ * `signTransactionBulk` hand `tx_json` to the provider unread. Emptying it
126
+ * removed an advertisement, not an enforcement point.
126
127
  *
127
- * - `SetRegularKey`, `SignerListSet` and `DelegateSet` (XLS-75) each grant
128
- * permanent authority to act as the account, by three separate mechanisms.
129
- * - `AccountDelete` is irreversible.
130
- * - `SetHook` installs code that runs on every future transaction.
131
- * - `Batch` (XLS-56) carries other transactions inside `RawTransactions`, and
132
- * Joey's approval screen renders the outer transaction. A user cannot consent
133
- * to something they were never shown, so it is refused until the review
134
- * screen can render inner transactions individually.
128
+ * The wallet keeps its own rules and applies them at approval time, at every
129
+ * nesting level. At the time of writing it still refuses `SetRegularKey`,
130
+ * `SignerListSet`, `DelegateSet` (XLS-75), `AccountDelete`, `SetHook` and
131
+ * `Batch` (XLS-56) each of which hands over or destroys the account itself,
132
+ * or, for `Batch`, hides its real payload in `RawTransactions` where the
133
+ * approval screen cannot render it for consent. It also refuses an `AccountSet`
134
+ * that sets or clears a control-changing flag (`asfDisableMaster`,
135
+ * `asfRequireAuth`, `asfNoFreeze` and that family), and the pseudo-transactions
136
+ * `EnableAmendment`, `SetFee` and `UNLModify`, which no account signs.
135
137
  *
136
- * Two rules are not expressible as a type name and are enforced anyway:
137
- * `AccountSet` is refused when it sets or clears a flag that changes who
138
- * controls the account (`asfDisableMaster`, `asfRequireAuth`, `asfNoFreeze` and
139
- * the rest of that family) and permitted otherwise; and the ledger's
140
- * pseudo-transactions — `EnableAmendment`, `SetFee`, `UNLModify` — are refused
141
- * because no account signs one.
138
+ * So a dapp can no longer check this constant to find out what will be
139
+ * rejected. Expect those refusals to arrive as a `4100` from the approval
140
+ * queue, and handle them there.
142
141
  *
143
- * The wallet checks at every nesting level, not just the top.
142
+ * @deprecated Empty, and no longer a description of wallet behaviour. Do not
143
+ * treat a passing check against it as permission to sign.
144
144
  */
145
145
  export declare const JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES: readonly string[];
146
146
  export declare function isJoeyInjectedProvider(value: unknown): value is JoeyInjectedProvider;
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,SAAS,EACT,WAAW,EACX,8BAA8B,EAC9B,YAAY,EACZ,YAAY,EACZ,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;CAUnB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAA;AAEpF,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,yEAAyE;AACzE,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,YAAY,GAAG,iBAAiB,GAAG,gBAAgB,CAAA;AAEnG,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,gFAAgF;IAChF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;IACtB,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IAEjC,WAAW,CAAC,IAAI,OAAO,CAAA;IACvB,WAAW,CAAC,IAAI,OAAO,CAAA;IAEvB,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IACxD,UAAU,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,C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,OAAO,GAAG,KAAK,IAAI,oBAAoB,CAIpF;AAED;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAClC,QAAQ,EAAE,oBAAoB,EAC9B,MAAM,EAAE,aAAa,EACrB,MAAM,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,OAAO,CAAC,CAWlB;AAED,kFAAkF;AAClF,wBAAgB,SAAS,CACvB,QAAQ,EAAE,oBAAoB,EAC9B,KAAK,EAAE,qBAAqB,EAC5B,QAAQ,EAAE,CAAC,OAAO,EAAE,KAAK,KAAK,IAAI,GACjC,MAAM,IAAI,CAOZ"}
package/dist/provider.js CHANGED
@@ -72,39 +72,32 @@ export const APPROVAL_TIMEOUT_MS = 300_000;
72
72
  */
73
73
  export const MAX_BULK_TRANSACTIONS = 32;
74
74
  /**
75
- * Transaction types Joey refuses to sign for a website, whatever the user
76
- * clicks and whichever method carries them.
75
+ * Transaction types this SDK declares as refused for a website. Now empty.
77
76
  *
78
- * Published so a dapp can check before it builds a flow around one, and so the
79
- * refusal is a documented rule rather than a surprise `4100`. Every entry hands
80
- * over or destroys the account itself:
77
+ * **This list no longer describes what the wallet does.** It is a published
78
+ * constant, not a gate: nothing in this SDK reads it, and no signing method
79
+ * consults it `signTransaction`, `signTransactionFor` and
80
+ * `signTransactionBulk` hand `tx_json` to the provider unread. Emptying it
81
+ * removed an advertisement, not an enforcement point.
81
82
  *
82
- * - `SetRegularKey`, `SignerListSet` and `DelegateSet` (XLS-75) each grant
83
- * permanent authority to act as the account, by three separate mechanisms.
84
- * - `AccountDelete` is irreversible.
85
- * - `SetHook` installs code that runs on every future transaction.
86
- * - `Batch` (XLS-56) carries other transactions inside `RawTransactions`, and
87
- * Joey's approval screen renders the outer transaction. A user cannot consent
88
- * to something they were never shown, so it is refused until the review
89
- * screen can render inner transactions individually.
83
+ * The wallet keeps its own rules and applies them at approval time, at every
84
+ * nesting level. At the time of writing it still refuses `SetRegularKey`,
85
+ * `SignerListSet`, `DelegateSet` (XLS-75), `AccountDelete`, `SetHook` and
86
+ * `Batch` (XLS-56) each of which hands over or destroys the account itself,
87
+ * or, for `Batch`, hides its real payload in `RawTransactions` where the
88
+ * approval screen cannot render it for consent. It also refuses an `AccountSet`
89
+ * that sets or clears a control-changing flag (`asfDisableMaster`,
90
+ * `asfRequireAuth`, `asfNoFreeze` and that family), and the pseudo-transactions
91
+ * `EnableAmendment`, `SetFee` and `UNLModify`, which no account signs.
90
92
  *
91
- * Two rules are not expressible as a type name and are enforced anyway:
92
- * `AccountSet` is refused when it sets or clears a flag that changes who
93
- * controls the account (`asfDisableMaster`, `asfRequireAuth`, `asfNoFreeze` and
94
- * the rest of that family) and permitted otherwise; and the ledger's
95
- * pseudo-transactions — `EnableAmendment`, `SetFee`, `UNLModify` — are refused
96
- * because no account signs one.
93
+ * So a dapp can no longer check this constant to find out what will be
94
+ * rejected. Expect those refusals to arrive as a `4100` from the approval
95
+ * queue, and handle them there.
97
96
  *
98
- * The wallet checks at every nesting level, not just the top.
97
+ * @deprecated Empty, and no longer a description of wallet behaviour. Do not
98
+ * treat a passing check against it as permission to sign.
99
99
  */
100
- export const JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES = Object.freeze([
101
- 'SetRegularKey',
102
- 'SignerListSet',
103
- 'DelegateSet',
104
- 'AccountDelete',
105
- 'SetHook',
106
- 'Batch',
107
- ]);
100
+ export const JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES = Object.freeze([]);
108
101
  export function isJoeyInjectedProvider(value) {
109
102
  if (typeof value !== 'object' || value === null)
110
103
  return false;
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAwBA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,YAAY;IACxB,WAAW,EAAE,aAAa;IAC1B,UAAU,EAAE,YAAY;IACxB,eAAe,EAAE,iBAAiB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AAO,CAAC,MAAO,cAAsD,CAAC,IAAI,CACxE,QAAQ,EACR,MAAM,CACP,CAAY,CAAA;IACf,CAAC;IACD,OAAO,MAAM,QAAQ,CAAC,OAAO,CAC3B,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CACvD,CAAA;AACH,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,SAAS,CACvB,QAA8B,EAC9B,KAA4B,EAC5B,QAAkC;IAElC,MAAM,QAAQ,GAAG,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAC7C,IAAI,OAAO,QAAQ,KAAK,UAAU;QAAE,OAAO,QAAQ,CAAA;IACnD,OAAO,GAAG,EAAE;QACV,IAAI,OAAO,QAAQ,CAAC,cAAc,KAAK,UAAU;YAAE,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;aACtF,IAAI,OAAO,QAAQ,CAAC,GAAG,KAAK,UAAU;YAAE,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAC5E,CAAC,CAAA;AACH,CAAC"}
package/dist/types.d.ts CHANGED
@@ -228,10 +228,11 @@ export interface SignTransactionForParams<TTx extends TransactionLike = AnyTrans
228
228
  *
229
229
  * **This is not XLS-56 `Batch`, and the two must not be confused.** A `Batch`
230
230
  * is a single transaction that carries others inside `RawTransactions` and
231
- * commits them atomically on-ledger; Joey refuses to sign one for a website
232
- * (see {@link JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES}) because its approval
233
- * screen renders the outer transaction and a user cannot consent to inner ones
234
- * they were never shown. `signTransactionBulk` is the opposite arrangement:
231
+ * commits them atomically on-ledger; the wallet refuses to sign one for a
232
+ * website because its approval screen renders the outer transaction and a user
233
+ * cannot consent to inner ones they were never shown. That refusal arrives as a
234
+ * `4100` at approval time {@link JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES} is
235
+ * empty and will not warn you about it. `signTransactionBulk` is the opposite arrangement:
235
236
  * ordinary, separate transactions, each rendered on its own page of the
236
237
  * approval, each signed on its own, with no on-ledger atomicity at all. If
237
238
  * transaction 3 fails, 1 and 2 have still happened.
@@ -363,14 +364,70 @@ export interface SignInParams {
363
364
  */
364
365
  resources?: string[];
365
366
  }
366
- export interface SignInResult {
367
+ /**
368
+ * What a software account answers with: a signature over a CAIP-122 message.
369
+ *
370
+ * `mode` is optional because wallets predating the second shape do not send
371
+ * it. Do not branch on it being `caip122` — branch on the *other* shape, with
372
+ * {@link isChallengeSignIn}, so an older wallet still takes this path.
373
+ */
374
+ export interface Caip122SignInResult {
367
375
  address: string;
368
376
  publicKey: string;
369
377
  /** Hex-encoded signature. */
370
378
  signature: string;
371
379
  /** The exact string that was signed. Rebuild it to verify the signature. */
372
380
  message: string;
381
+ mode?: 'caip122';
382
+ }
383
+ /**
384
+ * What a hardware account answers with instead.
385
+ *
386
+ * A Ledger cannot produce the result above. The XRP app signs transactions and
387
+ * has no message primitive at all, so there is no command to ask it for a
388
+ * CAIP-122 signature — the wallet proves ownership by signing a canonical
389
+ * 1-drop Payment on the device instead, and hands you the signed transaction.
390
+ *
391
+ * The transaction is built entirely by the wallet and is unsubmittable twice
392
+ * over: `Sequence` is `0`, which is never valid for a funded account, and the
393
+ * destination is the signing account itself, which `rippled` refuses as
394
+ * `temREDUNDANT`. It carries your challenge in a memo, as
395
+ * `{"wallet":"joey","challenge":"<nonce>"}` hex-encoded.
396
+ *
397
+ * ## Verifying one
398
+ *
399
+ * `signedTx` is `JSON.stringify` of the *bare* decoded transaction — not
400
+ * wrapped in `{ tx_json: … }` — so `JSON.parse` it and use the result as a
401
+ * transaction object. Re-encode it with `ripple-binary-codec` and check the
402
+ * signature, then check the signer is the address you are about to trust.
403
+ *
404
+ * There is no `message` or `signature` field here, and that is the trap this
405
+ * type exists to close: a verifier written for the CAIP-122 shape reads three
406
+ * `undefined`s, sends them, and reports "signature did not verify" for a
407
+ * signature the user made correctly on their device.
408
+ */
409
+ export interface ChallengeSignInResult {
410
+ address: string;
411
+ /** The bare signed transaction, JSON-encoded. */
412
+ signedTx: string;
413
+ mode: 'challenge-v1';
373
414
  }
415
+ /**
416
+ * The result of {@link SignInParams}, in whichever form the account can make.
417
+ *
418
+ * Which one you get is the wallet’s decision and not yours: it depends on the
419
+ * account the user picks, and they pick it after your call has been made.
420
+ * Narrow with {@link isChallengeSignIn} before reading either shape.
421
+ */
422
+ export type SignInResult = Caip122SignInResult | ChallengeSignInResult;
423
+ /**
424
+ * Whether a sign-in came back as a signed transaction rather than a message.
425
+ *
426
+ * Tests for the field rather than for `mode`, deliberately: wallets older than
427
+ * the second shape send no `mode` at all, and a check written the other way
428
+ * round would misroute every one of them.
429
+ */
430
+ export declare function isChallengeSignIn(result: SignInResult): result is ChallengeSignInResult;
374
431
  export interface JoeyEventMap {
375
432
  /** The origin became authorised. */
376
433
  connect: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,iFAAiF;AACjF,eAAO,MAAM,WAAW,yCAA0C,CAAA;AAElE,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;AAEpD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,SAAS,CAAA;IAChB,gEAAgE;IAChE,SAAS,EAAE,MAAM,CAAA;IACjB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AAED,sEAAsE;AACtE,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAM9D;AAED,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,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,CAAA;IACjB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAA;IACf,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,cAAc,CAAA;CACrB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,qBAAqB,CAAA;AAEtE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,YAAY,GACnB,MAAM,IAAI,qBAAqB,CAEjC;AAID,MAAM,WAAW,YAAY;IAC3B,oCAAoC;IACpC,OAAO,EAAE;QAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;QAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAAA;KAAE,CAAA;IAC7D,2DAA2D;IAC3D,UAAU,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC/B,0EAA0E;IAC1E,eAAe,EAAE,WAAW,EAAE,CAAA;IAC9B,2EAA2E;IAC3E,cAAc,EAAE,WAAW,GAAG,IAAI,CAAA;CACnC;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,YAAY,CAAA;AAE9C,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,aAAa,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA"}
package/dist/types.js CHANGED
@@ -35,4 +35,14 @@ export function networkIdForChain(chain) {
35
35
  return null;
36
36
  return Number(chain.slice('xrpl:'.length));
37
37
  }
38
+ /**
39
+ * Whether a sign-in came back as a signed transaction rather than a message.
40
+ *
41
+ * Tests for the field rather than for `mode`, deliberately: wallets older than
42
+ * the second shape send no `mode` at all, and a check written the other way
43
+ * round would misroute every one of them.
44
+ */
45
+ export function isChallengeSignIn(result) {
46
+ return 'signedTx' in result;
47
+ }
38
48
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,gFAAgF;AAEhF,iFAAiF;AACjF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAA;AAYlE,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,WAAiC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AACxF,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,MAAM,KAAK,GAAG,QAAQ,SAAS,EAAE,CAAA;IACjC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,UAAU,CAAC,iCAAiC,SAAS,EAAE,CAAC,CAAA;IACpE,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACpC,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;AAC5C,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,gFAAgF;AAEhF,iFAAiF;AACjF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAA;AAYlE,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,WAAiC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AACxF,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,iBAAiB,CAAC,SAAiB;IACjD,MAAM,KAAK,GAAG,QAAQ,SAAS,EAAE,CAAA;IACjC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,UAAU,CAAC,iCAAiC,SAAS,EAAE,CAAC,CAAA;IACpE,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACpC,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;AAC5C,CAAC;AAyaD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAAoB;IAEpB,OAAO,UAAU,IAAI,MAAM,CAAA;AAC7B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joeywallet/wallet-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Dependency-free TypeScript SDK for the Joey Wallet browser extension (XLS-72d / Wallet Standard).",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/Joey-Wallet/joey-wallet-sdk#readme",
package/src/index.ts CHANGED
@@ -54,6 +54,7 @@ export {
54
54
  export {
55
55
  JOEY_CHAINS,
56
56
  chainForNetworkId,
57
+ isChallengeSignIn,
57
58
  isJoeyChain,
58
59
  networkIdForChain,
59
60
  type Amount,
@@ -73,6 +74,8 @@ export {
73
74
  type PathStep,
74
75
  type SignAndSubmitTransactionResult,
75
76
  type SigningContextParams,
77
+ type Caip122SignInResult,
78
+ type ChallengeSignInResult,
76
79
  type SignInMode,
77
80
  type SignInParams,
78
81
  type SignInResult,
package/src/provider.ts CHANGED
@@ -148,39 +148,32 @@ export const APPROVAL_TIMEOUT_MS = 300_000
148
148
  export const MAX_BULK_TRANSACTIONS = 32
149
149
 
150
150
  /**
151
- * Transaction types Joey refuses to sign for a website, whatever the user
152
- * clicks and whichever method carries them.
151
+ * Transaction types this SDK declares as refused for a website. Now empty.
153
152
  *
154
- * Published so a dapp can check before it builds a flow around one, and so the
155
- * refusal is a documented rule rather than a surprise `4100`. Every entry hands
156
- * over or destroys the account itself:
153
+ * **This list no longer describes what the wallet does.** It is a published
154
+ * constant, not a gate: nothing in this SDK reads it, and no signing method
155
+ * consults it `signTransaction`, `signTransactionFor` and
156
+ * `signTransactionBulk` hand `tx_json` to the provider unread. Emptying it
157
+ * removed an advertisement, not an enforcement point.
157
158
  *
158
- * - `SetRegularKey`, `SignerListSet` and `DelegateSet` (XLS-75) each grant
159
- * permanent authority to act as the account, by three separate mechanisms.
160
- * - `AccountDelete` is irreversible.
161
- * - `SetHook` installs code that runs on every future transaction.
162
- * - `Batch` (XLS-56) carries other transactions inside `RawTransactions`, and
163
- * Joey's approval screen renders the outer transaction. A user cannot consent
164
- * to something they were never shown, so it is refused until the review
165
- * screen can render inner transactions individually.
159
+ * The wallet keeps its own rules and applies them at approval time, at every
160
+ * nesting level. At the time of writing it still refuses `SetRegularKey`,
161
+ * `SignerListSet`, `DelegateSet` (XLS-75), `AccountDelete`, `SetHook` and
162
+ * `Batch` (XLS-56) each of which hands over or destroys the account itself,
163
+ * or, for `Batch`, hides its real payload in `RawTransactions` where the
164
+ * approval screen cannot render it for consent. It also refuses an `AccountSet`
165
+ * that sets or clears a control-changing flag (`asfDisableMaster`,
166
+ * `asfRequireAuth`, `asfNoFreeze` and that family), and the pseudo-transactions
167
+ * `EnableAmendment`, `SetFee` and `UNLModify`, which no account signs.
166
168
  *
167
- * Two rules are not expressible as a type name and are enforced anyway:
168
- * `AccountSet` is refused when it sets or clears a flag that changes who
169
- * controls the account (`asfDisableMaster`, `asfRequireAuth`, `asfNoFreeze` and
170
- * the rest of that family) and permitted otherwise; and the ledger's
171
- * pseudo-transactions — `EnableAmendment`, `SetFee`, `UNLModify` — are refused
172
- * because no account signs one.
169
+ * So a dapp can no longer check this constant to find out what will be
170
+ * rejected. Expect those refusals to arrive as a `4100` from the approval
171
+ * queue, and handle them there.
173
172
  *
174
- * The wallet checks at every nesting level, not just the top.
173
+ * @deprecated Empty, and no longer a description of wallet behaviour. Do not
174
+ * treat a passing check against it as permission to sign.
175
175
  */
176
- export const JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES: readonly string[] = Object.freeze([
177
- 'SetRegularKey',
178
- 'SignerListSet',
179
- 'DelegateSet',
180
- 'AccountDelete',
181
- 'SetHook',
182
- 'Batch',
183
- ])
176
+ export const JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES: readonly string[] = Object.freeze([])
184
177
 
185
178
  export function isJoeyInjectedProvider(value: unknown): value is JoeyInjectedProvider {
186
179
  if (typeof value !== 'object' || value === null) return false
package/src/types.ts CHANGED
@@ -273,10 +273,11 @@ export interface SignTransactionForParams<TTx extends TransactionLike = AnyTrans
273
273
  *
274
274
  * **This is not XLS-56 `Batch`, and the two must not be confused.** A `Batch`
275
275
  * is a single transaction that carries others inside `RawTransactions` and
276
- * commits them atomically on-ledger; Joey refuses to sign one for a website
277
- * (see {@link JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES}) because its approval
278
- * screen renders the outer transaction and a user cannot consent to inner ones
279
- * they were never shown. `signTransactionBulk` is the opposite arrangement:
276
+ * commits them atomically on-ledger; the wallet refuses to sign one for a
277
+ * website because its approval screen renders the outer transaction and a user
278
+ * cannot consent to inner ones they were never shown. That refusal arrives as a
279
+ * `4100` at approval time {@link JOEY_DAPP_FORBIDDEN_TRANSACTION_TYPES} is
280
+ * empty and will not warn you about it. `signTransactionBulk` is the opposite arrangement:
280
281
  * ordinary, separate transactions, each rendered on its own page of the
281
282
  * approval, each signed on its own, with no on-ledger atomicity at all. If
282
283
  * transaction 3 fails, 1 and 2 have still happened.
@@ -413,13 +414,76 @@ export interface SignInParams {
413
414
  resources?: string[]
414
415
  }
415
416
 
416
- export interface SignInResult {
417
+ /**
418
+ * What a software account answers with: a signature over a CAIP-122 message.
419
+ *
420
+ * `mode` is optional because wallets predating the second shape do not send
421
+ * it. Do not branch on it being `caip122` — branch on the *other* shape, with
422
+ * {@link isChallengeSignIn}, so an older wallet still takes this path.
423
+ */
424
+ export interface Caip122SignInResult {
417
425
  address: string
418
426
  publicKey: string
419
427
  /** Hex-encoded signature. */
420
428
  signature: string
421
429
  /** The exact string that was signed. Rebuild it to verify the signature. */
422
430
  message: string
431
+ mode?: 'caip122'
432
+ }
433
+
434
+ /**
435
+ * What a hardware account answers with instead.
436
+ *
437
+ * A Ledger cannot produce the result above. The XRP app signs transactions and
438
+ * has no message primitive at all, so there is no command to ask it for a
439
+ * CAIP-122 signature — the wallet proves ownership by signing a canonical
440
+ * 1-drop Payment on the device instead, and hands you the signed transaction.
441
+ *
442
+ * The transaction is built entirely by the wallet and is unsubmittable twice
443
+ * over: `Sequence` is `0`, which is never valid for a funded account, and the
444
+ * destination is the signing account itself, which `rippled` refuses as
445
+ * `temREDUNDANT`. It carries your challenge in a memo, as
446
+ * `{"wallet":"joey","challenge":"<nonce>"}` hex-encoded.
447
+ *
448
+ * ## Verifying one
449
+ *
450
+ * `signedTx` is `JSON.stringify` of the *bare* decoded transaction — not
451
+ * wrapped in `{ tx_json: … }` — so `JSON.parse` it and use the result as a
452
+ * transaction object. Re-encode it with `ripple-binary-codec` and check the
453
+ * signature, then check the signer is the address you are about to trust.
454
+ *
455
+ * There is no `message` or `signature` field here, and that is the trap this
456
+ * type exists to close: a verifier written for the CAIP-122 shape reads three
457
+ * `undefined`s, sends them, and reports "signature did not verify" for a
458
+ * signature the user made correctly on their device.
459
+ */
460
+ export interface ChallengeSignInResult {
461
+ address: string
462
+ /** The bare signed transaction, JSON-encoded. */
463
+ signedTx: string
464
+ mode: 'challenge-v1'
465
+ }
466
+
467
+ /**
468
+ * The result of {@link SignInParams}, in whichever form the account can make.
469
+ *
470
+ * Which one you get is the wallet’s decision and not yours: it depends on the
471
+ * account the user picks, and they pick it after your call has been made.
472
+ * Narrow with {@link isChallengeSignIn} before reading either shape.
473
+ */
474
+ export type SignInResult = Caip122SignInResult | ChallengeSignInResult
475
+
476
+ /**
477
+ * Whether a sign-in came back as a signed transaction rather than a message.
478
+ *
479
+ * Tests for the field rather than for `mode`, deliberately: wallets older than
480
+ * the second shape send no `mode` at all, and a check written the other way
481
+ * round would misroute every one of them.
482
+ */
483
+ export function isChallengeSignIn(
484
+ result: SignInResult,
485
+ ): result is ChallengeSignInResult {
486
+ return 'signedTx' in result
423
487
  }
424
488
 
425
489
  /* -------------------------------------------------------------------- events */