Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Account Profiles Specification #782

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Funkatronics
Copy link
Contributor

No description provided.

spec/spec.md Outdated
@@ -416,6 +427,7 @@ where:
"display_address_format": "<display_address_format>",
“label”: “<label>”,
"icon": "<icon>",
"profile": "<account_profile_id>",
Copy link
Contributor Author

@Funkatronics Funkatronics Apr 10, 2024

Choose a reason for hiding this comment

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

caveat here: adding this parameter to the account struct deviates from the wallet-standard Wallet Account API. To support this on the web we will need to map this profile id into the features parameter.

Alternatively, we could do the opposite. We could drop this new parameter in the spec, and instead use the existing features parameter. In the mobile SDKs, we could abstract this into an explicit profile parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd put it into the features parameter.

spec/spec.md Outdated
Account profiles are identifiers that are used to decribe an authorized account's capabilities. These are defined as feature identifiers for compatibiblity with the wallet-standard account features API.

- `solana:readOnly`
- A read-only account. These accounts should not be used as writeable accounts in transaction. These acounts may contain assets, but dapp endpoints should only expect to read from these accounts and prove ownership via a message sign. If a dapp requests a transaction signature from a readonly account, the wallet should reject the transaction. Read-only accounts are limited to the following features: [`solana:signMessages`](#sign_messages), `solana:signInWithSolana`.
Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT about "should reject" -> "will reject"? This will restrict wallet behavior, to ensure uniformity amongst implementations.

spec/spec.md Outdated
@@ -416,6 +427,7 @@ where:
"display_address_format": "<display_address_format>",
“label”: “<label>”,
"icon": "<icon>",
"profile": "<account_profile_id>",
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd put it into the features parameter.

spec/spec.md Outdated
- `solana:readWrite`
- An account that can be used as a writeable acount in transactions. Read-write accounts support, at a minimum, the following features: [`solana:signMessages`](#sign_messages), [`solana:signAndSendTransaction`](#sign_and_send_transactions).
- `solana:payer`
- An account that will be used to pay for transactions. Payer accounts support, at a minimum, the following features: [`solana:signAndSendTransaction`](#sign_and_send_transactions).
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this related to the concept of a fee payer (in the transaction sense), or to the concept of an account that should not be allowed to sign arbitrary messages?

Copy link
Contributor Author

@Funkatronics Funkatronics Apr 11, 2024

Choose a reason for hiding this comment

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

The former

spec/spec.md Outdated
@@ -139,6 +139,19 @@ These features are deprecated, but can be supported by wallet endpoints to maint

- [`solana:signTransactions`](#sign_transactions)

## Account Profiles
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With this approach, I think it makes more sense to call these "Account Labels"

Copy link
Contributor

Choose a reason for hiding this comment

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

I think account labels makes sense, adding context of when an account should be used. One potential one I see missing from this list is identity - an account that contains a users preferred identity credentials.

spec/spec.md Outdated
- The users primary account. This account will be used for sign in, and is expected to have the users primary assets.
- `feePayer`
- Fee payer accounts, when present, should be used to pay for transaction fees. This profile is incompatible with the `immutable` profile, a fee payer account cannot be `immutable`.
- `mutable`
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need both mutable and immutable, or does the absence of one imply the other?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could go either way, I am not certain what is best. both have drawbacks I think

A) With both mutable and immutable, its more explicit. tho it also adds the incompatibilities (mutable and feepayer cannot also be immutable)

B) With only mutable, the absence would imply immutability. feePayer would imply mutable as well which makes sense. primary would not imply mutable, it would need to be specified.

C) With only immutable, the absence would imply mutability. feePayer would be incompatible with immutable as it would not make sense to have an immutable fee payer.

I am leaning towards option B here, only having mutable. primary (and identity) accounts imply immutability if not specified. feePayer and mutable would be allowed but redundant.

Copy link
Contributor

Choose a reason for hiding this comment

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

I can think of one benefit for option C - if a wallet labels nothing. The default (and backward-compatible) behavior for an unlabeled account would be mutable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah thats a good point. gonna mull on this a bit more.

spec/spec.md Show resolved Hide resolved
spec/spec.md Outdated
@@ -139,6 +139,19 @@ These features are deprecated, but can be supported by wallet endpoints to maint

- [`solana:signTransactions`](#sign_transactions)

## Account Profiles
Copy link
Contributor

Choose a reason for hiding this comment

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

I think account labels makes sense, adding context of when an account should be used. One potential one I see missing from this list is identity - an account that contains a users preferred identity credentials.

spec/spec.md Outdated
@@ -139,6 +139,21 @@ These features are deprecated, but can be supported by wallet endpoints to maint

- [`solana:signTransactions`](#sign_transactions)

## Account Labels

Account labels are used to decribe an authorized account's capabilities and intended use. Each authorized account that is returned in [`authorize`](#authorize) request response can include a list of these labels. The dapp endpoint can use these labels in combination with the account's list of [`features`](#feature-identifiers) to determine how each acount should be used.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add some commentary here that wallets are encouraged to add labels, and that, when any labels are present, the wallet must fully label all returned accounts.

spec/spec.md Outdated
- The users primary account. This account will be used for sign in, and is expected to have the users primary assets.
- `feePayer`
- Fee payer accounts, when present, should be used to pay for transaction fees. This profile is incompatible with the `immutable` profile, a fee payer account cannot be `immutable`.
- `mutable`
Copy link
Contributor

Choose a reason for hiding this comment

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

I can think of one benefit for option C - if a wallet labels nothing. The default (and backward-compatible) behavior for an unlabeled account would be mutable.

spec/spec.md Outdated
@@ -442,6 +458,7 @@ where:
- `features`: (optional) a list of [feature identifiers](#feature-identifiers) that represent the features that are supported by this account. These features must be a subset of the features returned by [`get_capabilities`](#get_capabilities). If this parameter is not present the account has access to all available features (both mandatory and optional) supported by the wallet.
- `label`: (optional) a human-readable string that describes the account. Wallet endpoints that allow their users to label their accounts may choose to return those labels here to enhance the user experience at the dapp endpoint.
- `icon`: (optional) a data URI containing a base64-encoded SVG, WebP, PNG, or GIF image of an icon for the account. This may be displayed by the app.
- `labels`: a list of [account labels](#account-labels) for this account.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this mandatory or optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

should be optional, for backwards compatibility. will update

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.

2 participants