-
Notifications
You must be signed in to change notification settings - Fork 32
Implements Notary Proofs #346
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
Open
Step7750
wants to merge
15
commits into
master
Choose a base branch
from
feature/notary-client
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5c31f64
Initial Offscreen Communication Layer
Step7750 0d3d50c
Implements E2E Communication to Offscreen
Step7750 cf4e802
Integrates `tlsn-js`, E2E Flow Proving
Step7750 5545f0a
Improves estimation of max sent data
Step7750 a1cdb22
Improves estimate of max recv data
Step7750 08c7c60
removes console.log
Step7750 3f45ab5
Improves signaling when offscreen is ready
Step7750 f6c41c8
minor header cleanup
Step7750 7b9feb0
Adds max concurrency to notary proving
Step7750 19258d8
adds mechanism to close offscreen after multiple proofs
Step7750 17d735d
Fixes manifest remapping for firefox
Step7750 d0b0dd9
lint
Step7750 c984672
lint
Step7750 aa6cbd3
address comments
Step7750 75e45c9
address comments
Step7750 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
export const environment = { | ||
csfloat_base_api_url: 'http://localhost:8080/api', | ||
notary: { | ||
tlsn: 'https://notary.csfloat.com/tlsn/', | ||
ws: 'wss://notary.csfloat.com/ws/', | ||
loggingLevel: 'Error', | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
export const environment = { | ||
csfloat_base_api_url: 'https://csfloat.com/api', | ||
notary: { | ||
tlsn: 'https://notary.csfloat.com/tlsn/', | ||
ws: 'wss://notary.csfloat.com/ws/', | ||
loggingLevel: 'Warn', | ||
}, | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import {SimpleHandler} from './main'; | ||
import {RequestType} from './types'; | ||
import {SendToOffscreen} from '../../../offscreen/client'; | ||
import {HasPermissions} from './has_permissions'; | ||
import {NotaryProveRequest} from '../../notary/types'; | ||
import {getAccessToken} from '../../alarms/access_token'; | ||
import {PresentationJSON} from 'tlsn-js/build/types'; | ||
import { | ||
OffscreenRequestType, | ||
TLSNProveOffscreenRequest, | ||
TLSNProveOffscreenResponse, | ||
} from '../../../offscreen/handlers/types'; | ||
import {MaxConcurrency} from '../wrappers/cached'; | ||
|
||
export interface NotaryProveResponse { | ||
presentation: PresentationJSON; | ||
} | ||
|
||
export const NotaryProve = MaxConcurrency( | ||
new SimpleHandler<NotaryProveRequest, NotaryProveResponse>( | ||
RequestType.NOTARY_PROVE, | ||
async (request: NotaryProveRequest): Promise<NotaryProveResponse> => { | ||
const steamPoweredPermissions = await HasPermissions.handleRequest( | ||
{ | ||
permissions: [], | ||
origins: ['https://api.steampowered.com/*'], | ||
}, | ||
{} | ||
); | ||
if (!steamPoweredPermissions.granted) { | ||
throw new Error('must have api.steampowered.com permissions in order to prove API requests'); | ||
} | ||
|
||
const access_token = await getAccessToken(request.expected_steam_id); | ||
|
||
const response = await SendToOffscreen<TLSNProveOffscreenRequest, TLSNProveOffscreenResponse>( | ||
OffscreenRequestType.TLSN_PROVE, | ||
{ | ||
notary_request: request, | ||
access_token, | ||
} | ||
); | ||
|
||
return { | ||
presentation: response.presentation, | ||
}; | ||
} | ||
), | ||
2 | ||
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
export enum ProofType { | ||
TRADE_OFFERS = 'trade_offers', | ||
TRADE_OFFER = 'trade_offer', | ||
TRADE_HISTORY = 'trade_history', | ||
TRADE_STATUS = 'trade_status', | ||
} | ||
|
||
interface ProveRequestPayloads { | ||
// IEconService/GetTradeOffers/v1/ | ||
[ProofType.TRADE_OFFERS]: { | ||
get_sent_offers?: boolean; | ||
get_received_offers?: boolean; | ||
get_descriptions?: boolean; | ||
language?: string; | ||
active_only?: boolean; | ||
historical_only?: boolean; | ||
time_historical_cutoff?: number; | ||
cursor?: number; | ||
}; | ||
// IEconService/GetTradeOffer/v1/ | ||
[ProofType.TRADE_OFFER]: { | ||
tradeofferid: string; | ||
}; | ||
// IEconService/GetTradeHistory/v1/ | ||
[ProofType.TRADE_HISTORY]: { | ||
max_trades: number; | ||
start_after_time?: number; | ||
start_after_tradeid?: string; | ||
navigating_back?: boolean; | ||
get_descriptions?: boolean; | ||
language?: string; | ||
include_failed?: boolean; | ||
include_total?: boolean; | ||
}; | ||
// IEconService/GetTradeStatus/v1/ | ||
[ProofType.TRADE_STATUS]: { | ||
tradeid: string; | ||
get_descriptions?: boolean; | ||
language?: string; | ||
}; | ||
} | ||
|
||
export type NotaryProveRequest = { | ||
[T in ProofType]: { | ||
type: T; | ||
expected_steam_id?: string; | ||
} & ProveRequestPayloads[T]; | ||
}[ProofType]; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.