diff --git a/.gitignore b/.gitignore index 2bade5f..2c8abbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules/* dist -.DS_Store \ No newline at end of file +.DS_Store +.idea \ No newline at end of file diff --git a/shared/requests/submit.yaml b/shared/requests/submit.yaml index b4553d1..5d850b1 100644 --- a/shared/requests/submit.yaml +++ b/shared/requests/submit.yaml @@ -78,6 +78,9 @@ components: AMMDeposit: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositTransaction' AMMVote: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction' AMMWithdraw: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction' + CredentialAccept: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptTransaction' + CredentialCreate: '../transactions/credential_create.yaml#/components/schemas/CredentialCreateTransaction' + CredentialDelete: '../transactions/credential_delete.yaml#/components/schemas/CredentialDeleteTransaction' CheckCancel: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction' CheckCash: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction' CheckCreate: '../transactions/check_create.yaml#/components/schemas/CheckCreateTransaction' @@ -122,6 +125,9 @@ components: - $ref: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositTransaction' - $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction' - $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction' + - $ref: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptTransaction' + - $ref: '../transactions/credential_create.yaml#/components/schemas/CredentialCreateTransaction' + - $ref: '../transactions/credential_delete.yaml#/components/schemas/CredentialDeleteTransaction' - $ref: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction' - $ref: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction' - $ref: '../transactions/check_create.yaml#/components/schemas/CheckCreateTransaction' @@ -181,6 +187,9 @@ components: AMMDeposit: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositTransaction' AMMVote: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction' AMMWithdraw: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction' + CredentialAccept: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptTransaction' + CredentialCreate: '../transactions/credential_create.yaml#/components/schemas/CredentialCreateTransaction' + CredentialDelete: '../transactions/credential_delete.yaml#/components/schemas/CredentialDeleteTransaction' CheckCancel: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction' CheckCash: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction' CheckCreate: '../transactions/check_create.yaml#/components/schemas/CheckCreateTransaction' @@ -225,6 +234,9 @@ components: - $ref: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositTransaction' - $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction' - $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction' + - $ref: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptTransaction' + - $ref: '../transactions/credential_create.yaml#/components/schemas/CredentialCreateTransaction' + - $ref: '../transactions/credential_delete.yaml#/components/schemas/CredentialDeleteTransaction' - $ref: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction' - $ref: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction' - $ref: '../transactions/check_create.yaml#/components/schemas/CheckCreateTransaction' @@ -343,6 +355,9 @@ components: AMMDeposit: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositTransaction' AMMVote: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction' AMMWithdraw: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction' + CredentialAccept: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptTransaction' + CredentialCreate: '../transactions/credential_create.yaml#/components/schemas/CredentialCreateTransaction' + CredentialDelete: '../transactions/credential_delete.yaml#/components/schemas/CredentialDeleteTransaction' CheckCancel: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction' CheckCash: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction' CheckCreate: '../transactions/check_create.yaml#/components/schemas/CheckCreateTransaction' @@ -388,6 +403,9 @@ components: - $ref: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositTransaction' - $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction' - $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction' + - $ref: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptTransaction' + - $ref: '../transactions/credential_create.yaml#/components/schemas/CredentialCreateTransaction' + - $ref: '../transactions/credential_delete.yaml#/components/schemas/CredentialDeleteTransaction' - $ref: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction' - $ref: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction' - $ref: '../transactions/check_create.yaml#/components/schemas/CheckCreateTransaction' @@ -442,6 +460,9 @@ components: AMMDeposit: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositTransaction' AMMVote: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction' AMMWithdraw: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction' + CredentialAccept: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptTransaction' + CredentialCreate: '../transactions/credential_create.yaml#/components/schemas/CredentialCreateTransaction' + CredentialDelete: '../transactions/credential_delete.yaml#/components/schemas/CredentialDeleteTransaction' CheckCancel: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction' CheckCash: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction' CheckCreate: '../transactions/check_create.yaml#/components/schemas/CheckCreateTransaction' @@ -487,6 +508,9 @@ components: - $ref: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositTransaction' - $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction' - $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction' + - $ref: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptTransaction' + - $ref: '../transactions/credential_create.yaml#/components/schemas/CredentialCreateTransaction' + - $ref: '../transactions/credential_delete.yaml#/components/schemas/CredentialDeleteTransaction' - $ref: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelTransaction' - $ref: '../transactions/check_cash.yaml#/components/schemas/CheckCashTransaction' - $ref: '../transactions/check_create.yaml#/components/schemas/CheckCreateTransaction' @@ -535,6 +559,9 @@ components: - $ref: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositErrorCode' - $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteErrorCode' - $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawErrorCode' + - $ref: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptErrorCode' + - $ref: '../transactions/credential_create.yaml#/components/schemas/CredentialCreateErrorCode' + - $ref: '../transactions/credential_delete.yaml#/components/schemas/CredentialDeleteErrorCode' - $ref: '../transactions/check_cancel.yaml#/components/schemas/CheckCancelErrorCode' - $ref: '../transactions/check_cash.yaml#/components/schemas/CheckCashErrorCode' - $ref: '../transactions/check_create.yaml#/components/schemas/CheckCreateErrorCode' diff --git a/shared/transactions/credential_accept.yaml b/shared/transactions/credential_accept.yaml new file mode 100644 index 0000000..3886353 --- /dev/null +++ b/shared/transactions/credential_accept.yaml @@ -0,0 +1,40 @@ +components: + schemas: + CredentialAcceptTransaction: + $id: CredentialAcceptTransaction + allOf: + - $ref: '../base.yaml#/components/schemas/BaseTransaction' + type: object + description: | + A CredentialAccept transaction accepts a credential, which makes the credential valid. Only the subject of the credential can do this. + required: + - CredentialType + - Issuer + properties: + CredentialType: + type: string + pattern: '^[0-9a-fA-F]+$' + description: Arbitrary data defining the type of credential. The minimum size is 1 byte and the maximum is 64 bytes. + Issuer: + type: string + description: The address of the issuer that created the credential. + x-custom-validation: + validCredentialType: + field: CredentialType + + CredentialAcceptErrorCode: + $id: CredentialAcceptErrorCode + type: string + description: Error codes for the CredentialAccept transaction. + enum: + - tecDUPLICATE + - tecEXPIRED + - tecNO_ENTRY + - temDISABLED + - temINVALID_ACCOUNT_ID + x-enum-descriptions: + tecDUPLICATE: The specified credential has already been accepted. + tecEXPIRED: The specified credential has an expiration time in the past. (In this case, the transaction also deletes the expired credentials from the ledger.) + tecNO_ENTRY: The credential uniquely identified by the Account, Issuer, and CredentialType fields of the transaction does not exist in the ledger. + temDISABLED: The related amendment is not enabled. + temINVALID_ACCOUNT_ID: The provided Issuer field is invalid. For example, it contains ACCOUNT_ZERO. diff --git a/shared/transactions/credential_create.yaml b/shared/transactions/credential_create.yaml new file mode 100644 index 0000000..6dc945c --- /dev/null +++ b/shared/transactions/credential_create.yaml @@ -0,0 +1,54 @@ +components: + schemas: + CredentialCreateTransaction: + $id: CredentialCreateTransaction + allOf: + - $ref: '../base.yaml#/components/schemas/BaseTransaction' + type: object + description: > + A CredentialCreate transaction creates a credential in the ledger. + The issuer of the credential uses this transaction to provisionally issue a credential. + The credential is not valid until the subject of the credential accepts it with a CredentialAccept transaction. + required: + - CredentialType + - Expiration + - Subject + properties: + CredentialType: + type: string + pattern: '^[0-9a-fA-F]+$' + description: Arbitrary data defining the type of credential this entry represents. The minimum length is 1 byte and the maximum length is 64 bytes. + Expiration: + type: number + format: uint32 + description: Time after which this credential expires, in seconds since the Ripple Epoch. + Subject: + type: string + description: The subject of the credential. + URI: + type: string + pattern: '^[0-9a-fA-F]+$' + maxLength: 512 + description: | + Arbitrary additional data about the credential, such as the URL where users can look up an associated Verifiable Credential document. + If present, the minimum length is 1 byte and the maximum is 256 bytes. + x-custom-validation: + validCredentialType: + field: CredentialType + + CredentialCreateErrorCode: + $id: CredentialCreateErrorCode + type: string + description: Error codes for the CredentialCreate transaction. + enum: + - tecDUPLICATE + - tecEXPIRED + - tecNO_TARGET + - temDISABLED + - temINVALID_ACCOUNT_ID + x-enum-descriptions: + tecDUPLICATE: A credential with the same subject, issuer, and credential type already exists in the ledger. + tecEXPIRED: The credential's expiration time is in the past. + tecNO_TARGET: The account specified in the Subject field is not a funded account in the ledger. + temDISABLED: The related amendment is not enabled. + temINVALID_ACCOUNT_ID: The provided Subject field is invalid. For example, it contains ACCOUNT_ZERO. diff --git a/shared/transactions/credential_delete.yaml b/shared/transactions/credential_delete.yaml new file mode 100644 index 0000000..a278024 --- /dev/null +++ b/shared/transactions/credential_delete.yaml @@ -0,0 +1,45 @@ +components: + schemas: + CredentialDeleteTransaction: + $id: CredentialDeleteTransaction + allOf: + - $ref: '../base.yaml#/components/schemas/BaseTransaction' + type: object + description: > + A CredentialDelete transaction removes a credential from the ledger, effectively revoking it. + Users may also want to delete an unwanted credential to reduce their reserve requirement. + required: + - CredentialType + properties: + CredentialType: + type: string + pattern: '^[0-9a-fA-F]+$' + description: Arbitrary data defining the type of credential to delete. The minimum length is 1 byte and the maximum length is 256 bytes. + Subject: + type: string + description: The subject of the credential to delete. If omitted, use the Account (sender of the transaction) as the subject of the credential. + Issuer: + type: string + description: The issuer of the credential to delete. If omitted, use the Account (sender of the transaction) as the issuer of the credential. + x-custom-validation: + requireOneOf: + - fields: + - Subject + - Issuer + validCredentialType: + field: CredentialType + + CredentialDeleteErrorCode: + $id: CredentialDeleteErrorCode + type: string + description: Error codes for the CredentialDelete transaction. + enum: + - temDISABLED + - temINVALID_ACCOUNT_ID + - tecNO_PERMISSION + - tecNO_ENTRY + x-enum-descriptions: + temDISABLED: The related amendment is not enabled. + temINVALID_ACCOUNT_ID: A provided Subject or Issuer field is invalid. For example, it contains ACCOUNT_ZERO. + tecNO_PERMISSION: The sender is neither the issuer nor subject of the credential, and the credential is not expired. + tecNO_ENTRY: The specified credential does not exist in the ledger.