Skip to content
Merged
Show file tree
Hide file tree
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
383 changes: 352 additions & 31 deletions crates/registry-breg/src/api/external_views.rs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions crates/registry-breg/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ pub fn compile_project_with_assets(
return Err(CompileFailure::from_errors(diagnostics).with_findings(&findings));
}

let (mut entities, physical_names) =
let (mut entities, mut physical_names) =
compile_entities(&sources, &origins, assets).map_err(|failure| {
stopped_compile_failure(failure, &findings, "compiled model construction")
})?;
Expand All @@ -378,7 +378,7 @@ pub fn compile_project_with_assets(
"external view compilation",
)
})?;
crate::external_views::mark_link_fields(&external_views, &mut entities);
crate::external_views::mark_link_fields(&external_views, &mut entities, &mut physical_names);
crate::membership::compile(&mut entities);
let recipients = crate::consent::compile(project, &sources, &mut entities);
crate::event_record::compile(&sources, &mut entities);
Expand Down
16 changes: 16 additions & 0 deletions crates/registry-breg/src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const MAX_TOKEN_BYTES: usize = ((1 + NONCE_BYTES + MAX_PAYLOAD_BYTES + TAG_BYTES
const MAX_AGE_SECONDS: u64 = 86_400;
const CURSOR_AAD: &[u8] = b"breg-cursor-v3";
const EXTERNAL_CURSOR_AAD: &[u8] = b"breg-external-cursor-v1";
const MANAGED_REFRESH_AAD: &[u8] = b"breg-managed-refresh-v1";
const AEAD_LABEL: &[u8] = b"breg-cursor-aead-key-v3";
const BINDING_LABEL: &[u8] = b"breg-cursor-binding-key-v3";

Expand Down Expand Up @@ -74,6 +75,21 @@ impl CursorCodec {
serde_json::from_slice(&plaintext).map_err(|_| CursorError::Invalid)
}

pub(crate) fn seal_managed_refresh<T: Serialize>(
&self,
payload: &T,
) -> Result<String, CursorError> {
self.seal(MANAGED_REFRESH_AAD, payload)
}

pub(crate) fn open_managed_refresh<T: serde::de::DeserializeOwned>(
&self,
token: &str,
) -> Result<T, CursorError> {
let plaintext = self.open(MANAGED_REFRESH_AAD, token)?;
serde_json::from_slice(&plaintext).map_err(|_| CursorError::Invalid)
}

pub(crate) fn max_age(&self) -> Duration {
self.max_age
}
Expand Down
Loading
Loading