algorand / algorand/js-algorand-sdk
rawSignTxn To support only requiring the scalar (not the seed) to sign.
- 主要語言
- TypeScript
- 星號
- 297
- 分支
- 214
- 平均合併
- 1 小時 3 分鐘
- 30 天內合併 PR
- 3
描述
## Problem
Being able to sign transactions with derived keys from schemes like [BIP32-ed25519](https://acrobat.adobe.com/id/urn:aaid:sc:EU:04fe29b0-ea1a-478b-a886-9bb558a5242a), in which only kL (scalar) is known.
The following SDK code in file: `transaction.ts`:
```ts
// returns the raw signature
rawSignTxn(sk: Uint8Array) {
const toBeSigned = this.bytesToSign();
const sig = nacl.sign(toBeSigned, sk);
return Buffer.from(sig);
}
signTxn(sk: Uint8Array) {
// construct signed message
const sTxn: EncodedSignedTransaction = {
sig: this.rawSignTxn(sk),
txn: this.get_obj_for_encoding(),
};
// add AuthAddr if signing with a different key than From indicates
const keypair = nacl.keyPairFromSecretKey(sk);
const pubKeyFromSk = keypair.publicKey;
if (
address.encodeAddress(pubKeyFromSk) !==
address.encodeAddress(this.from.publicKey)
) {
sTxn.sgnr = Buffer.from(pubKeyFromSk);
}
return new Uint8Array(encoding.encode(sTxn));
}
```
Calls "Secret Key" to the Ed25519 seed. Explaining picture below:

In order to support HDWallets, we need to able to sign with the scalar. We use tweetnacl API's that use **SEED + PublicKey** instead of **a + RH**, which the latter would be preferable when only the scalar and RH is available.
## Solution
Support signing with the scalar instead of the seed (which is known as secret key within the SDK's code)
## Urgency
High - as it blocks the ecosystem from adopting BIP32-ed25519 derived keys and to continue to use the SDK to sign transactions with those derives keys.
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。