-
Notifications
You must be signed in to change notification settings - Fork 34
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
docs: 466/hash-verification #512
base: main
Are you sure you want to change the base?
Changes from 2 commits
063471f
1bbb999
6797435
a296fcc
b32911b
9984d2a
e490101
8377884
221c328
0040ace
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,45 @@ | ||||||
--- | ||||||
title: Hash verification | ||||||
--- | ||||||
|
||||||
import { CodeBlock, LinkOut } from '@interledger/docs-design-system' | ||||||
|
||||||
Once a resource owner (RO) authorizes a client software, the authorization server (AS) will redeirect the RO's [identify provider (IdP)](/introduction/idp/) to the finish URI. In order to secure this communication and verify that the redirect indeed emanated from the AS, the AS will provide a hash parameter in the request to the client's callback URI. The client **_must_** verify this hash. | ||||||
|
||||||
## Hashing method | ||||||
|
||||||
The hash base is generated by concatentating the following values in sequence using a single newline (0x0A) character to separate them: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
1. `nonce` value sent by the client in the initial request. | ||||||
2. `nonce` value sent by the AS from the interaction finish response. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The interact nonce is returned after making the initial grant request (interaction instructions): {
"interact": {
"redirect": "https://auth.rafiki.money/4CF492MLVMSW9MKMXKHQ",
"finish": "4105340a-05eb-4290-8739-f9e2b463bfa7" // <- nonce
},
"continue": {
"access_token": {
"value": "33OMUKMKSKU80UPRY5NM"
},
"uri": "https://auth.rafiki.money/continue/4CF492MLVMSW9MKMXKHQ",
"wait": 30
}
} |
||||||
3. `interact_ref` returned from the AS in the interaction finish method. | ||||||
4. The grant endpoint `uri` the client used to make its initial request. | ||||||
|
||||||
The following example shows the four aforementioned components that make up the hash base. There is no padding or whitespace before or after each line and no trailing newline character. | ||||||
|
||||||
<CodeBlock title="Example hash base"> | ||||||
|
||||||
```http | ||||||
VJLO6A4CATR0KRO | ||||||
MBDOFXG4Y5CVJCX821LH | ||||||
4IFWWIKYB2PQ6U56NL1 | ||||||
https://server.example.com/tx | ||||||
``` | ||||||
|
||||||
</CodeBlock> | ||||||
|
||||||
The ASCII encoding of this string is hashed with the algorithm specified in the `hash_method` parameter under the `finish` key of the interaction finish request. The byte array from the hash function is then encoded using URL-Safe Base64 with no padding. The resultant string is the hash value. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Rafiki we are doing only doing CC @mkurapov There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, |
||||||
|
||||||
Unless specified by the client in the initial request, the `hash_method` will default to `sha-256`. If the client specifies the `hash_method`, the `hash_method` **_must_** be one of the hash name strings defined in the <LinkOut href='https://www.iana.org/assignments/named-information/named-information.xhtml#hash-alg'>IANA Named Information Hash Algorithm Registry</LinkOut>. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mkurapov are we planning to support other hashing methods as well? If not I think we should only mention There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so, we can just mention There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can say that Open Payments uses sha-256 only (even though GNAP is more flexible) |
||||||
|
||||||
Using our hash base string example above, the following is the `sha-256` encoded hash that uses the 256-bit SHA2 algorithm. | ||||||
|
||||||
<CodeBlock title="SHA2 256-bit hash example"> | ||||||
|
||||||
```http | ||||||
x-gguKWTj8rQf7d7i3w3UhzvuJ5bpOlKyAlVpLxBffY | ||||||
``` | ||||||
|
||||||
</CodeBlock> | ||||||
|
||||||
For more information refer to the <LinkOut href='https://datatracker.ietf.org/doc/html/draft-ietf-gnap-core-protocol-20#name-calculating-the-interaction'> "Calculating the interaction hash"</LinkOut> section of the GNAP specification. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you remove the quotation marks around the link name? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
title: Identity providers | ||
--- | ||
|
||
import { | ||
CodeBlock, | ||
LinkOut, | ||
Tooltip, | ||
Mermaid, | ||
MermaidWrapper | ||
} from '@interledger/docs-design-system' | ||
import Interactive from '/src/partials/diagram-interactive-grant.mdx' | ||
|
||
An identity provider (IdP) is a system or service that manages user authentication, identity information, and consent. Open Payments requires any authorization server (AS) that issues <Tooltip content="A grant requiring explicit interaction/consent from the resource owner before an access token can be issued" client:load><span>interactive grants</span></Tooltip> be integrated with an IdP. | ||
|
||
After an interactive grant request is initiated and the AS sets the session, the AS provides the client with the IdP URI to redirect the end-user to. | ||
|
||
<Interactive /> | ||
|
||
:::tip[Reference implementation] | ||
Rafiki provides a reference <LinkOut href='https://github.com/interledger/rafiki/tree/main/packages/auth'>authorization service</LinkOut> implementation that includes support for integration with an IdP. | ||
::: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's link to the Rafiki docs? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.