@subwallet/extension-inject 1.3.89-0 → 1.3.90-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.
@@ -13,6 +13,6 @@ const packageInfo = {
13
13
  name: '@subwallet/extension-inject',
14
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
15
15
  type: 'cjs',
16
- version: '1.3.89-0'
16
+ version: '1.3.90-0'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "sideEffects": true,
16
16
  "type": "module",
17
- "version": "1.3.89-0",
17
+ "version": "1.3.90-0",
18
18
  "main": "./cjs/index.js",
19
19
  "module": "./index.js",
20
20
  "types": "./index.d.ts",
package/packageInfo.js CHANGED
@@ -7,5 +7,5 @@ export const packageInfo = {
7
7
  name: '@subwallet/extension-inject',
8
8
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
9
9
  type: 'esm',
10
- version: '1.3.89-0'
10
+ version: '1.3.90-0'
11
11
  };
package/types.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import type { KeypairType } from '@subwallet/keyring/types';
2
- import type { Signer as InjectedSigner } from '@polkadot/api/types';
2
+ import type { Signer as PolkadotSigner, SignerResult } from '@polkadot/api/types';
3
3
  import type { ProviderInterface } from '@polkadot/rpc-provider/types';
4
4
  import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
5
+ import type { HexString } from '@polkadot/util/types';
5
6
  declare type This = typeof globalThis;
6
7
  export declare type Unsubcall = () => void;
7
8
  export interface InjectedAccount {
@@ -70,6 +71,35 @@ export interface InjectedProviderWithMeta {
70
71
  provider: InjectedProvider;
71
72
  meta: ProviderMeta;
72
73
  }
74
+ export interface SignerPayloadVrf {
75
+ /** the account to derive for, must be a local sr25519 account */
76
+ address: string;
77
+ /** the message to derive over, 0x-prefixed hex */
78
+ data: HexString;
79
+ /** the caller's own domain separator within its origin, 0x-prefixed hex; empty if omitted */
80
+ context?: HexString;
81
+ }
82
+ export interface InjectedSigner extends PolkadotSigner {
83
+ /**
84
+ * SubWallet-specific extension to the injected-web3 spec: sr25519 VRF signing.
85
+ *
86
+ * Optional — dapps must feature-detect with `typeof signer.signVrf === 'function'`, and other
87
+ * injected signers (e.g. the MetaMask compat shim) legitimately do not implement it.
88
+ *
89
+ * Returns 96 hex-encoded bytes, `output(32) || proof(64)`. **Only `output(32)` is
90
+ * deterministic** — the proof is randomized, so two calls with the same payload return
91
+ * different 96-byte values. Derive keys from the first 32 bytes alone; hashing the whole
92
+ * result yields a different key on every call.
93
+ *
94
+ * The output is bound to the requesting site's origin (`scheme://host`), which the wallet
95
+ * takes from the tab and never from this payload. No other site can obtain the same value, and
96
+ * a dapp served from several origins (http vs https included) derives a different value on
97
+ * each, so pin a canonical one.
98
+ *
99
+ * Local password-protected sr25519 accounts only.
100
+ */
101
+ signVrf?: (payload: SignerPayloadVrf) => Promise<SignerResult>;
102
+ }
73
103
  export interface Injected {
74
104
  accounts: InjectedAccounts;
75
105
  metadata?: InjectedMetadata;