Skip to content

Conversation

@steveluscher
Copy link
Collaborator

@steveluscher steveluscher commented Oct 27, 2025

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Oct 27, 2025

⚠️ No Changeset found

Latest commit: f24097e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Collaborator Author

steveluscher commented Oct 27, 2025

@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from 20a5a3c to 5ef6547 Compare October 28, 2025 23:22
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from c99272f to e9ef12c Compare October 28, 2025 23:22
@bundlemon
Copy link

bundlemon bot commented Oct 28, 2025

BundleMon

Files added (3)
Status Path Size Limits
offchain-messages/dist/index.browser.mjs
+4.23KB -
offchain-messages/dist/index.native.mjs
+4.23KB -
offchain-messages/dist/index.node.mjs
+4.23KB -
Files updated (4)
Status Path Size Limits
@solana/kit production bundle
kit/dist/index.production.min.js
38.23KB (+2.14KB +5.94%) -
errors/dist/index.native.mjs
16.97KB (+1.27KB +8.11%) -
errors/dist/index.node.mjs
16.99KB (+1.27KB +8.09%) -
errors/dist/index.browser.mjs
16.97KB (+1.27KB +8.1%) -
Unchanged files (126)
Status Path Size Limits
rpc-graphql/dist/index.browser.mjs
18.82KB -
rpc-graphql/dist/index.native.mjs
18.81KB -
rpc-graphql/dist/index.node.mjs
18.81KB -
transaction-messages/dist/index.browser.mjs
7.29KB -
transaction-messages/dist/index.native.mjs
7.29KB -
transaction-messages/dist/index.node.mjs
7.29KB -
codecs-data-structures/dist/index.browser.mjs
4.69KB -
codecs-data-structures/dist/index.native.mjs
4.69KB -
codecs-data-structures/dist/index.node.mjs
4.69KB -
webcrypto-ed25519-polyfill/dist/index.node.mj
s
3.6KB -
webcrypto-ed25519-polyfill/dist/index.browser
.mjs
3.59KB -
webcrypto-ed25519-polyfill/dist/index.native.
mjs
3.57KB -
instruction-plans/dist/index.browser.mjs
3.42KB -
instruction-plans/dist/index.native.mjs
3.42KB -
instruction-plans/dist/index.node.mjs
3.41KB -
codecs-core/dist/index.browser.mjs
3.41KB -
codecs-core/dist/index.native.mjs
3.41KB -
codecs-core/dist/index.node.mjs
3.41KB -
rpc-subscriptions/dist/index.browser.mjs
3.37KB -
rpc-subscriptions/dist/index.node.mjs
3.34KB -
rpc-subscriptions/dist/index.native.mjs
3.31KB -
addresses/dist/index.browser.mjs
2.93KB -
rpc-transformers/dist/index.browser.mjs
2.93KB -
rpc-transformers/dist/index.native.mjs
2.93KB -
addresses/dist/index.native.mjs
2.93KB -
addresses/dist/index.node.mjs
2.93KB -
rpc-transformers/dist/index.node.mjs
2.93KB -
transactions/dist/index.browser.mjs
2.9KB -
transactions/dist/index.native.mjs
2.9KB -
transactions/dist/index.node.mjs
2.9KB -
signers/dist/index.browser.mjs
2.63KB -
signers/dist/index.native.mjs
2.63KB -
signers/dist/index.node.mjs
2.62KB -
codecs-strings/dist/index.browser.mjs
2.53KB -
codecs-strings/dist/index.node.mjs
2.48KB -
codecs-strings/dist/index.native.mjs
2.45KB -
transaction-confirmation/dist/index.node.mjs
2.41KB -
transaction-confirmation/dist/index.native.mj
s
2.36KB -
transaction-confirmation/dist/index.browser.m
js
2.35KB -
sysvars/dist/index.browser.mjs
2.35KB -
sysvars/dist/index.native.mjs
2.34KB -
sysvars/dist/index.node.mjs
2.34KB -
react/dist/index.browser.mjs
2.31KB -
react/dist/index.native.mjs
2.31KB -
react/dist/index.node.mjs
2.31KB -
rpc-subscriptions-spec/dist/index.node.mjs
2.18KB -
rpc-subscriptions-spec/dist/index.native.mjs
2.13KB -
rpc-subscriptions-spec/dist/index.browser.mjs
2.13KB -
keys/dist/index.browser.mjs
2.08KB -
keys/dist/index.native.mjs
2.08KB -
keys/dist/index.node.mjs
2.08KB -
codecs-numbers/dist/index.native.mjs
2.01KB -
codecs-numbers/dist/index.browser.mjs
2.01KB -
codecs-numbers/dist/index.node.mjs
2.01KB -
rpc/dist/index.node.mjs
1.95KB -
rpc-transport-http/dist/index.browser.mjs
1.91KB -
rpc-transport-http/dist/index.native.mjs
1.9KB -
rpc/dist/index.native.mjs
1.81KB -
rpc/dist/index.browser.mjs
1.8KB -
subscribable/dist/index.node.mjs
1.8KB -
subscribable/dist/index.native.mjs
1.75KB -
subscribable/dist/index.browser.mjs
1.74KB -
rpc-transport-http/dist/index.node.mjs
1.72KB -
kit/dist/index.browser.mjs
1.69KB -
kit/dist/index.native.mjs
1.68KB -
kit/dist/index.node.mjs
1.68KB -
rpc-types/dist/index.browser.mjs
1.53KB -
rpc-types/dist/index.native.mjs
1.53KB -
rpc-types/dist/index.node.mjs
1.53KB -
rpc-subscriptions-channel-websocket/dist/inde
x.node.mjs
1.33KB -
rpc-subscriptions-channel-websocket/dist/inde
x.native.mjs
1.27KB -
rpc-subscriptions-channel-websocket/dist/inde
x.browser.mjs
1.26KB -
options/dist/index.browser.mjs
1.18KB -
options/dist/index.native.mjs
1.18KB -
options/dist/index.node.mjs
1.17KB -
accounts/dist/index.browser.mjs
1.13KB -
accounts/dist/index.native.mjs
1.12KB -
accounts/dist/index.node.mjs
1.12KB -
rpc-api/dist/index.browser.mjs
976B -
rpc-api/dist/index.native.mjs
975B -
rpc-api/dist/index.node.mjs
973B -
compat/dist/index.browser.mjs
969B -
compat/dist/index.native.mjs
968B -
compat/dist/index.node.mjs
966B -
rpc-spec-types/dist/index.browser.mjs
962B -
rpc-spec-types/dist/index.native.mjs
961B -
rpc-spec-types/dist/index.node.mjs
959B -
rpc-subscriptions-api/dist/index.native.mjs
870B -
rpc-subscriptions-api/dist/index.node.mjs
869B -
rpc-subscriptions-api/dist/index.browser.mjs
868B -
rpc-spec/dist/index.browser.mjs
852B -
rpc-spec/dist/index.native.mjs
851B -
rpc-spec/dist/index.node.mjs
850B -
promises/dist/index.browser.mjs
799B -
promises/dist/index.native.mjs
798B -
promises/dist/index.node.mjs
797B -
assertions/dist/index.browser.mjs
783B -
instructions/dist/index.browser.mjs
769B -
instructions/dist/index.native.mjs
768B -
instructions/dist/index.node.mjs
767B -
fast-stable-stringify/dist/index.browser.mjs
726B -
fast-stable-stringify/dist/index.native.mjs
725B -
assertions/dist/index.native.mjs
724B -
fast-stable-stringify/dist/index.node.mjs
724B -
assertions/dist/index.node.mjs
723B -
programs/dist/index.browser.mjs
329B -
programs/dist/index.native.mjs
327B -
programs/dist/index.node.mjs
325B -
event-target-impl/dist/index.node.mjs
230B -
functional/dist/index.browser.mjs
154B -
functional/dist/index.native.mjs
152B -
text-encoding-impl/dist/index.native.mjs
152B -
functional/dist/index.node.mjs
151B -
codecs/dist/index.browser.mjs
137B -
codecs/dist/index.native.mjs
136B -
codecs/dist/index.node.mjs
134B -
event-target-impl/dist/index.browser.mjs
133B -
ws-impl/dist/index.node.mjs
131B -
text-encoding-impl/dist/index.browser.mjs
122B -
text-encoding-impl/dist/index.node.mjs
119B -
ws-impl/dist/index.browser.mjs
113B -
crypto-impl/dist/index.node.mjs
111B -
crypto-impl/dist/index.browser.mjs
109B -
rpc-parsed-types/dist/index.browser.mjs
66B -
rpc-parsed-types/dist/index.native.mjs
65B -
rpc-parsed-types/dist/index.node.mjs
63B -

Total files change +18.68KB +5.18%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from e9ef12c to ff2f77d Compare October 29, 2025 20:32
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from 5ef6547 to c543d03 Compare October 29, 2025 20:32
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from c543d03 to 9fbcb37 Compare October 29, 2025 20:33
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch 2 times, most recently from fc0222b to cd7d979 Compare October 29, 2025 20:44
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch 2 times, most recently from 489ce4d to fd499f3 Compare October 29, 2025 20:50
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from cd7d979 to 97ec70f Compare October 29, 2025 20:50
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from fd499f3 to c3058bb Compare October 29, 2025 22:26
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from 97ec70f to 67fe1e2 Compare October 29, 2025 22:26
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from c3058bb to d105ffc Compare October 31, 2025 01:51
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch 2 times, most recently from 7201537 to abbde28 Compare November 1, 2025 00:14
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from d105ffc to 5a6ab95 Compare November 1, 2025 00:14
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2025

Documentation Preview: https://kit-docs-n8qfjmv92-anza-tech.vercel.app

@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from abbde28 to 9f7a067 Compare November 7, 2025 00:20
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from 5a6ab95 to 312ffe5 Compare November 7, 2025 00:20
@steveluscher steveluscher marked this pull request as ready for review November 7, 2025 00:21
@socket-security
Copy link

socket-security bot commented Nov 7, 2025

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

Copy link
Member

@lorisleiva lorisleiva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very clean! Just a few comments on implementation details.

Comment on lines 12 to 14
Readonly<{
address: Address<TAddress>;
}>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this redundant since MessageSigner<TAddress> already contains { address: Address<TAddress> }?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've simplified these types in the latest revision. I don't feel like I understand the conceptual underpinning of these types. I've just been trying to copy-paste-modify the account-signer-meta files and repurpose them for requiredSignatories but at most junctures the types don't seem to do what I want them to, let alone something useful.

I think you wrote the original types for account meta signers. Does what I'm doing here make any sense at all?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made another comment but this makes sense to me. Though, you could probably simplify this with:

export type OffchainMessageSignatorySigner<TAddress extends string = string> = MessageSigner<TAddress>;

Comment on lines +114 to +123
// Ensure there are any MessageModifyingSigner in the first place.
const modifyingSigners = signers.filter(isMessageModifyingSigner);
if (modifyingSigners.length === 0) return [];

// Prefer modifying signers that do not offer partial signing.
const nonPartialSigners = modifyingSigners.filter(signer => !isMessagePartialSigner(signer));
if (nonPartialSigners.length > 0) return nonPartialSigners;

// Otherwise, choose only one modifying signer (whichever).
return [modifyingSigners[0]];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, is it? Is it even desirable to permit modifying signers here? Why would you let a signer modify an offchain message, especially one that is destined for multiple signers? Should we even allow modifying signers in the first place?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of any use-cases for modifying these messages when signing but there is likely some that I don't see and I think it would be nice to support it for consistency with the rest of the signer API.

Do you have any concerns with this approach?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only that it's easy to widen the type later, but harder to narrow it. @jordaaash, do you know of any reason why we would or would not allow modifying signers for offchain messages?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess one example is if your v0 message can be displayed with Restricted ASCII but you gave it the message format ASCII, a software wallet that knows it's using a Ledger account might swap the message format before sending it to Ledger.

Also the SIWS spec (or at least Phantom's docs for it) have some fields the wallet is expected to determine if they're not provided, so if you were using this for SIWS then you'd expect the wallet to modify the nested message in those cases.

@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from 9f7a067 to 85b9303 Compare November 10, 2025 23:43
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from 312ffe5 to 438ef45 Compare November 10, 2025 23:43
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from 85b9303 to de974db Compare November 13, 2025 01:55
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from 438ef45 to 16fa1d8 Compare November 13, 2025 01:56
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from de974db to fb28986 Compare November 13, 2025 18:36
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from 16fa1d8 to 978e54e Compare November 13, 2025 18:36
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from 978e54e to d411f9b Compare November 13, 2025 18:39
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from fb28986 to fec9151 Compare November 13, 2025 18:39
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from d411f9b to f25c626 Compare November 13, 2025 18:39
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from fec9151 to 623f0d6 Compare November 13, 2025 18:39
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from f25c626 to dacb5f4 Compare November 13, 2025 19:30
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from 623f0d6 to a6684ff Compare November 13, 2025 19:30
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from dacb5f4 to e8781ec Compare November 13, 2025 19:51
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from a6684ff to 4f8008e Compare November 13, 2025 19:51
Comment on lines +114 to +123
// Ensure there are any MessageModifyingSigner in the first place.
const modifyingSigners = signers.filter(isMessageModifyingSigner);
if (modifyingSigners.length === 0) return [];

// Prefer modifying signers that do not offer partial signing.
const nonPartialSigners = modifyingSigners.filter(signer => !isMessagePartialSigner(signer));
if (nonPartialSigners.length > 0) return nonPartialSigners;

// Otherwise, choose only one modifying signer (whichever).
return [modifyingSigners[0]];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess one example is if your v0 message can be displayed with Restricted ASCII but you gave it the message format ASCII, a software wallet that knows it's using a Ledger account might swap the message format before sending it to Ledger.

Also the SIWS spec (or at least Phantom's docs for it) have some fields the wallet is expected to determine if they're not provided, so if you were using this for SIWS then you'd expect the wallet to modify the nested message in those cases.

Copy link
Member

@lorisleiva lorisleiva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a look at the changes.

TAddress extends string = string,
TSigner extends MessageSigner<TAddress> = MessageSigner<TAddress>,
> {
requiredSignatories: readonly OffchainMessageSignatorySigner<TAddress, TSigner>[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, here you want to accept both signers and "address wrappers" as signatories. If so, what you had before makes more sense:

Suggested change
requiredSignatories: readonly OffchainMessageSignatorySigner<TAddress, TSigner>[];
requiredSignatories: readonly (OffchainMessageSignatory<TAddress> | OffchainMessageSignatorySigner<TAddress, TSigner>)[];

Comment on lines 12 to 14
Readonly<{
address: Address<TAddress>;
}>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made another comment but this makes sense to me. Though, you could probably simplify this with:

export type OffchainMessageSignatorySigner<TAddress extends string = string> = MessageSigner<TAddress>;

@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from e8781ec to d8b4eb4 Compare November 17, 2025 19:04
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from 4f8008e to 8d0bb19 Compare November 17, 2025 19:04
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from d8b4eb4 to 12f263f Compare November 17, 2025 19:06
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from 8d0bb19 to 01762a7 Compare November 17, 2025 19:07
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from 12f263f to bb721da Compare November 18, 2025 21:52
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from 01762a7 to 2e08910 Compare November 18, 2025 21:52
@steveluscher steveluscher force-pushed the 10-24-add_functions_that_let_you_sign_offchain_message_envelopes branch from bb721da to 0cc9210 Compare November 18, 2025 22:14
@steveluscher steveluscher force-pushed the 10-27-utilties-and-types-that-let-you-sign-offchain-message-using-the-signers-api branch from 2e08910 to f24097e Compare November 18, 2025 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants