Skip to content

Commit 49d027c

Browse files
authored
[PM-24079] Add typesafe string types (#356)
## 🎟️ Tracking https://bitwarden.atlassian.net/browse/PM-24079 ## 📔 Objective Changes our exported wasm string mappings around encstring, signedpublickey, unsignedsharedkey, to be tagged. This means we can drop the tagged types `Opaque<string, ...>` on typescript, and safely consume the sdk exports. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
1 parent 449bce7 commit 49d027c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

crates/bitwarden-crypto/src/enc_string/asymmetric.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ mod internal {
2020
#[cfg(feature = "wasm")]
2121
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
2222
const TS_CUSTOM_TYPES: &'static str = r#"
23-
export type UnsignedSharedKey = string;
23+
export type UnsignedSharedKey = Tagged<string, "UnsignedSharedKey">;
2424
"#;
2525

2626
/// # Encrypted string primitive

crates/bitwarden-crypto/src/enc_string/symmetric.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::{
1515
#[cfg(feature = "wasm")]
1616
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
1717
const TS_CUSTOM_TYPES: &'static str = r#"
18-
export type EncString = string;
18+
export type EncString = Tagged<string, "EncString">;
1919
"#;
2020

2121
/// # Encrypted string primitive

crates/bitwarden-crypto/src/keys/signed_public_key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use crate::{
1919
#[cfg(feature = "wasm")]
2020
#[wasm_bindgen::prelude::wasm_bindgen(typescript_custom_section)]
2121
const TS_CUSTOM_TYPES: &'static str = r#"
22-
export type SignedPublicKey = string;
22+
export type SignedPublicKey = Tagged<string, "SignedPublicKey">;
2323
"#;
2424

2525
/// `PublicKeyFormat` defines the format of the public key in a `SignedAsymmetricPublicKeyMessage`.

0 commit comments

Comments
 (0)