You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.
Public Key field and access_key.Nonce field of action is not displayed in app-near
cargo run --example sign_add_key_functioncall
app-near displays this case identical to Full Access one (Public Key field and access_key.Nonce field of action is not displayed, no details show on Function Call Permission)
The protocol is similar to regular transaction signing, which has 20 bytes of 5-component BIP32Path followed by borsh serialization of transaction transferred over multiple apdu messages. There're two differences:
instruction byte in all of apdu headers is changed from 2 -> 7
constINS_SIGN_TRANSACTION:u8 = 2;// Instruction code to sign a transaction on the LedgerconstINS_SIGN_NEP413_MESSAGE:u8 = 7;// Instruction code to sign a nep-413 message with Ledger
20 bytes of 5-component BIP32Path are followed by borsh serialization of NEP413Payload:
Sample code which forms and sends such a message is targeted by this link.
nep-366 message protocol
The protocol is similar to regular transaction signing, which has 20 bytes of 5-component BIP32Path followed by borsh serialization of transaction transferred over multiple apdu messages. There're two differences:
instruction byte in all of apdu headers is changed from 2 -> 8
constINS_SIGN_TRANSACTION:u8 = 2;// Instruction code to sign a transaction on the LedgerconstINS_SIGN_NEP366_DELEGATE_ACTION:u8 = 8;// Instruction code to sign a nep-366 delegate action with Ledger
pubstructDelegateAction{/// Signer of the delegated actionspubsender_id:AccountId,/// Receiver of the delegated actions.pubreceiver_id:AccountId,/// List of actions to be executed.////// With the meta transactions MVP defined in NEP-366, nested/// DelegateActions are not allowed. A separate type is used to enforce it.pubactions:Vec<NonDelegateAction>,/// Nonce to ensure that the same delegate action is not sent twice by a/// relayer and should match for given account's `public_key`./// After this action is processed it will increment.pubnonce:Nonce,/// The maximal height of the block in the blockchain below which the given DelegateAction is valid.pubmax_block_height:BlockHeight,/// Public key used to sign this delegated action.pubpublic_key:PublicKey,}pubtypeNonce = u64;pubtypeBlockHeight = u64;
Sample code which forms and sends such a message is targeted by this link.
question: should public_key, nonce, block_hash fields of transaction prefix be displayed as well
Nah, it is useless for users. Public key has to match the private key on Ledger, so you may validate this and it would be better than asking user to do that.
question: can AccountId be Secp256K1PublicKey representation as hex string 128 bytes long?
Nope, but before you asked, I have never really put a thought that NEAR doesn't support implicit accounts with keys different than ed25519. Which is a bit odd, but it makes things simpler
Various
safe_load.sh
#2Existing functionality
INS_GET_PUBLIC_KEY
andINS_GET_WALLET_ID
- feat:display
p1 flag inINS_GET_PUBLIC_KEY
, addINS_GET_WALLET_ID
#4Action
parsing to usedeserialize_in_place
#5 ,assert_eq!(mem::size_of::<Transfer>, 16)
assert_eq!(mem::size_of::<TransactionPrefix>, 224)
public_key
,nonce
,block_hash
fields of transaction prefix be displayed as wellCreateAccount
action #6 ,assert_eq!(mem::size_of::<CreateAccount>, 0)
AccountId
beSecp256K1PublicKey
representation as hex string 128 bytes long?DeleteAccount
action #7 ,assert_eq!(mem::size_of::<DeleteAccount>, 76)
DeleteKey
action #8,assert_eq!(mem::size_of::<DeleteKey>, 65)
Stake
action #9,assert_eq!(mem::size_of::<Stake>, 88)
AddKey
action #10,assert_eq!(mem::size_of::<AddKey>, 88), assert_eq!(mem::size_of::<FunctionCallPermission>, 328)
AddKey
#11DeployContract
action #12,assert_eq!(mem::size_of::<DeployContract>, 56)
Vec<u8>
SHA256 innear-cli-rs
FunctionCall
action #13,assert_eq!(mem::size_of::<FunctionCallCommon>, 88)
,assert_eq!(mem::size_of::<CappedString<200>>, 212)
Delegate
action signing with error #14FunctionCall
with binary args crash #18FunctionCall
(handler rewrite, buffers reduced) #20advantages as compared to
app-near
app-near
comparison of details shown with
app-near
CreateAccountAction
DeleteAccountAction
app-near
DeleteKeyAction
app-near
StakeAction
app-near
TransferAction
AddKeyAction
app-near
app-near
displays this case identical to Full Access one (Public Key field and access_key.Nonce field of action is not displayed, no details show on Function Call Permission)code
field of action not displayed inapp-near
; sha256 ofcode
field is displayed inapp-near-rs
FunctionCallAction
gas
field of action isn't displayed inapp-near
(stringargs
argument)gas
field of action isn't diplayed, binaryargs
argument displayed as blank inapp-near
New functionality
nep-413
sign message flow #15sign_tx
andsign_nep366_delegate_action
flows #19nep-413
message protocolThe protocol is similar to regular transaction signing, which has 20 bytes of 5-component BIP32Path followed by
borsh
serialization of transaction transferred over multiple apdu messages. There're two differences:2
->7
borsh
serialization ofNEP413Payload
:Sample code which forms and sends such a message is targeted by this link.
nep-366
message protocolThe protocol is similar to regular transaction signing, which has 20 bytes of 5-component BIP32Path followed by
borsh
serialization of transaction transferred over multiple apdu messages. There're two differences:2
->8
borsh
serialization ofDelegateAction
:Sample code which forms and sends such a message is targeted by this link.
CI/Ragger tests
details
test_get_version_cmd
#23test_get_public_key_and_confirm_screen
added #24test_sign_transfer
#26test_sign_create_account
#27test_delete_account
#28test_sign_delete_key
#29test_sign_stake
#30test_sign_add_key
#31test_sign_deploy_contract
#32test_sign_function_call
#33test_batch_all_actions
#34test_sign_nep413_msg
#37test_sign_nep366_delegate_action
#38test_public_key_validation
#39*.py
tests #40Encountered issues:
ledger-app-builder:latest
withrustc 1.75.0-nightly (0f44eb32f 2023-11-09)
crashes a nanos app LedgerHQ/ledger-device-rust-sdk#122ASCII
-only in Suggestion: declare explicit support ofASCII
-only charset at SDK level LedgerHQ/ledger-device-rust-sdk#124.\n
and carriage return\r
problems withMultiFieldReview<'a>
LedgerHQ/ledger-device-rust-sdk#146These LedgerHQ/ledger-device-rust-sdk#124 and LedgerHQ/ledger-device-rust-sdk#146 haven't been resolved yet, but have been worked around by #47
The text was updated successfully, but these errors were encountered: