Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit 708bd95

Browse files
author
github-actions
committed
Update Nostr Swift bindings to version 0.11.1
1 parent 6b15f08 commit 708bd95

File tree

2 files changed

+65
-27
lines changed

2 files changed

+65
-27
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let package = Package(
1414
],
1515
dependencies: [],
1616
targets: [
17-
.binaryTarget(name: "nostrFFI", url: "https://github.com/rust-nostr/nostr-swift/releases/download/0.11.0/nostrFFI.xcframework.zip", checksum: "5fe2a930cd24dea4c42c71beaab8f018d0a42cacd179633c343614dc7d2a7f93"),
17+
.binaryTarget(name: "nostrFFI", url: "https://github.com/rust-nostr/nostr-swift/releases/download/0.11.1/nostrFFI.xcframework.zip", checksum: "dea55e704cf190e4d356fc8e283dafed43bd414bbecee5a7a57893ced67fa444"),
1818
.target(name: "Nostr", dependencies: ["nostrFFI"]),
1919
]
2020
)

Sources/Nostr/Nostr.swift

Lines changed: 64 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,8 @@ open class Contact:
808808
return try! rustCall { uniffi_nostr_ffi_fn_clone_contact(self.pointer, $0) }
809809
}
810810
public convenience init(pk: PublicKey, relayUrl: String?, alias: String?) {
811-
let pointer = try! rustCall() {
811+
let pointer =
812+
try! rustCall() {
812813
uniffi_nostr_ffi_fn_constructor_contact_new(
813814
FfiConverterTypePublicKey.lower(pk),
814815
FfiConverterOptionString.lower(relayUrl),
@@ -978,7 +979,8 @@ open class Coordinate:
978979
return try! rustCall { uniffi_nostr_ffi_fn_clone_coordinate(self.pointer, $0) }
979980
}
980981
public convenience init(kind: Kind, publicKey: PublicKey) {
981-
let pointer = try! rustCall() {
982+
let pointer =
983+
try! rustCall() {
982984
uniffi_nostr_ffi_fn_constructor_coordinate_new(
983985
FfiConverterTypeKind.lower(kind),
984986
FfiConverterTypePublicKey.lower(publicKey),$0
@@ -1199,8 +1201,9 @@ open class EncryptedSecretKey:
11991201
/**
12001202
* Encrypt secret key
12011203
*/
1202-
public convenience init(secretKey: SecretKey, password: String, logN: UInt8, keySecurity: KeySecurity) {
1203-
let pointer = throws try rustCallWithError(FfiConverterTypeNostrError.lift) {
1204+
public convenience init(secretKey: SecretKey, password: String, logN: UInt8, keySecurity: KeySecurity)throws {
1205+
let pointer =
1206+
try rustCallWithError(FfiConverterTypeNostrError.lift) {
12041207
uniffi_nostr_ffi_fn_constructor_encryptedsecretkey_new(
12051208
FfiConverterTypeSecretKey.lower(secretKey),
12061209
FfiConverterString.lower(password),
@@ -1851,7 +1854,8 @@ open class EventBuilder:
18511854
return try! rustCall { uniffi_nostr_ffi_fn_clone_eventbuilder(self.pointer, $0) }
18521855
}
18531856
public convenience init(kind: Kind, content: String, tags: [Tag]) {
1854-
let pointer = try! rustCall() {
1857+
let pointer =
1858+
try! rustCall() {
18551859
uniffi_nostr_ffi_fn_constructor_eventbuilder_new(
18561860
FfiConverterTypeKind.lower(kind),
18571861
FfiConverterString.lower(content),
@@ -2590,8 +2594,9 @@ open class EventId:
25902594
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
25912595
return try! rustCall { uniffi_nostr_ffi_fn_clone_eventid(self.pointer, $0) }
25922596
}
2593-
public convenience init(publicKey: PublicKey, createdAt: Timestamp, kind: Kind, tags: [Tag], content: String) {
2594-
let pointer = throws try rustCallWithError(FfiConverterTypeNostrError.lift) {
2597+
public convenience init(publicKey: PublicKey, createdAt: Timestamp, kind: Kind, tags: [Tag], content: String)throws {
2598+
let pointer =
2599+
try rustCallWithError(FfiConverterTypeNostrError.lift) {
25952600
uniffi_nostr_ffi_fn_constructor_eventid_new(
25962601
FfiConverterTypePublicKey.lower(publicKey),
25972602
FfiConverterTypeTimestamp.lower(createdAt),
@@ -2816,8 +2821,9 @@ open class FileMetadata:
28162821
public func uniffiClonePointer() -> UnsafeMutableRawPointer {
28172822
return try! rustCall { uniffi_nostr_ffi_fn_clone_filemetadata(self.pointer, $0) }
28182823
}
2819-
public convenience init(url: String, mimeType: String, hash: String) {
2820-
let pointer = throws try rustCallWithError(FfiConverterTypeNostrError.lift) {
2824+
public convenience init(url: String, mimeType: String, hash: String)throws {
2825+
let pointer =
2826+
try rustCallWithError(FfiConverterTypeNostrError.lift) {
28212827
uniffi_nostr_ffi_fn_constructor_filemetadata_new(
28222828
FfiConverterString.lower(url),
28232829
FfiConverterString.lower(mimeType),
@@ -3096,7 +3102,8 @@ open class Filter:
30963102
return try! rustCall { uniffi_nostr_ffi_fn_clone_filter(self.pointer, $0) }
30973103
}
30983104
public convenience init() {
3099-
let pointer = try! rustCall() {
3105+
let pointer =
3106+
try! rustCall() {
31003107
uniffi_nostr_ffi_fn_constructor_filter_new($0
31013108
)
31023109
}
@@ -3554,7 +3561,8 @@ open class ImageDimensions:
35543561
return try! rustCall { uniffi_nostr_ffi_fn_clone_imagedimensions(self.pointer, $0) }
35553562
}
35563563
public convenience init(width: UInt64, height: UInt64) {
3557-
let pointer = try! rustCall() {
3564+
let pointer =
3565+
try! rustCall() {
35583566
uniffi_nostr_ffi_fn_constructor_imagedimensions_new(
35593567
FfiConverterUInt64.lower(width),
35603568
FfiConverterUInt64.lower(height),$0
@@ -3703,7 +3711,8 @@ open class Keys:
37033711
return try! rustCall { uniffi_nostr_ffi_fn_clone_keys(self.pointer, $0) }
37043712
}
37053713
public convenience init(secretKey: SecretKey) {
3706-
let pointer = try! rustCall() {
3714+
let pointer =
3715+
try! rustCall() {
37073716
uniffi_nostr_ffi_fn_constructor_keys_new(
37083717
FfiConverterTypeSecretKey.lower(secretKey),$0
37093718
)
@@ -3971,7 +3980,8 @@ open class Kind:
39713980
return try! rustCall { uniffi_nostr_ffi_fn_clone_kind(self.pointer, $0) }
39723981
}
39733982
public convenience init(kind: UInt64) {
3974-
let pointer = try! rustCall() {
3983+
let pointer =
3984+
try! rustCall() {
39753985
uniffi_nostr_ffi_fn_constructor_kind_new(
39763986
FfiConverterUInt64.lower(kind),$0
39773987
)
@@ -4198,7 +4208,8 @@ open class Metadata:
41984208
return try! rustCall { uniffi_nostr_ffi_fn_clone_metadata(self.pointer, $0) }
41994209
}
42004210
public convenience init() {
4201-
let pointer = try! rustCall() {
4211+
let pointer =
4212+
try! rustCall() {
42024213
uniffi_nostr_ffi_fn_constructor_metadata_new($0
42034214
)
42044215
}
@@ -4638,7 +4649,8 @@ open class Nip19Event:
46384649
return try! rustCall { uniffi_nostr_ffi_fn_clone_nip19event(self.pointer, $0) }
46394650
}
46404651
public convenience init(eventId: EventId, author: PublicKey?, relays: [String]) {
4641-
let pointer = try! rustCall() {
4652+
let pointer =
4653+
try! rustCall() {
46424654
uniffi_nostr_ffi_fn_constructor_nip19event_new(
46434655
FfiConverterTypeEventId.lower(eventId),
46444656
FfiConverterOptionTypePublicKey.lower(author),
@@ -4830,8 +4842,9 @@ open class Nip19Profile:
48304842
/**
48314843
* New NIP19 profile
48324844
*/
4833-
public convenience init(publicKey: PublicKey, relays: [String]) {
4834-
let pointer = throws try rustCallWithError(FfiConverterTypeNostrError.lift) {
4845+
public convenience init(publicKey: PublicKey, relays: [String])throws {
4846+
let pointer =
4847+
try rustCallWithError(FfiConverterTypeNostrError.lift) {
48354848
uniffi_nostr_ffi_fn_constructor_nip19profile_new(
48364849
FfiConverterTypePublicKey.lower(publicKey),
48374850
FfiConverterSequenceString.lower(relays),$0
@@ -5175,7 +5188,8 @@ open class NostrConnectMetadata:
51755188
* New Nostr Connect Metadata
51765189
*/
51775190
public convenience init(name: String) {
5178-
let pointer = try! rustCall() {
5191+
let pointer =
5192+
try! rustCall() {
51795193
uniffi_nostr_ffi_fn_constructor_nostrconnectmetadata_new(
51805194
FfiConverterString.lower(name),$0
51815195
)
@@ -5485,7 +5499,8 @@ open class NostrLibrary:
54855499
return try! rustCall { uniffi_nostr_ffi_fn_clone_nostrlibrary(self.pointer, $0) }
54865500
}
54875501
public convenience init() {
5488-
let pointer = try! rustCall() {
5502+
let pointer =
5503+
try! rustCall() {
54895504
uniffi_nostr_ffi_fn_constructor_nostrlibrary_new($0
54905505
)
54915506
}
@@ -5621,8 +5636,9 @@ open class NostrWalletConnectUri:
56215636
/**
56225637
* Create new Nostr Wallet Connect URI
56235638
*/
5624-
public convenience init(publicKey: PublicKey, relayUrl: String, randomSecretKey: SecretKey, lud16: String?) {
5625-
let pointer = throws try rustCallWithError(FfiConverterTypeNostrError.lift) {
5639+
public convenience init(publicKey: PublicKey, relayUrl: String, randomSecretKey: SecretKey, lud16: String?)throws {
5640+
let pointer =
5641+
try rustCallWithError(FfiConverterTypeNostrError.lift) {
56265642
uniffi_nostr_ffi_fn_constructor_nostrwalletconnecturi_new(
56275643
FfiConverterTypePublicKey.lower(publicKey),
56285644
FfiConverterString.lower(relayUrl),
@@ -6176,7 +6192,8 @@ open class RelayInformationDocument:
61766192
* Create new empty [`RelayInformationDocument`]
61776193
*/
61786194
public convenience init() {
6179-
let pointer = try! rustCall() {
6195+
let pointer =
6196+
try! rustCall() {
61806197
uniffi_nostr_ffi_fn_constructor_relayinformationdocument_new($0
61816198
)
61826199
}
@@ -6687,7 +6704,8 @@ open class Request:
66876704
return try! rustCall { uniffi_nostr_ffi_fn_clone_request(self.pointer, $0) }
66886705
}
66896706
public convenience init(method: Method, params: RequestParams) {
6690-
let pointer = try! rustCall() {
6707+
let pointer =
6708+
try! rustCall() {
66916709
uniffi_nostr_ffi_fn_constructor_request_new(
66926710
FfiConverterTypeMethod.lower(method),
66936711
FfiConverterTypeRequestParams.lower(params),$0
@@ -7159,7 +7177,8 @@ open class ShippingMethod:
71597177
* Create a new shipping method
71607178
*/
71617179
public convenience init(id: String, cost: Double) {
7162-
let pointer = try! rustCall() {
7180+
let pointer =
7181+
try! rustCall() {
71637182
uniffi_nostr_ffi_fn_constructor_shippingmethod_new(
71647183
FfiConverterString.lower(id),
71657184
FfiConverterDouble.lower(cost),$0
@@ -7462,7 +7481,8 @@ open class StallData:
74627481
return try! rustCall { uniffi_nostr_ffi_fn_clone_stalldata(self.pointer, $0) }
74637482
}
74647483
public convenience init(id: String, name: String, description: String?, currency: String, shipping: [ShippingMethod]) {
7465-
let pointer = try! rustCall() {
7484+
let pointer =
7485+
try! rustCall() {
74667486
uniffi_nostr_ffi_fn_constructor_stalldata_new(
74677487
FfiConverterString.lower(id),
74687488
FfiConverterString.lower(name),
@@ -8430,7 +8450,8 @@ open class ZapRequestData:
84308450
return try! rustCall { uniffi_nostr_ffi_fn_clone_zaprequestdata(self.pointer, $0) }
84318451
}
84328452
public convenience init(publicKey: PublicKey, relays: [String]) {
8433-
let pointer = try! rustCall() {
8453+
let pointer =
8454+
try! rustCall() {
84348455
uniffi_nostr_ffi_fn_constructor_zaprequestdata_new(
84358456
FfiConverterTypePublicKey.lower(publicKey),
84368457
FfiConverterSequenceString.lower(relays),$0
@@ -17783,6 +17804,20 @@ public func giftWrap(senderKeys: Keys, receiverPubkey: PublicKey, rumor: Unsigne
1778317804
)
1778417805
})
1778517806
}
17807+
/**
17808+
* Build Gift Wrap from Seal
17809+
*
17810+
* <https://github.com/nostr-protocol/nips/blob/master/59.md>
17811+
*/
17812+
public func giftWrapFromSeal(receiver: PublicKey, seal: Event, expiration: Timestamp?)throws -> Event {
17813+
return try FfiConverterTypeEvent.lift(try rustCallWithError(FfiConverterTypeNostrError.lift) {
17814+
uniffi_nostr_ffi_fn_func_gift_wrap_from_seal(
17815+
FfiConverterTypePublicKey.lower(receiver),
17816+
FfiConverterTypeEvent.lower(seal),
17817+
FfiConverterOptionTypeTimestamp.lower(expiration),$0
17818+
)
17819+
})
17820+
}
1778617821
public func nip04Decrypt(secretKey: SecretKey, publicKey: PublicKey, encryptedContent: String)throws -> String {
1778717822
return try FfiConverterString.lift(try rustCallWithError(FfiConverterTypeNostrError.lift) {
1778817823
uniffi_nostr_ffi_fn_func_nip04_decrypt(
@@ -17925,6 +17960,9 @@ private var initializationResult: InitializationResult {
1792517960
if (uniffi_nostr_ffi_checksum_func_gift_wrap() != 12272) {
1792617961
return InitializationResult.apiChecksumMismatch
1792717962
}
17963+
if (uniffi_nostr_ffi_checksum_func_gift_wrap_from_seal() != 39743) {
17964+
return InitializationResult.apiChecksumMismatch
17965+
}
1792817966
if (uniffi_nostr_ffi_checksum_func_nip04_decrypt() != 38491) {
1792917967
return InitializationResult.apiChecksumMismatch
1793017968
}

0 commit comments

Comments
 (0)