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

CIP-0095 | signData correction #897

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
60 changes: 1 addition & 59 deletions CIP-0095/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,67 +432,9 @@ sign a payload conforming to said spec.

##### Supported Credentials

Here we define how each key is identified by an `Address` in relation to
[CIP-0019 | Cardano Addresses](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/README.md),
these are all Shelley key-hash-based addresses.

We allow for `DRepID` to be passed in the `addr` field to signal signature using the associated DRep key.

To construct an address for DRep Key, the client application should construct a
[type 6 address](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019-cardano-addresses.abnf#L7C8-L7C93).
Using an appropriate
[Network Tag](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019-cardano-addresses.abnf#L13)
and a hash of a public DRep Key.

<!-- prettier-ignore-start -->
| Key | Identifying `addr` |
| ----------- | ------------------ |
| Payment Key | Address types: [0](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019-cardano-addresses.abnf#L1), [2](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019-cardano-addresses.abnf#L3), [4](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019-cardano-addresses.abnf#L5), [6](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019-cardano-addresses.abnf#L7C27-L7C72). |
| Stake Key | Address type: [14](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019-cardano-addresses.abnf#L10). |
| DRep Key | [`DRepID`](#drepid) |
<!-- prettier-ignore-end -->

These keys will be used to sign the `COSE_Sign1`'s `Sig_structure` with the
following headers set:

- `alg` (1) - must be set to `EdDSA` (-8)
- `kid` (4) - Optional, if present must be set to the same value as in the
`COSE_key` specified below. It is recommended to be set to the same value as
in the `"address"` header.
- `"address"` - must be set to the raw binary bytes of the address as per the
binary spec, without the CBOR binary wrapper tag

The payload is not hashed and no `external_aad` is used.

##### Returns

The return shall be a `DataSignature` with `signature` set to the hex-encoded
CBOR bytes of the `COSE_Sign1` object specified above and `key` shall be the
hex-encoded CBOR bytes of a `COSE_Key` structure with the following headers set:

- `kty` (1) - must be set to `OKP` (1).
- `kid` (2) - Optional, if present must be set to the same value as in the
`COSE_Sign1` specified above.
- `alg` (3) - must be set to `EdDSA` (-8).
- `crv` (-1) - must be set to `Ed25519` (6).
- `x` (-2) - must be set to the public key bytes of the key used to sign the
`Sig_structure`.

##### Errors

<!-- prettier-ignore-start -->

| Error Type | Error Code | Return Condition |
| --------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `APIError` | `InvalidRequest` | Returned if a input parameter is passed. |
| `APIError` | `InternalError` | Returned if there is a generic internal error occurred during execution of this API call. |
| `APIError` | `Refused` | Returned if there is a refusal, could be wallet disconnection or extension is revoked. |
| `APIError` | `AccountChange` | Returned if wallet has changed account, meaning connection should be reestablished. |
| `DataSignError` | `ProofGeneration` | Returned if user has accepted to sign, but wallet could not sign the data; because the wallet does not have the required keys. |
| `DataSignError` | `AddressNotPK` | Returned if Address was not a P2PK address and thus had no SK associated with it. |
| `DataSignError` | `UserDeclined` | Returned if the user declined to sign the data. |

<!-- prettier-ignore-stop -->
The DRep hash [CIP-5](https://github.com/cardano-foundation/CIPs/blob/master/CIP-0005/README.md#hashes) should be used in the `"address"` field of `COSE_Sign1`'s `Sig_structure` header.

### Versioning

Expand Down