Skip to content

Commit

Permalink
add chain id and SCW check
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Sep 20, 2024
1 parent c72c33c commit 2f9cca8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Sources/XMTPiOS/SigningKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ import LibXMTP
public protocol SigningKey {
/// A wallet address for this key
var address: String { get }

/// If this signing key is a smart contract wallet
var isSmartContractWallet: Bool { get }

/// The name of the chainId for example "eip155:1"
var chainId: String { get }

/// Sign the data and return a secp256k1 compact recoverable signature.
func sign(_ data: Data) async throws -> Signature
Expand All @@ -29,6 +35,14 @@ public protocol SigningKey {
}

extension SigningKey {
public var isSmartContractWallet: Bool {
return false
}

public var chainId: String {
return "eip155:1"
}

func createIdentity(_ identity: PrivateKey, preCreateIdentityCallback: PreEventCallback? = nil) async throws -> AuthorizedIdentity {
var slimKey = PublicKey()
slimKey.timestamp = UInt64(Date().millisecondsSinceEpoch)
Expand Down

0 comments on commit 2f9cca8

Please sign in to comment.