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

Kinesis events with verifiable TS #98

Open
vasco-santos opened this issue Dec 13, 2022 · 0 comments
Open

Kinesis events with verifiable TS #98

vasco-santos opened this issue Dec 13, 2022 · 0 comments

Comments

@vasco-santos
Copy link
Contributor

vasco-santos commented Dec 13, 2022

Looks like we can do a client.roundAt(Data.now()) and send the round number through the stream. Kinesis consumer can be anything, including a consumer that will send events with receipts. In this scenario, stream consumer would rely on the randomness created with client.get(roundNumber) and sign the UCAN invocation as a proof.

Implementation

This was referenced Dec 13, 2022
vasco-santos added a commit that referenced this issue Dec 13, 2022
Adds kinesis ucan log stream to ucanto service. Once a UCAN invocation
is handled by the service, it is sent to Amazon Kinesis data streams for
post processing (JSON with invocation CID, invocation bytes, and decoded
invocation).

Kinesis log stream has its own stack named `UcanStreamStack` which will
include resources needed for post processing of ucan stream ops.
`ApiStack` depends on `UcanStreamStack` given it will use its stream, as
well as its data further down the line to get content like user facing
stats

Per https://www.notion.so/UCAN-LOG-0f3870fc4b404f5cbf646bf16b463365

Implementation details:
- Invocation view content
- `{ carCid: string, value: { att: UCAN.Capabilities, aud:
'did:${string}:${string}', iss: 'did:${string}:${string}' } }`
- having att, audience and issuer should be enough for all the
operations we intend to perform. Skipped `prf`, `exp`, `nbf`, `fct`,
`nnc`, `v`, and `signature`.
  - see format in comment below

Other notes:
- SST Kinesis guide:
https://sst.dev/examples/how-to-use-kinesis-data-streams-in-your-serverless-app.html
- we are configuring 365 days for now
https://docs.aws.amazon.com/cdk/api/v1/docs/aws-kinesis-readme.html#streams
- aws related deps updated to use same everywhere
- we are currently doing redundant encodings/decodings that could be
avoided if we do storacha/ucanto#169
- Follow up PRs will be created with consumers:
  - data aggregation lambda for user facing stats
  - dynamoDB
  - ...
- NOTE: they can start from before as we talked
https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-lambda-event-sources.KinesisEventSourceProps.html#properties
- we need to define a partition key, but we do not need to commit now to
one. Only by the time we want more shards for scaling up

Follow ups:
- #98

Co-authored-by: Alan Shaw <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant