Skip to content

Commit 4fb43b4

Browse files
committed
Add is_explicit methods to confidential types
1 parent 3354fe5 commit 4fb43b4

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/confidential.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,14 @@ impl Value {
182182
Value::Confidential(..) => 33,
183183
}
184184
}
185+
186+
/// Check if the value is explicit.
187+
pub fn is_explicit(&self) -> bool {
188+
match *self {
189+
Value::Explicit(_) => true,
190+
_ => false,
191+
}
192+
}
185193
}
186194

187195
/// A CT commitment to an asset
@@ -205,6 +213,14 @@ impl Asset {
205213
Asset::Confidential(..) => 33,
206214
}
207215
}
216+
217+
/// Check if the asset is explicit.
218+
pub fn is_explicit(&self) -> bool {
219+
match *self {
220+
Asset::Explicit(_) => true,
221+
_ => false,
222+
}
223+
}
208224
}
209225

210226

@@ -231,6 +247,14 @@ impl Nonce {
231247
Nonce::Confidential(..) => 33,
232248
}
233249
}
250+
251+
/// Check if the nonce is explicit.
252+
pub fn is_explicit(&self) -> bool {
253+
match *self {
254+
Nonce::Explicit(_) => true,
255+
_ => false,
256+
}
257+
}
234258
}
235259

236260
#[cfg(test)]

0 commit comments

Comments
 (0)