mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-28 23:55:49 +00:00
Merge branch 'master' into ja-mpt
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
---
|
||||
seo:
|
||||
description: An attestation about a subject account from a credential issuer account, which can be used to preauthorize payments.
|
||||
status: not_enabled
|
||||
---
|
||||
# Credential
|
||||
|
||||
A `Credential` entry represents a [credential](../../../../concepts/decentralized-storage/credentials.md), which contains an attestation about a _subject_ account from a _credential issuer_ account. The meaning of the attestation is defined by the issuer.
|
||||
|
||||
_(Requires the [Credentials amendment][] {% not-enabled /%})_
|
||||
|
||||
## Example Credential JSON
|
||||
|
||||
```json
|
||||
{
|
||||
"LedgerEntryType": "Credential",
|
||||
"Flags": 65536,
|
||||
"Subject": "rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8",
|
||||
"Issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||
"IssuerNode": "0000000000000000",
|
||||
"CredentialType": "6D795F63726564656E7469616C",
|
||||
"PreviousTxnID": "8089451B193AAD110ACED3D62BE79BB523658545E6EE8B7BB0BE573FED9BCBFB",
|
||||
"PreviousTxnLgrSeq": 234644,
|
||||
"SubjectNode": "0000000000000000",
|
||||
"index": "A738A1E6E8505E1FC77BBB9FEF84FF9A9C609F2739E0F9573CDD6367100A0AA9"
|
||||
}
|
||||
```
|
||||
|
||||
<!-- TODO: update to a real example -->
|
||||
|
||||
## Credential Fields
|
||||
|
||||
In addition to the [common fields](../common-fields.md), {% code-page-name /%} entries have the following fields:
|
||||
|
||||
| Field | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:--------------------|:---------------------|:------------------|:----------|:----------------|
|
||||
| `CredentialType` | String - Hexadecimal | Blob | Yes | Arbitrary data defining the type of credential this entry represents. The minimum length is 1 byte and the maximum length is 64 bytes. |
|
||||
| `Expiration` | Number | UInt32 | No | Time after which the credential is expired, in [seconds since the Ripple Epoch][].
|
||||
| `Issuer` | String - [Address][] | AccountID | Yes | The account that issued this credential. |
|
||||
| `IssuerNode` | String | UInt64 | Yes | A hint indicating which page of the issuer's directory links to this entry, in case the directory consists of multiple pages. |
|
||||
| `PreviousTxnID` | String - [Hash][] | Hash256 | Yes | The identifying hash of the transaction that most recently modified this entry. |
|
||||
| `PreviousTxnLgrSeq` | Number | UInt32 | Yes | The [index of the ledger][Ledger Index] that contains the transaction that most recently modified this entry. |
|
||||
| `Subject` | String - [Address][] | AccountID | Yes | The account that this credential is for. |
|
||||
| `SubjectNode` | String | UInt64 | Yes | A hint indicating which page of the subject's owner directory links to this entry, in case the directory consists of multiple pages. |
|
||||
| `URI` | String - Hexadecimal | Blob | No | Arbitrary additional data about the credential, for example a URL where a W3C-formatted Verifiable Credential can be retrieved. |
|
||||
|
||||
## Credential Flags
|
||||
|
||||
Credential entries can have the following flags combined in the `Flags` field:
|
||||
|
||||
| Flag Name | Hex Value | Decimal Value | Description |
|
||||
|---------------|--------------|---------------|-------------|
|
||||
| `lsfAccepted` | `0x00010000` | 65536 | If enabled, the subject of the credential has accepted the credential. Otherwise, the issuer created the credential but the subject has not yet accepted it, meaning it is not yet valid. |
|
||||
|
||||
## Credential Reserve
|
||||
|
||||
A credential entry counts as one item towards the owner reserve of the subject account, if the subject has accepted the credential. Otherwise, a credential entry counts as one item toward the reserve of the issuer account.
|
||||
|
||||
## Credential ID Format
|
||||
|
||||
The unique ID of a Credential entry is the SHA-512Half hash of the following values concatenated in order:
|
||||
|
||||
* The `Credential` space key (`0x0044`);
|
||||
* The `Subject` field's value;
|
||||
* The `Issuer` field's value; and
|
||||
* The `CredentialType` field's value.
|
||||
|
||||
{% raw-partial file="/docs/_snippets/common-links.md" /%}
|
||||
@@ -7,12 +7,17 @@ labels:
|
||||
# DepositPreauth
|
||||
[[Source]](https://github.com/XRPLF/rippled/blob/f64cf9187affd69650907d0d92e097eb29693945/include/xrpl/protocol/detail/ledger_entries.macro#L246-L253 "Source")
|
||||
|
||||
A `DepositPreauth` entry tracks a preauthorization from one account to another. You can create a preauthorization by sending a [DepositPreauth transaction][].
|
||||
A `DepositPreauth` entry tracks a preauthorization from one account. You can create a preauthorization by sending a [DepositPreauth transaction][], but it has no effect unless you are using [Deposit Authorization](../../../../concepts/accounts/depositauth.md).
|
||||
|
||||
This has no effect on processing of transactions unless the account that provided the preauthorization requires [Deposit Authorization](../../../../concepts/accounts/depositauth.md). In that case, the account that was preauthorized can send payments and other transactions directly to the account that provided the preauthorization. Preauthorizations are one-directional, and have no effect on payments going the opposite direction.
|
||||
A preauthorization allows specific others to send money directly to you even if you have Deposit Authorization enabled. Preauthorizations are one-directional, and have no effect on payments going the opposite direction.
|
||||
|
||||
You can preauthorize a specific _account_ or a _set of credentials_. In the case of a set of credentials, any account that has a matching set of credentials on-ledger can send you money. _(Credential preauthorization requires the [Credentials amendment][]. {% not-enabled /%})_
|
||||
|
||||
## Example {% $frontmatter.seo.title %} JSON
|
||||
|
||||
{% tabs %}
|
||||
|
||||
{% tab label="Single account preauthorization" %}
|
||||
```json
|
||||
{
|
||||
"LedgerEntryType": "DepositPreauth",
|
||||
@@ -25,20 +30,55 @@ This has no effect on processing of transactions unless the account that provide
|
||||
"index": "4A255038CC3ADCC1A9C91509279B59908251728D0DAADB248FFE297D0F7E068C"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
|
||||
{% tab label="Credential preauthorization" %}
|
||||
```json
|
||||
{
|
||||
"LedgerEntryType": "DepositPreauth",
|
||||
"Account": "rsUiUMpnrgxQp24dJYZDhmV4bE3aBtQyt8",
|
||||
"AuthorizeCredentials": [{
|
||||
"Credential": {
|
||||
"Issuer": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
|
||||
"CredentialType": "6D795F63726564656E7469616C"
|
||||
}
|
||||
}],
|
||||
"Flags": 0,
|
||||
"OwnerNode": "0000000000000000",
|
||||
"PreviousTxnID": "FD2A4E9E317C7FEF112D22ADEB9E2C6DC3C2AB6E2AD96A50B76EBB9DEB39EA77",
|
||||
"PreviousTxnLgrSeq": 7,
|
||||
"index": "F2B8550ADF60FD268157262C1C54E1D1014BDEA361CE848B6F48556348327E5F"
|
||||
}
|
||||
```
|
||||
{% /tab %}
|
||||
{% /tabs %}
|
||||
|
||||
## {% $frontmatter.seo.title %} Fields
|
||||
|
||||
In addition to the [common fields](../common-fields.md), {% code-page-name /%} entries have the following fields:
|
||||
|
||||
| Field | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:--------------------|:-----------------|:------------------|:----------|:----------------|
|
||||
| `Account` | String | Account | Yes | The account that granted the preauthorization. (The destination of the preauthorized payments.) |
|
||||
| `Authorize` | String | Account | Yes | The account that received the preauthorization. (The sender of the preauthorized payments.) |
|
||||
| `LedgerEntryType` | String | UInt16 | Yes | The value `0x0070`, mapped to the string `DepositPreauth`, indicates that this is a DepositPreauth object. |
|
||||
| `OwnerNode` | String | UInt64 | Yes | A hint indicating which page of the sender's owner directory links to this object, in case the directory consists of multiple pages. **Note:** The object does not contain a direct link to the owner directory containing it, since that value can be derived from the `Account`. |
|
||||
| `PreviousTxnID` | String | Hash256 | Yes | The identifying hash of the transaction that most recently modified this object. |
|
||||
| `PreviousTxnLgrSeq` | Number | UInt32 | Yes | The [index of the ledger][Ledger Index] that contains the transaction that most recently modified this object. |
|
||||
| Field | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:--------------------|:------------------|:------------------|:----------|:------------|
|
||||
| `Account` | String | Account | Yes | The account that granted the preauthorization. (The destination of the preauthorized payments.) |
|
||||
| `Authorize` | String | Account | No | The account that received the preauthorization. (The sender of the preauthorized payments.) |
|
||||
| `AuthorizeCredentials` | Array | Array | No | The set of credentials that received preauthorization. (Any account with these credentials is preauthorized.) This array has a minimum length of 1 and a maximum length of 8 credentials. |
|
||||
| `LedgerEntryType` | String | UInt16 | Yes | The value `0x0070`, mapped to the string `DepositPreauth`, indicates that this is a DepositPreauth object. |
|
||||
| `OwnerNode` | String | UInt64 | Yes | A hint indicating which page of the sender's owner directory links to this object, in case the directory consists of multiple pages. **Note:** The object does not contain a direct link to the owner directory containing it, since that value can be derived from the `Account`. |
|
||||
| `PreviousTxnID` | String - [Hash][] | Hash256 | Yes | The identifying hash of the transaction that most recently modified this object. |
|
||||
| `PreviousTxnLgrSeq` | Number | UInt32 | Yes | The [index of the ledger][Ledger Index] that contains the transaction that most recently modified this object. |
|
||||
|
||||
Each entry must have _either_ the `Authorize` field or the `AuthorizeCredentials` field, but not both.
|
||||
|
||||
### Authorized Credential Objects
|
||||
|
||||
If the entry has an `AuthorizeCredentials` field, each member of that array is an inner object, identifying one credential to require, with the following format:
|
||||
|
||||
| Field | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:-----------------|:---------------------|:------------------|:----------|:----------------|
|
||||
| `Issuer` | String - [Address][] | AccountID | Yes | The issuer of the credential. |
|
||||
| `CredentialType` | String - Hexadecimal | Blob | Yes | The credential type of the credential. |
|
||||
|
||||
To be preauthorized, an account must hold all the specified credentials.
|
||||
|
||||
## {% $frontmatter.seo.title %} Flags
|
||||
|
||||
@@ -50,10 +90,23 @@ There are no flags defined for {% code-page-name /%} entries.
|
||||
|
||||
## DepositPreauth ID Format
|
||||
|
||||
The ID of a `DepositPreauth` object is the [SHA-512Half][] of the following values, concatenated in order:
|
||||
There are two formats for the ID of a `DepositPreauth` entry, depending on whether it authorizes an individual account or a set of credentials.
|
||||
|
||||
### Individual Account Preauthorization
|
||||
|
||||
In this case, the ID is the [SHA-512Half][] of the following values, concatenated in order:
|
||||
|
||||
* The DepositPreauth space key (`0x0070`)
|
||||
* The AccountID of the owner of this object (the sender of the [DepositPreauth transaction][] that created this object; in other words, the one that granted the preauthorization)
|
||||
* The AccountID of the preauthorized account (the `Authorized` field of the [DepositPreauth transaction][] that created this object; in other words, the one that received the preauthorization)
|
||||
* The AccountID in the `Authorize` field
|
||||
|
||||
### Credential Preauthorization
|
||||
_(Requires the [Credentials amendment][]. {% not-enabled /%})_
|
||||
|
||||
In this case, the ID is the [SHA-512Half][] of the following values, concatenated in order:
|
||||
|
||||
* The Credential Preauth space key (`0x0050`)
|
||||
* The AccountID of the owner of this object (the sender of the [DepositPreauth transaction][] that created this object; in other words, the one that granted the preauthorization)
|
||||
* The contents of the `AuthorizeCredentials` field.
|
||||
|
||||
{% raw-partial file="/docs/_snippets/common-links.md" /%}
|
||||
|
||||
Reference in New Issue
Block a user