-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove watermarking as inbuilt to signing, make standalone func
- Loading branch information
Showing
3 changed files
with
40 additions
and
30 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
Sources/KukaiCryptoSwift/Extensions/Array+extensions.swift
This file contains 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,18 @@ | ||
// | ||
// Array+extensions.swift | ||
// | ||
// | ||
// Created by Simon Mcloughlin on 12/05/2023. | ||
// | ||
|
||
import Foundation | ||
import Sodium | ||
|
||
public extension Array where Element == UInt8 { | ||
|
||
/// Prepare bytes for signing by applying a watermark and hashing. | ||
func addOperationWatermarkAndHash() -> [UInt8]? { | ||
let watermarkedOperation = Prefix.Watermark.operation + self | ||
return Sodium.shared.genericHash.hash(message: watermarkedOperation, outputLength: 32) | ||
} | ||
} |
This file contains 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 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