Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
forget delegation, it is now a persona
  • Loading branch information
1l0 committed Apr 29, 2025
commit 41de4001bcfefa01fc0381dce5694728cc01860e
69 changes: 13 additions & 56 deletions A2.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,42 @@
NIP-A2
======

Account delegation via kind-0
Persona
-------------------

`draft` `optional`

Defines how to use kind-0 for account delegation.
The clients responsible for account management create and post the delegator kind-0 event.
A user can utilize the delegatee account listed in their own delegator event. If a user creates a delegatee kind-0 event and it is valid, it is considered to represent the same identity with a different key pair.
This NIP defines how to create personae for a user. A persona represents an account owned by the main account but serving a distinct purpose. It is not intended to function as a master-subkey system or a form of delegation. The relationship between the main account and the persona account is expressed using `kind 0` events with a few tags.

## Delegator

```js
{
"kind": 0,
"tags": [
["p", <delegatee pubkey>, <approved kind for override>...],
],
"content": <metadata>,
// ...
}
```

- The `p` tag contains the delegatee's pubkey. Optional approved kinds for override can be appended. If no approved kinds are specified, it is considered unrestricted.
- MAY have multiple `p` tags.
## `kind 0` event

### Main Account

## Delegatee

```js
```jsonc
{
"kind": 0,
"tags": [
["P", <delegator pubkey>],
["alt", "delegation account"], // optional
["p", "<persona account pubkey>", "<optional description>"],
],
"content": <empty or metadata override>,
// ...
}
```

- The `P` tag contains the delegator's pubkey.
- MUST NOT have multiple `P` tags.
- The `content` can be empty or an override of the delegator's metadata if it is approved by the delegator.

## Validation
- The `p` tag contains a persona account pubkey. The optional description can be added.
- It MAY have multiple `p` tags.

If a delegator's kind-0 has no `p` tags, and a delegatee's kind-0 contains the delegator's `P` tag, it is considered an invalid delegation, and vice versa.

## Client
### Persona Account

Client SHOULD use the delegator's pubkey along with the delegatee's pubkey when adding to or removing from the contact list.
All delegatee stuff SHOULD be considered an override of the delegator's stuff if each kind is approved by the delegator.

## Example of kind-0 events for delegation

### Delegator

```js
```jsonc
{
"kind": 0,
"pubkey": "373ab6e211d2ef30fa72552a072f8cbc6c0cdb72902502d23f05818b6701eaf4",
"tags": [
["p", "1d58b9a772e6370e2193ac79055a67f4e2caabd8c9634e07e390ca1b1717946c", 0, 1, 3, 6, 7, 30023],
["P", "<main account pubkey>"],
],
"content": "{\"name\":\"User\",\"about\":\"I'm not a bitcoiner\"}",
// ...
}
```

### Delegatee

```js
{
"kind": 0,
"pubkey": "1d58b9a772e6370e2193ac79055a67f4e2caabd8c9634e07e390ca1b1717946c",
"tags": [
["P", "373ab6e211d2ef30fa72552a072f8cbc6c0cdb72902502d23f05818b6701eaf4"],
],
"content": "{\"name\":\"User (delegatee)\"}",
// ...
}
```
- The `P` tag contains the main account pubkey.
- It MUST NOT have multiple `P` tags.