Skip to content

Commit 5ca3386

Browse files
update bls12_381 documentation formatting using warning box
1 parent af67452 commit 5ca3386

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

soroban-sdk/src/crypto/bls12_381.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,15 @@ impl Fp {
208208
/// Maps this `Fp` element to a `G1Affine` point using the [simplified SWU
209209
/// mapping](https://www.rfc-editor.org/rfc/rfc9380.html#name-simplified-swu-for-ab-0).
210210
///
211-
/// **Important:** The resulting point is on the curve but may not be in the
212-
/// prime-order subgroup (operations like pairing may fail). To ensure the
213-
/// point is in the prime-order subgroup, cofactor clearing must be
214-
/// performed on the output.
211+
/// <div class="warning">
212+
/// <h6>Warning</h6>
213+
/// The resulting point is on the curve but may not be in the prime-order subgroup (operations
214+
/// like pairing may fail). To ensure the point is in the prime-order subgroup, cofactor
215+
/// clearing must be performed on the output.
215216
///
216-
/// For applications requiring a point directly in the prime-order subgroup,
217-
/// consider using `hash_to_g1`, which handles subgroup checks and cofactor
218-
/// clearing internally.
217+
/// For applications requiring a point directly in the prime-order subgroup, consider using
218+
/// `hash_to_g1`, which handles subgroup checks and cofactor clearing internally.
219+
/// </div>
219220
pub fn map_to_g1(&self) -> G1Affine {
220221
self.env().crypto().bls12_381().map_fp_to_g1(self)
221222
}
@@ -344,14 +345,15 @@ impl Fp2 {
344345
/// Maps this `Fp2` element to a `G2Affine` point using the [simplified SWU
345346
/// mapping](https://www.rfc-editor.org/rfc/rfc9380.html#name-simplified-swu-for-ab-0).
346347
///
347-
/// **Important:** The resulting point is on the curve but may not be in the
348-
/// prime-order subgroup (operations like pairing may fail). To ensure the
349-
/// point is in the prime-order subgroup, cofactor clearing must be
350-
/// performed on the output.
348+
/// <div class="warning">
349+
/// <h6>Warning</h6>
350+
/// The resulting point is on the curve but may not be in the prime-order subgroup (operations
351+
/// like pairing may fail). To ensure the point is in the prime-order subgroup, cofactor
352+
/// clearing must be performed on the output.
351353
///
352-
/// For applications requiring a point directly in the prime-order subgroup,
353-
/// consider using `hash_to_g2`, which handles subgroup checks and cofactor
354-
/// clearing internally.
354+
/// For applications requiring a point directly in the prime-order subgroup, consider using
355+
/// `hash_to_g2`, which handles subgroup checks and cofactor clearing internally.
356+
/// </div>
355357
pub fn map_to_g2(&self) -> G2Affine {
356358
self.env().crypto().bls12_381().map_fp2_to_g2(self)
357359
}

0 commit comments

Comments
 (0)