Open
Description
I'm ByteZhang from the onekey team. If necessary, I will complete a PR, as I have always been proactive in promoting this feature.
Currently, due to security issues with signMessage, the experience of verifying accounts on hardware wallets is very poor for dApps. Therefore, there is a desire to directly implement an off-chain message signing interface similar to personal_sign.
Off-Chain Message Signing Proposal
import type { WalletAccount } from '@wallet-standard/base';
export const SolanaSignOffchainMessage = 'solana:signOffchainMessage';
export type SolanaSignOffchainMessageFeature = {
readonly [SolanaSignOffchainMessage]: {
/** Version of the feature API. */
readonly version: SolanaSignOffchainMessageVersion;
/** Sign Offchain Message With Solana (based on https://docs.anza.xyz/proposals/off-chain-message-signing). */
readonly signOffchainMessage: SolanaSignOffchainMessageMethod;
};
};
/** Version of the feature. */
export type SolanaSignOffchainMessageVersion = '1.0.0';
export type SolanaSignOffchainMessageMethod = (...inputs: readonly SolanaSignOffchainMessageInput[]) => Promise<readonly SolanaSignOffchainMessageOutput[]>;
/** Input for signing offchain message. */
export interface SolanaSignOffchainMessageInput {
/** Account to use. */
readonly account: WalletAccount;
/**
* Version of the offchain message.
* If not provided, default to `0`.
*/
readonly version?: number;
/** Message to sign, as raw bytes. */
readonly message: Uint8Array;
}
/** Output of signing offchain message. */
export interface SolanaSignOffchainMessageOutput {
/**
* Message bytes that were signed.
* The wallet may prefix or otherwise modify the message before signing it.
*/
readonly signedMessage: Uint8Array;
/**
* Message signature produced.
* If the signature type is provided, the signature must be Ed25519.
*/
readonly signature: Uint8Array;
/**
* Optional type of the message signature produced.
* If not provided, the signature must be Ed25519.
*/
readonly signatureType?: 'ed25519';
}
Metadata
Metadata
Assignees
Labels
No labels