Skip to content

Commit

Permalink
Create WalletToDappInteractionAuthProof on Sargon (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbzurovski authored Jan 29, 2025
1 parent 860b5f2 commit 3634378
Show file tree
Hide file tree
Showing 76 changed files with 264 additions and 153 deletions.
168 changes: 84 additions & 84 deletions Cargo.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Foundation
import SargonUniFFI

extension WalletToDappInteractionAuthProof {
public init(intentSignatureOfOwner: IntentSignatureOfOwner) {
self = newWalletToDappInteractionAuthProofFromIntentSignatureOfOwner(intentSignatureOfOwner: intentSignatureOfOwner)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import CustomDump
import Foundation
import Sargon
import SargonUniFFI
import XCTest

final class WalletToDappInteractionAuthProofTests: TestCase {
typealias SUT = WalletToDappInteractionAuthProof

func testNewFromIntentSignatures_Ed25519() throws {
let intentSignature = IntentSignature.sample // Ed25519
let sut = SUT(intentSignatureOfOwner: .init(owner: .sample, intentSignature: intentSignature))
XCTAssertEqual(sut.curve, .curve25519)
XCTAssertEqual(sut.publicKey, intentSignature.signatureWithPublicKey.publicKey)
XCTAssertEqual(sut.signature, intentSignature.signatureWithPublicKey.signature)
}

func testNewFromIntentSignatures_Secp256k1() throws {
let intentSignature = IntentSignature.sampleOther // Secp256k1
let sut = SUT(intentSignatureOfOwner: .init(owner: .sample, intentSignature: intentSignature))
XCTAssertEqual(sut.curve, .secp256k1)
XCTAssertEqual(sut.publicKey, intentSignature.signatureWithPublicKey.publicKey)
XCTAssertEqual(sut.signature, intentSignature.signatureWithPublicKey.signature)
}
}
2 changes: 1 addition & 1 deletion crates/app/home-cards/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "home-cards"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/app/key-derivation-traits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "key-derivation-traits"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/app/radix-connect-models/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "radix-connect-models"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/app/radix-connect/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "radix-connect"
version = "1.1.121"
version = "1.1.122"
edition = "2021"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ impl WalletToDappInteractionAuthProof {
}
}

impl From<SignatureWithPublicKey> for WalletToDappInteractionAuthProof {
fn from(signature_with_public_key: SignatureWithPublicKey) -> Self {
Self::new(
signature_with_public_key.public_key(),
signature_with_public_key.signature(),
)
}
}

impl HasSampleValues for WalletToDappInteractionAuthProof {
fn sample() -> Self {
Self::new(PublicKey::sample(), Signature::sample())
Expand Down Expand Up @@ -61,4 +70,19 @@ mod tests {
fn panics_if_curve_discrepancy() {
let _ = SUT::new(PublicKey::sample(), Signature::sample_other());
}

#[test]
fn from_signature_with_public_key() {
// Ed25519
let signature_with_public_key = SignatureWithPublicKey::sample();
let sut = SUT::from(signature_with_public_key);
assert_eq!(sut.public_key, signature_with_public_key.public_key());
assert_eq!(sut.signature, signature_with_public_key.signature());

// Secp256k1
let signature_with_public_key = SignatureWithPublicKey::sample_other();
let sut = SUT::from(signature_with_public_key);
assert_eq!(sut.public_key, signature_with_public_key.public_key());
assert_eq!(sut.signature, signature_with_public_key.signature());
}
}
2 changes: 1 addition & 1 deletion crates/app/security-center/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "security-center"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/app/signing-traits/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "signing-traits"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/build-info/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "build-info"
version = "1.1.121"
version = "1.1.122"
edition = "2021"
build = "build.rs"

Expand Down
2 changes: 1 addition & 1 deletion crates/common/bytes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bytes"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/entity-foundation/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "entity-foundation"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/host-info/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "host-info"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/identified-vec-of/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "identified-vec-of"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/metadata/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "metadata"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/network/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "network"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/numeric/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "numeric"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/common/short-string/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "short-string"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/assert-json/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "assert-json"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/collections/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "core-collections"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/error/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "error"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/has-sample-values/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "has-sample-values"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/misc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "core-misc"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/prelude/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prelude"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/time-utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "time-utils"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/utils/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "core-utils"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/addresses/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "addresses"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/cap26-models/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cap26-models"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/ecc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ecc"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/encryption/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "encryption"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/hash/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hash"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/crypto/hd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hierarchical-deterministic"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/factors/factors/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "factors"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/factors/instances-provider/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "factor-instances-provider"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/factors/keys-collector/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "keys-collector"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/factors/next-derivation-index-ephemeral/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "next-derivation-index-ephemeral"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/factors/signatures-collector/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "signatures-collector"
version = "1.1.121"
version = "1.1.122"
edition = "2021"


Expand Down
2 changes: 1 addition & 1 deletion crates/factors/supporting-types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "factors-supporting-types"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/gateway/client-and-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gateway-client-and-api"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/gateway/models/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gateway-models"
version = "1.1.121"
version = "1.1.122"
edition = "2021"


Expand Down
2 changes: 1 addition & 1 deletion crates/profile/logic/logic_SPLIT_ME/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "profile-logic"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/profile/models/account-for-display/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "account-for-display"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/profile/models/account-or-persona/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "profile-account-or-persona"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/profile/models/account/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "profile-account"
version = "1.1.121"
version = "1.1.122"
edition = "2021"

[dependencies]
Expand Down
Loading

0 comments on commit 3634378

Please sign in to comment.