-
Notifications
You must be signed in to change notification settings - Fork 10
Remove duplicated Cipher and Folder client #225
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7e824e2
Implement bw uuid
Hinton d4eeb5c
Impl OrganizationId and remove folder and ciphers wasm clients
Hinton f11d480
Get rid of BwGuid
Hinton aaab17e
Format
Hinton c796ea5
Merge branch 'main' of github.com:bitwarden/sdk-internal into arch/bwโฆ
Hinton 40fbb30
Change Uuid to never, add type-fest and tag uuids.
Hinton 459bde4
Add uuid macro
Hinton ba210e7
Impl new, From, FromStr for Uuid
Hinton 4cccada
Move org id to core
Hinton 05f22af
Merge branch 'main' of github.com:bitwarden/sdk-internal into arch/bwโฆ
Hinton 50a921b
Format
Hinton 94f424c
Add doc
Hinton 7fba7ab
Sort workspaces
Hinton 9172700
Remove wasm feature from uuid crate
Hinton e770bad
Add :: to types in the macro for safety
Hinton 70c5ea8
Add some tests
Hinton 1b357b3
Fix CI
Hinton a34235c
Simplify
Hinton 4278869
Add READMEs
Hinton 099020f
Add tests for serializing
Hinton 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
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,3 @@ | ||
use bitwarden_uuid::uuid; | ||
|
||
uuid!(pub OrganizationId); |
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
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,26 @@ | ||
[package] | ||
name = "bitwarden-uuid-macro" | ||
description = """ | ||
Internal crate for the bitwarden crate. Do not use. | ||
""" | ||
|
||
version.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
rust-version.workspace = true | ||
readme.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
license-file.workspace = true | ||
keywords.workspace = true | ||
|
||
[dependencies] | ||
proc-macro2 = { workspace = true } | ||
quote = { workspace = true } | ||
syn = { workspace = true } | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[lib] | ||
proc-macro = true |
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,3 @@ | ||
# Bitwarden UUID Macro | ||
|
||
Provides uuid macros for simplifying UUID handling when working with WebAssembly. |
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,75 @@ | ||
#![doc = include_str!("../README.md")] | ||
|
||
use proc_macro::TokenStream; | ||
use quote::quote; | ||
use syn::{ | ||
parse::{Parse, ParseStream}, | ||
parse_macro_input, Ident, Visibility, | ||
}; | ||
|
||
#[proc_macro] | ||
pub fn uuid(input: TokenStream) -> TokenStream { | ||
// Parse input as: vis ident | ||
let input = parse_macro_input!(input as IdTypeInput); | ||
let ident = input.ident; | ||
let vis = input.vis; | ||
let name_str = ident.to_string(); | ||
|
||
let tsify_type = format!("Tagged<Uuid, \"{}\">", name_str); | ||
let doc_string = format!(" NewType wrapper for `{}`", name_str); | ||
|
||
let expanded = quote! { | ||
#[doc = #doc_string] | ||
#[cfg_attr(feature = "wasm", derive(::tsify_next::Tsify), tsify(into_wasm_abi, from_wasm_abi))] | ||
#[derive( | ||
::serde::Serialize, ::serde::Deserialize, | ||
::std::cmp::PartialEq, ::std::cmp::Eq, | ||
::std::clone::Clone, ::std::marker::Copy, ::std::fmt::Debug | ||
)] | ||
#[repr(transparent)] | ||
#vis struct #ident | ||
( | ||
#[cfg_attr(feature = "wasm", tsify(type = #tsify_type))] | ||
::uuid::Uuid | ||
); | ||
|
||
#[cfg(feature = "uniffi")] | ||
uniffi::custom_newtype!(#ident, uuid::Uuid); | ||
|
||
impl #ident { | ||
pub fn new(value: uuid::Uuid) -> Self { | ||
Self(value) | ||
} | ||
} | ||
|
||
impl ::std::str::FromStr for #ident { | ||
type Err = uuid::Error; | ||
|
||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
uuid::Uuid::from_str(s).map(Self) | ||
} | ||
} | ||
|
||
impl From<#ident> for ::uuid::Uuid { | ||
fn from(value: #ident) -> Self { | ||
value.0 | ||
} | ||
} | ||
}; | ||
|
||
TokenStream::from(expanded) | ||
} | ||
|
||
// Helper struct to parse "vis ident" | ||
struct IdTypeInput { | ||
vis: Visibility, | ||
ident: Ident, | ||
} | ||
|
||
impl Parse for IdTypeInput { | ||
fn parse(input: ParseStream) -> syn::Result<Self> { | ||
let vis: Visibility = input.parse()?; | ||
let ident: Ident = input.parse()?; | ||
Ok(IdTypeInput { vis, ident }) | ||
} | ||
} |
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,26 @@ | ||
[package] | ||
name = "bitwarden-uuid" | ||
description = """ | ||
Internal crate for the bitwarden crate. Do not use. | ||
""" | ||
|
||
version.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
rust-version.workspace = true | ||
readme.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
license-file.workspace = true | ||
keywords.workspace = true | ||
|
||
[dependencies] | ||
bitwarden-uuid-macro = { workspace = true } | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[dev-dependencies] | ||
serde = { workspace = true } | ||
serde_json = { workspace = true } | ||
uuid = { workspace = true } |
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,3 @@ | ||
# Bitwarden UUID | ||
|
||
Provides UUID macros for simplifying UUID handling when working with WebAssembly. |
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,3 @@ | ||
#![doc = include_str!("../README.md")] | ||
|
||
pub use bitwarden_uuid_macro::uuid; |
Oops, something went wrong.
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.