Skip to content

Commit e8d9b43

Browse files
authored
Version 0.0.8 (#18)
* Version 0.0.8
1 parent 0fde703 commit e8d9b43

File tree

5 files changed

+133
-85
lines changed

5 files changed

+133
-85
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ let package = Package(
4141
// For release artifacts, reference the MozillaRustComponents as a URL with checksum.
4242
// IMPORTANT: The checksum has to be on the line directly after the `url`
4343
// this is important for our release script so that all values are updated correctly
44-
url: "https://118551-129966583-gh.circle-artifacts.com/0/dist/MozillaRustComponents.xcframework.zip",
45-
checksum: "2195ff4b9f942cf8dc66461514af57be56e7c663f37e3e5d5b7f9a3adc5cf71f"
44+
url: "https://119127-129966583-gh.circle-artifacts.com/0/dist/MozillaRustComponents.xcframework.zip",
45+
checksum: "2cf6f6e5db8e995773560ad3074722b7ec3ed05a6c2d33c6f90bbffce866ed03"
4646

4747
// For local testing, you can point at an (unzipped) XCFramework that's part of the repo.
4848
// Note that you have to actually check it in and make a tag for it to work correctly.

generate.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ cp -r "$APP_SERVICES_DIR/components/fxa-client/ios/FxAClient" "$FXA_CLIENT_DIR/F
6969

7070
LOGINS_DIR="$THIS_DIR/generated/logins"
7171
rm -rf "$LOGINS_DIR" && mkdir -p "$LOGINS_DIR"
72+
# Glean metrics.
73+
# Run this first, because it appears to delete any other .swift files in the output directory.
74+
# Also, it wants to be run from inside Xcode, so we set some env vars to fake it out.
75+
SOURCE_ROOT="$THIS_DIR" PROJECT="logins" "$GLEAN_GENERATOR" -o "$LOGINS_DIR/Generated" "$APP_SERVICES_DIR/components/logins/ios/metrics.yaml"
7276
# UniFFI bindings.
7377
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$LOGINS_DIR/Generated" "$APP_SERVICES_DIR/components/logins/src/logins.udl"
7478
# Copy the hand-written Swift, since it all needs to be together in one directory.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// -*- mode: Swift -*-
2+
3+
// AUTOGENERATED BY glean_parser. DO NOT EDIT. DO NOT COMMIT.
4+
5+
/* This Source Code Form is subject to the terms of the Mozilla Public
6+
* License, v. 2.0. If a copy of the MPL was not distributed with this
7+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8+
9+
10+
11+
import Glean
12+
13+
// swiftlint:disable superfluous_disable_command
14+
// swiftlint:disable nesting
15+
// swiftlint:disable line_length
16+
// swiftlint:disable identifier_name
17+
// swiftlint:disable force_try
18+
19+
extension GleanMetrics {
20+
enum LoginsStoreMigration {
21+
/// The total number of login records processed by the migration
22+
static let numProcessed = CounterMetricType( // generated from logins_store_migration.num_processed
23+
category: "logins_store_migration",
24+
name: "num_processed",
25+
sendInPings: ["metrics"],
26+
lifetime: .ping,
27+
disabled: false
28+
)
29+
30+
/// The total number of login records successfully migrated
31+
static let numSucceeded = CounterMetricType( // generated from logins_store_migration.num_succeeded
32+
category: "logins_store_migration",
33+
name: "num_succeeded",
34+
sendInPings: ["metrics"],
35+
lifetime: .ping,
36+
disabled: false
37+
)
38+
39+
/// The total number of login records which failed to migrate
40+
static let numFailed = CounterMetricType( // generated from logins_store_migration.num_failed
41+
category: "logins_store_migration",
42+
name: "num_failed",
43+
sendInPings: ["metrics"],
44+
lifetime: .ping,
45+
disabled: false
46+
)
47+
48+
/// How long the migration tool
49+
static let totalDuration = TimespanMetricType( // generated from logins_store_migration.total_duration
50+
category: "logins_store_migration",
51+
name: "total_duration",
52+
sendInPings: ["metrics"],
53+
lifetime: .ping,
54+
disabled: false,
55+
timeUnit: .millisecond
56+
)
57+
58+
/// Errors discovered in the migration.
59+
static let errors = StringListMetricType( // generated from logins_store_migration.errors
60+
category: "logins_store_migration",
61+
name: "errors",
62+
sendInPings: ["metrics"],
63+
lifetime: .ping,
64+
disabled: false
65+
)
66+
67+
}
68+
69+
}

generated/logins/Generated/logins.swift

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ private extension RustBuffer {
1414
// Allocate a new buffer, copying the contents of a `UInt8` array.
1515
init(bytes: [UInt8]) {
1616
let rbuf = bytes.withUnsafeBufferPointer { ptr in
17-
try! rustCall { ffi_logins_5236_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) }
17+
try! rustCall { ffi_logins_42e6_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) }
1818
}
1919
self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data)
2020
}
2121

2222
// Frees the buffer in place.
2323
// The buffer must not be used after this is called.
2424
func deallocate() {
25-
try! rustCall { ffi_logins_5236_rustbuffer_free(self, $0) }
25+
try! rustCall { ffi_logins_42e6_rustbuffer_free(self, $0) }
2626
}
2727
}
2828

@@ -273,7 +273,7 @@ extension String: ViaFfi {
273273

274274
fileprivate static func lift(_ v: FfiType) throws -> Self {
275275
defer {
276-
try! rustCall { ffi_logins_5236_rustbuffer_free(v, $0) }
276+
try! rustCall { ffi_logins_42e6_rustbuffer_free(v, $0) }
277277
}
278278
if v.data == nil {
279279
return String()
@@ -289,7 +289,7 @@ extension String: ViaFfi {
289289
// The swift string gives us a trailing null byte, we don't want it.
290290
let buf = UnsafeBufferPointer(rebasing: ptr.prefix(upTo: ptr.count - 1))
291291
let bytes = ForeignBytes(bufferPointer: buf)
292-
return try! rustCall { ffi_logins_5236_rustbuffer_from_bytes(bytes, $0) }
292+
return try! rustCall { ffi_logins_42e6_rustbuffer_from_bytes(bytes, $0) }
293293
}
294294
}
295295
}
@@ -836,7 +836,7 @@ public func createKey() throws -> String {
836836
let _retval = try
837837

838838
rustCallWithError(LoginsStorageError.self) {
839-
logins_5236_create_key($0)
839+
logins_42e6_create_key($0)
840840
}
841841
return try String.lift(_retval)
842842
}
@@ -845,7 +845,7 @@ public func decryptLogin(login: EncryptedLogin, encryptionKey: String) throws ->
845845
let _retval = try
846846

847847
rustCallWithError(LoginsStorageError.self) {
848-
logins_5236_decrypt_login(login.lower(), encryptionKey.lower(), $0)
848+
logins_42e6_decrypt_login(login.lower(), encryptionKey.lower(), $0)
849849
}
850850
return try Login.lift(_retval)
851851
}
@@ -854,7 +854,7 @@ public func encryptLogin(login: Login, encryptionKey: String) throws -> Encrypte
854854
let _retval = try
855855

856856
rustCallWithError(LoginsStorageError.self) {
857-
logins_5236_encrypt_login(login.lower(), encryptionKey.lower(), $0)
857+
logins_42e6_encrypt_login(login.lower(), encryptionKey.lower(), $0)
858858
}
859859
return try EncryptedLogin.lift(_retval)
860860
}
@@ -863,7 +863,7 @@ public func decryptFields(secFields: String, encryptionKey: String) throws -> Se
863863
let _retval = try
864864

865865
rustCallWithError(LoginsStorageError.self) {
866-
logins_5236_decrypt_fields(secFields.lower(), encryptionKey.lower(), $0)
866+
logins_42e6_decrypt_fields(secFields.lower(), encryptionKey.lower(), $0)
867867
}
868868
return try SecureLoginFields.lift(_retval)
869869
}
@@ -872,7 +872,7 @@ public func encryptFields(secFields: SecureLoginFields, encryptionKey: String) t
872872
let _retval = try
873873

874874
rustCallWithError(LoginsStorageError.self) {
875-
logins_5236_encrypt_fields(secFields.lower(), encryptionKey.lower(), $0)
875+
logins_42e6_encrypt_fields(secFields.lower(), encryptionKey.lower(), $0)
876876
}
877877
return try String.lift(_retval)
878878
}
@@ -881,7 +881,7 @@ public func createCanary(text: String, encryptionKey: String) throws -> String {
881881
let _retval = try
882882

883883
rustCallWithError(LoginsStorageError.self) {
884-
logins_5236_create_canary(text.lower(), encryptionKey.lower(), $0)
884+
logins_42e6_create_canary(text.lower(), encryptionKey.lower(), $0)
885885
}
886886
return try String.lift(_retval)
887887
}
@@ -890,7 +890,7 @@ public func checkCanary(canary: String, text: String, encryptionKey: String) thr
890890
let _retval = try
891891

892892
rustCallWithError(LoginsStorageError.self) {
893-
logins_5236_check_canary(canary.lower(), text.lower(), encryptionKey.lower(), $0)
893+
logins_42e6_check_canary(canary.lower(), text.lower(), encryptionKey.lower(), $0)
894894
}
895895
return try Bool.lift(_retval)
896896
}
@@ -899,13 +899,12 @@ public func migrateLogins(path: String, newEncryptionKey: String, sqlcipherPath:
899899
let _retval = try
900900

901901
rustCallWithError(LoginsStorageError.self) {
902-
logins_5236_migrate_logins(path.lower(), newEncryptionKey.lower(), sqlcipherPath.lower(), sqlcipherKey.lower(), salt.lower(), $0)
902+
logins_42e6_migrate_logins(path.lower(), newEncryptionKey.lower(), sqlcipherPath.lower(), sqlcipherKey.lower(), salt.lower(), $0)
903903
}
904904
return try String.lift(_retval)
905905
}
906906

907907
public protocol LoginStoreProtocol {
908-
func checkValidWithNoDupes(id: String, login: LoginEntry, encryptionKey: String) throws
909908
func add(login: LoginEntry, encryptionKey: String) throws -> EncryptedLogin
910909
func update(id: String, login: LoginEntry, encryptionKey: String) throws -> EncryptedLogin
911910
func addOrUpdate(login: LoginEntry, encryptionKey: String) throws -> EncryptedLogin
@@ -917,7 +916,6 @@ public protocol LoginStoreProtocol {
917916
func list() throws -> [EncryptedLogin]
918917
func getByBaseDomain(baseDomain: String) throws -> [EncryptedLogin]
919918
func findLoginToUpdate(look: LoginEntry, encryptionKey: String) throws -> Login?
920-
func potentialDupesIgnoringUsername(id: String, login: LoginEntry) throws -> [EncryptedLogin]
921919
func get(id: String) throws -> EncryptedLogin?
922920
func importMultiple(login: [Login], encryptionKey: String) throws -> String
923921
func registerWithSyncManager()
@@ -938,140 +936,125 @@ public class LoginStore: LoginStoreProtocol {
938936
self.init(unsafeFromRawPointer: try
939937

940938
rustCallWithError(LoginsStorageError.self) {
941-
logins_5236_LoginStore_new(path.lower(), $0)
939+
logins_42e6_LoginStore_new(path.lower(), $0)
942940
})
943941
}
944942

945943
deinit {
946-
try! rustCall { ffi_logins_5236_LoginStore_object_free(pointer, $0) }
947-
}
948-
949-
public func checkValidWithNoDupes(id: String, login: LoginEntry, encryptionKey: String) throws {
950-
try
951-
rustCallWithError(LoginsStorageError.self) {
952-
logins_5236_LoginStore_check_valid_with_no_dupes(self.pointer, id.lower(), login.lower(), encryptionKey.lower(), $0)
953-
}
944+
try! rustCall { ffi_logins_42e6_LoginStore_object_free(pointer, $0) }
954945
}
955946

956947
public func add(login: LoginEntry, encryptionKey: String) throws -> EncryptedLogin {
957948
let _retval = try
958949
rustCallWithError(LoginsStorageError.self) {
959-
logins_5236_LoginStore_add(self.pointer, login.lower(), encryptionKey.lower(), $0)
950+
logins_42e6_LoginStore_add(self.pointer, login.lower(), encryptionKey.lower(), $0)
960951
}
961952
return try EncryptedLogin.lift(_retval)
962953
}
963954

964955
public func update(id: String, login: LoginEntry, encryptionKey: String) throws -> EncryptedLogin {
965956
let _retval = try
966957
rustCallWithError(LoginsStorageError.self) {
967-
logins_5236_LoginStore_update(self.pointer, id.lower(), login.lower(), encryptionKey.lower(), $0)
958+
logins_42e6_LoginStore_update(self.pointer, id.lower(), login.lower(), encryptionKey.lower(), $0)
968959
}
969960
return try EncryptedLogin.lift(_retval)
970961
}
971962

972963
public func addOrUpdate(login: LoginEntry, encryptionKey: String) throws -> EncryptedLogin {
973964
let _retval = try
974965
rustCallWithError(LoginsStorageError.self) {
975-
logins_5236_LoginStore_add_or_update(self.pointer, login.lower(), encryptionKey.lower(), $0)
966+
logins_42e6_LoginStore_add_or_update(self.pointer, login.lower(), encryptionKey.lower(), $0)
976967
}
977968
return try EncryptedLogin.lift(_retval)
978969
}
979970

980971
public func delete(id: String) throws -> Bool {
981972
let _retval = try
982973
rustCallWithError(LoginsStorageError.self) {
983-
logins_5236_LoginStore_delete(self.pointer, id.lower(), $0)
974+
logins_42e6_LoginStore_delete(self.pointer, id.lower(), $0)
984975
}
985976
return try Bool.lift(_retval)
986977
}
987978

988979
public func wipe() throws {
989980
try
990981
rustCallWithError(LoginsStorageError.self) {
991-
logins_5236_LoginStore_wipe(self.pointer, $0)
982+
logins_42e6_LoginStore_wipe(self.pointer, $0)
992983
}
993984
}
994985

995986
public func wipeLocal() throws {
996987
try
997988
rustCallWithError(LoginsStorageError.self) {
998-
logins_5236_LoginStore_wipe_local(self.pointer, $0)
989+
logins_42e6_LoginStore_wipe_local(self.pointer, $0)
999990
}
1000991
}
1001992

1002993
public func reset() throws {
1003994
try
1004995
rustCallWithError(LoginsStorageError.self) {
1005-
logins_5236_LoginStore_reset(self.pointer, $0)
996+
logins_42e6_LoginStore_reset(self.pointer, $0)
1006997
}
1007998
}
1008999

10091000
public func touch(id: String) throws {
10101001
try
10111002
rustCallWithError(LoginsStorageError.self) {
1012-
logins_5236_LoginStore_touch(self.pointer, id.lower(), $0)
1003+
logins_42e6_LoginStore_touch(self.pointer, id.lower(), $0)
10131004
}
10141005
}
10151006

10161007
public func list() throws -> [EncryptedLogin] {
10171008
let _retval = try
10181009
rustCallWithError(LoginsStorageError.self) {
1019-
logins_5236_LoginStore_list(self.pointer, $0)
1010+
logins_42e6_LoginStore_list(self.pointer, $0)
10201011
}
10211012
return try [EncryptedLogin].lift(_retval)
10221013
}
10231014

10241015
public func getByBaseDomain(baseDomain: String) throws -> [EncryptedLogin] {
10251016
let _retval = try
10261017
rustCallWithError(LoginsStorageError.self) {
1027-
logins_5236_LoginStore_get_by_base_domain(self.pointer, baseDomain.lower(), $0)
1018+
logins_42e6_LoginStore_get_by_base_domain(self.pointer, baseDomain.lower(), $0)
10281019
}
10291020
return try [EncryptedLogin].lift(_retval)
10301021
}
10311022

10321023
public func findLoginToUpdate(look: LoginEntry, encryptionKey: String) throws -> Login? {
10331024
let _retval = try
10341025
rustCallWithError(LoginsStorageError.self) {
1035-
logins_5236_LoginStore_find_login_to_update(self.pointer, look.lower(), encryptionKey.lower(), $0)
1026+
logins_42e6_LoginStore_find_login_to_update(self.pointer, look.lower(), encryptionKey.lower(), $0)
10361027
}
10371028
return try Login?.lift(_retval)
10381029
}
10391030

1040-
public func potentialDupesIgnoringUsername(id: String, login: LoginEntry) throws -> [EncryptedLogin] {
1041-
let _retval = try
1042-
rustCallWithError(LoginsStorageError.self) {
1043-
logins_5236_LoginStore_potential_dupes_ignoring_username(self.pointer, id.lower(), login.lower(), $0)
1044-
}
1045-
return try [EncryptedLogin].lift(_retval)
1046-
}
1047-
10481031
public func get(id: String) throws -> EncryptedLogin? {
10491032
let _retval = try
10501033
rustCallWithError(LoginsStorageError.self) {
1051-
logins_5236_LoginStore_get(self.pointer, id.lower(), $0)
1034+
logins_42e6_LoginStore_get(self.pointer, id.lower(), $0)
10521035
}
10531036
return try EncryptedLogin?.lift(_retval)
10541037
}
10551038

10561039
public func importMultiple(login: [Login], encryptionKey: String) throws -> String {
10571040
let _retval = try
10581041
rustCallWithError(LoginsStorageError.self) {
1059-
logins_5236_LoginStore_import_multiple(self.pointer, login.lower(), encryptionKey.lower(), $0)
1042+
logins_42e6_LoginStore_import_multiple(self.pointer, login.lower(), encryptionKey.lower(), $0)
10601043
}
10611044
return try String.lift(_retval)
10621045
}
10631046

10641047
public func registerWithSyncManager() {
10651048
try!
10661049
rustCall {
1067-
logins_5236_LoginStore_register_with_sync_manager(self.pointer, $0)
1050+
logins_42e6_LoginStore_register_with_sync_manager(self.pointer, $0)
10681051
}
10691052
}
10701053

10711054
public func sync(keyId: String, accessToken: String, syncKey: String, tokenserverUrl: String, localEncryptionKey: String) throws -> String {
10721055
let _retval = try
10731056
rustCallWithError(LoginsStorageError.self) {
1074-
logins_5236_LoginStore_sync(self.pointer, keyId.lower(), accessToken.lower(), syncKey.lower(), tokenserverUrl.lower(), localEncryptionKey.lower(), $0)
1057+
logins_42e6_LoginStore_sync(self.pointer, keyId.lower(), accessToken.lower(), syncKey.lower(), tokenserverUrl.lower(), localEncryptionKey.lower(), $0)
10751058
}
10761059
return try String.lift(_retval)
10771060
}

0 commit comments

Comments
 (0)