@@ -259,16 +259,16 @@ private struct AppAttestManager {
259259 /// key if necessary, or returns an existing key if attestation was
260260 /// performed in the past.
261261 private func getOrGenerateAttestedKey( ) async throws ( AttestationError) -> AttestedKey {
262- if let attestedKeyIdentifier = readAttestedKeyIdentifier ( ) {
262+ if let attestedKeyId = readAttestedKeyId ( ) {
263263 logger. info ( " Using previously-attested key. " )
264- return AttestedKey ( identifier: attestedKeyIdentifier )
264+ return AttestedKey ( identifier: attestedKeyId )
265265 }
266266
267267 // Generate a new key that we'll then attempt to attest and register
268268 // with the Signal service.
269- let newKeyIdentifier : String
269+ let newKeyId : String
270270 do {
271- newKeyIdentifier = try await attestationService. generateKey ( )
271+ newKeyId = try await attestationService. generateKey ( )
272272 } catch let dcError as DCError {
273273 throw parseDCError ( dcError)
274274 } catch {
@@ -277,7 +277,7 @@ private struct AppAttestManager {
277277 }
278278
279279 logger. info ( " Attesting and registering new key. " )
280- return try await attestAndRegisterKey ( newKeyIdentifier : newKeyIdentifier )
280+ return try await attestAndRegisterKey ( newKeyId : newKeyId )
281281 }
282282
283283 /// Perform attestation on a newly-generated key, and register it with
@@ -289,7 +289,7 @@ private struct AppAttestManager {
289289 ///
290290 /// Once a key has been attested and registered, it can be used to perform
291291 /// assertions on future requests.
292- private func attestAndRegisterKey( newKeyIdentifier : String ) async throws ( AttestationError) -> AttestedKey {
292+ private func attestAndRegisterKey( newKeyId : String ) async throws ( AttestationError) -> AttestedKey {
293293 // Get a challenge from Signal servers.
294294 let keyAttestationChallenge : String = try await getKeyAttestationChallenge ( )
295295
@@ -307,7 +307,7 @@ private struct AppAttestManager {
307307 let keyAttestation : Data
308308 do {
309309 keyAttestation = try await attestationService. attestKey (
310- newKeyIdentifier ,
310+ newKeyId ,
311311 clientDataHash: keyAttestationChallengeHash
312312 )
313313 } catch let dcError as DCError {
@@ -322,15 +322,15 @@ private struct AppAttestManager {
322322 // succeeds, the Signal servers will record this key so we can use it
323323 // to generate assertions for future requests.
324324 try await attestAndRegisterKey (
325- keyId: newKeyIdentifier ,
325+ keyId: newKeyId ,
326326 keyAttestation: keyAttestation
327327 )
328328
329329 // Hurray! The key is valid, and reigstered with Signal servers. We can
330330 // now save it, so we can use it to sign future requests.
331- await saveAttestedKeyIdentifier ( newKeyIdentifier )
331+ await saveAttestedKeyId ( newKeyId )
332332
333- return AttestedKey ( identifier: newKeyIdentifier )
333+ return AttestedKey ( identifier: newKeyId )
334334 }
335335
336336 /// Get a challenge from Signal servers that we can use to attest that a new
@@ -502,22 +502,22 @@ private struct AppAttestManager {
502502 // MARK: - Persistence
503503
504504 private enum StoreKeys {
505- static let keyIdentifier = " keyIdentifier "
505+ static let keyId = " keyId "
506506 }
507507
508508 /// Returns the identifier of a key for this device that has previously
509509 /// passed attestation, if one exists.
510- private func readAttestedKeyIdentifier ( ) -> String ? {
510+ private func readAttestedKeyId ( ) -> String ? {
511511 return db. read { tx in
512- return kvStore. getString ( StoreKeys . keyIdentifier , transaction: tx)
512+ return kvStore. getString ( StoreKeys . keyId , transaction: tx)
513513 }
514514 }
515515
516- /// Save the given key identifier , which represents a key for this device
516+ /// Save the given key id , which represents a key for this device
517517 /// that has passed attestation.
518- private func saveAttestedKeyIdentifier ( _ keyIdentifier: String ) async {
518+ private func saveAttestedKeyId ( _ keyIdentifier: String ) async {
519519 await db. awaitableWrite { tx in
520- kvStore. setString ( keyIdentifier, key: StoreKeys . keyIdentifier , transaction: tx)
520+ kvStore. setString ( keyIdentifier, key: StoreKeys . keyId , transaction: tx)
521521 }
522522 }
523523}
0 commit comments