Skip to content

Commit 6577d97

Browse files
authored
chore: kickoff release
2 parents a7bbd61 + afcd919 commit 6577d97

File tree

38 files changed

+950
-185
lines changed

38 files changed

+950
-185
lines changed

Amplify/Categories/Storage/Operation/Request/StorageListRequest.swift

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,84 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8+
/// - Tag: StorageListRequest
89
public struct StorageListRequest: AmplifyOperationRequest {
10+
911
/// Options to adjust the behavior of this request, including plugin-options
12+
/// - Tag: StorageListRequest
1013
public let options: Options
1114

15+
/// - Tag: StorageListRequest.init
1216
public init(options: Options) {
1317
self.options = options
1418
}
1519
}
1620

1721
public extension StorageListRequest {
18-
/// Options to adjust the behavior of this request, including plugin-options
22+
23+
/// Options available to callers of
24+
/// [StorageCategoryBehavior.list](x-source-tag://StorageCategoryBehavior.list).
25+
///
26+
/// Tag: StorageListRequestOptions
1927
struct Options {
28+
2029
/// Access level of the storage system. Defaults to `public`
30+
///
31+
/// - Tag: StorageListRequestOptions.accessLevel
2132
public let accessLevel: StorageAccessLevel
2233

2334
/// Target user to apply the action on
35+
///
36+
/// - Tag: StorageListRequestOptions.targetIdentityId
2437
public let targetIdentityId: String?
2538

2639
/// Path to the keys
40+
///
41+
/// - Tag: StorageListRequestOptions.path
2742
public let path: String?
2843

44+
/// Number between 1 and 1,000 that indicates the limit of how many entries to fetch when
45+
/// retreiving file lists from the server.
46+
///
47+
/// NOTE: Plugins may decide to throw or perform normalization when encoutering vaues outside
48+
/// the specified range.
49+
///
50+
/// - SeeAlso:
51+
/// [StorageListRequestOptions.nextToken](x-source-tag://StorageListRequestOptions.nextToken)
52+
/// [StorageListResult.nextToken](x-source-tag://StorageListResult.nextToken)
53+
///
54+
/// - Tag: StorageListRequestOptions.pageSize
55+
public let pageSize: UInt
56+
57+
/// Opaque string indicating the page offset at which to resume a listing. This is usually a copy of
58+
/// the value from [StorageListResult.nextToken](x-source-tag://StorageListResult.nextToken).
59+
///
60+
/// - SeeAlso:
61+
/// [StorageListRequestOptions.pageSize](x-source-tag://StorageListRequestOptions.pageSize)
62+
/// [StorageListResult.nextToken](x-source-tag://StorageListResult.nextToken)
63+
///
64+
/// - Tag: StorageListRequestOptions.nextToken
65+
public let nextToken: String?
66+
2967
/// Extra plugin specific options, only used in special circumstances when the existing options do not provide
3068
/// a way to utilize the underlying storage system's functionality. See plugin documentation for expected
3169
/// key/values
70+
///
71+
/// - Tag: StorageListRequestOptions.pluginOptions
3272
public let pluginOptions: Any?
3373

74+
/// - Tag: StorageListRequestOptions.init
3475
public init(accessLevel: StorageAccessLevel = .guest,
3576
targetIdentityId: String? = nil,
3677
path: String? = nil,
78+
pageSize: UInt = 1000,
79+
nextToken: String? = nil,
3780
pluginOptions: Any? = nil) {
3881
self.accessLevel = accessLevel
3982
self.targetIdentityId = targetIdentityId
4083
self.path = path
84+
self.pageSize = pageSize
85+
self.nextToken = nextToken
4186
self.pluginOptions = pluginOptions
4287
}
4388
}

Amplify/Categories/Storage/Result/StorageListResult.swift

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,35 +7,71 @@
77

88
import Foundation
99

10+
/// Represents the output of a call to
11+
/// [StorageCategoryBehavior.list](x-source-tag://StorageCategoryBehavior.list)
12+
///
13+
/// - Tag: StorageListResult
1014
public struct StorageListResult {
11-
public init(items: [Item]) {
15+
16+
/// This is meant to be called by plugins implementing
17+
/// [StorageCategoryBehavior.list](x-source-tag://StorageCategoryBehavior.list).
18+
///
19+
/// - Tag: StorageListResult.init
20+
public init(items: [Item], nextToken: String? = nil) {
1221
self.items = items
22+
self.nextToken = nextToken
1323
}
1424

15-
// Array of Items in the Result
25+
/// Array of Items in the Result
26+
///
27+
/// - Tag: StorageListResult.items
1628
public var items: [Item]
29+
30+
/// Opaque string indicating the page offset at which to resume a listing. This value is usually copied to
31+
/// [StorageListRequestOptions.nextToken](x-source-tag://StorageListRequestOptions.nextToken).
32+
///
33+
/// - SeeAlso:
34+
/// [StorageListRequestOptions.nextToken](x-source-tag://StorageListRequestOptions.nextToken)
35+
///
36+
/// - Tag: StorageListResult.nextToken
37+
public let nextToken: String?
1738
}
1839

1940
extension StorageListResult {
2041

42+
/// - Tag: StorageListResultItem
2143
public struct Item {
2244

2345
/// The unique identifier of the object in storage.
46+
///
47+
/// - Tag: StorageListResultItem.key
2448
public let key: String
2549

2650
/// Size in bytes of the object
51+
///
52+
/// - Tag: StorageListResultItem.size
2753
public let size: Int?
2854

2955
/// The date the Object was Last Modified
56+
///
57+
/// - Tag: StorageListResultItem.lastModified
3058
public let lastModified: Date?
3159

3260
/// The entity tag is an MD5 hash of the object.
3361
/// ETag reflects only changes to the contents of an object, not its metadata.
62+
///
63+
/// - Tag: StorageListResultItem.eTag
3464
public let eTag: String?
3565

3666
/// Additional results specific to the plugin.
67+
///
68+
/// - Tag: StorageListResultItem.pluginResults
3769
public let pluginResults: Any?
3870

71+
/// This is meant to be called by plugins implementing
72+
/// [StorageCategoryBehavior.list](x-source-tag://StorageCategoryBehavior.list).
73+
///
74+
/// - Tag: StorageListResultItem.init
3975
public init(key: String,
4076
size: Int? = nil,
4177
eTag: String? = nil,

Amplify/Categories/Storage/StorageCategoryBehavior.swift

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77

88
import Foundation
99

10-
/// Behavior of the Storage category that clients will use
10+
/// Behavior of the Storage category used though `Amplify.Storage.*`. Plugin implementations
11+
/// conform to this protocol indirectly though the
12+
/// [StorageCategoryPlugin](x-source-tag://StorageCategoryPlugin) protocol.
13+
///
14+
/// - Tag: StorageCategoryBehavior
1115
public protocol StorageCategoryBehavior {
1216

1317
/// Retrieve the remote URL for the object from storage.
@@ -16,6 +20,8 @@ public protocol StorageCategoryBehavior {
1620
/// - key: The unique identifier for the object in storage.
1721
/// - options: Parameters to specific plugin behavior
1822
/// - Returns: requested Get URL
23+
///
24+
/// - Tag: StorageCategoryBehavior.getURL
1925
@discardableResult
2026
func getURL(key: String,
2127
options: StorageGetURLOperation.Request.Options?) async throws -> URL
@@ -26,6 +32,8 @@ public protocol StorageCategoryBehavior {
2632
/// - key: The unique identifier for the object in storage
2733
/// - options: Options to adjust the behavior of this request, including plugin-options
2834
/// - Returns: A task that provides progress updates and the key which was used to download
35+
///
36+
/// - Tag: StorageCategoryBehavior.downloadData
2937
@discardableResult
3038
func downloadData(key: String,
3139
options: StorageDownloadDataOperation.Request.Options?) -> StorageDownloadDataTask
@@ -37,6 +45,8 @@ public protocol StorageCategoryBehavior {
3745
/// - local: The local file to download destination
3846
/// - options: Parameters to specific plugin behavior
3947
/// - Returns: A task that provides progress updates and the key which was used to download
48+
///
49+
/// - Tag: StorageCategoryBehavior.downloadFile
4050
@discardableResult
4151
func downloadFile(key: String,
4252
local: URL,
@@ -49,6 +59,8 @@ public protocol StorageCategoryBehavior {
4959
/// - data: The data in memory to be uploaded
5060
/// - options: Parameters to specific plugin behavior
5161
/// - Returns: A task that provides progress updates and the key which was used to upload
62+
///
63+
/// - Tag: StorageCategoryBehavior.uploadData
5264
@discardableResult
5365
func uploadData(key: String,
5466
data: Data,
@@ -61,6 +73,8 @@ public protocol StorageCategoryBehavior {
6173
/// - local: The path to a local file.
6274
/// - options: Parameters to specific plugin behavior
6375
/// - Returns: A task that provides progress updates and the key which was used to upload
76+
///
77+
/// - Tag: StorageCategoryBehavior.uploadFile
6478
@discardableResult
6579
func uploadFile(key: String,
6680
local: URL,
@@ -72,6 +86,8 @@ public protocol StorageCategoryBehavior {
7286
/// - key: The unique identifier of the object in storage.
7387
/// - options: Parameters to specific plugin behavior
7488
/// - Returns: An operation object that provides notifications and actions related to the execution of the work
89+
///
90+
/// - Tag: StorageCategoryBehavior.remove
7591
@discardableResult
7692
func remove(key: String,
7793
options: StorageRemoveOperation.Request.Options?) async throws -> String
@@ -82,12 +98,16 @@ public protocol StorageCategoryBehavior {
8298
/// - options: Parameters to specific plugin behavior
8399
/// - resultListener: Triggered when the list is complete
84100
/// - Returns: An operation object that provides notifications and actions related to the execution of the work
101+
///
102+
/// - Tag: StorageCategoryBehavior.list
85103
@discardableResult
86104
func list(options: StorageListOperation.Request.Options?) async throws -> StorageListResult
87105

88106
/// Handles background events which are related to URLSession
89107
/// - Parameter identifier: identifier
90108
/// - Returns: returns true if the identifier is handled by Amplify
109+
///
110+
/// - Tag: StorageCategoryBehavior.handleBackgroundEvents
91111
func handleBackgroundEvents(identifier: String) async -> Bool
92112

93113
}

Amplify/Categories/Storage/StorageCategoryPlugin.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8+
/// - Tag: StorageCategoryPlugin
89
public protocol StorageCategoryPlugin: Plugin, StorageCategoryBehavior { }
910

1011
public extension StorageCategoryPlugin {

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/DeviceSRPAuth/InitiateAuthDeviceSRP.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ struct InitiateAuthDeviceSRP: Action {
3333
for: username,
3434
with: environment)
3535

36+
let asfDeviceId = try await CognitoUserPoolASF.asfDeviceID(
37+
for: username,
38+
credentialStoreClient: environment.authEnvironment().credentialsClient)
39+
3640
let srpStateData = SRPStateData(
3741
username: username,
3842
password: "",
@@ -45,6 +49,7 @@ struct InitiateAuthDeviceSRP: Action {
4549
username: username,
4650
environment: userPoolEnv,
4751
deviceMetadata: deviceMetadata,
52+
asfDeviceId: asfDeviceId,
4853
session: authResponse.session,
4954
publicHexValue: srpKeyPair.publicKeyHexValue)
5055

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/DeviceSRPAuth/VerifyDevicePasswordSRP.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ struct VerifyDevicePasswordSRP: Action {
3333
let secretBlock = try secretBlock(secretBlockString)
3434
let serverPublicB = try serverPublic(parameters)
3535

36+
let asfDeviceId = try await CognitoUserPoolASF.asfDeviceID(
37+
for: username,
38+
credentialStoreClient: environment.authEnvironment().credentialsClient)
39+
3640
let deviceMetadata = await DeviceMetadataHelper.getDeviceMetadata(
3741
for: username,
3842
with: environment)
@@ -62,6 +66,7 @@ struct VerifyDevicePasswordSRP: Action {
6266
secretBlock: secretBlockString,
6367
signature: signature,
6468
deviceMetadata: deviceMetadata,
69+
asfDeviceId: asfDeviceId,
6570
environment: userPoolEnv)
6671

6772
let responseEvent = try await UserPoolSignInHelper.sendRespondToAuth(

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/SRPAuth/VerifyPasswordSRP.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ struct VerifyPasswordSRP: Action {
4141
let secretBlock = try secretBlock(secretBlockString)
4242
let serverPublicB = try serverPublic(parameters)
4343

44+
let asfDeviceId = try await CognitoUserPoolASF.asfDeviceID(
45+
for: username,
46+
credentialStoreClient: environment.authEnvironment().credentialsClient)
47+
4448
deviceMetadata = await DeviceMetadataHelper.getDeviceMetadata(
4549
for: username,
4650
with: environment)
@@ -57,6 +61,7 @@ struct VerifyPasswordSRP: Action {
5761
secretBlock: secretBlockString,
5862
signature: signature,
5963
deviceMetadata: deviceMetadata,
64+
asfDeviceId: asfDeviceId,
6065
environment: userPoolEnv)
6166
let responseEvent = try await UserPoolSignInHelper.sendRespondToAuth(
6267
request: request,

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Actions/SignIn/VerifySignInChallenge.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ struct VerifySignInChallenge: Action {
3131
let challengeType = challenge.challenge
3232
let responseKey = try challenge.getChallengeKey()
3333

34+
let asfDeviceId = try await CognitoUserPoolASF.asfDeviceID(
35+
for: username,
36+
credentialStoreClient: environment.authEnvironment().credentialsClient)
37+
3438
deviceMetadata = await DeviceMetadataHelper.getDeviceMetadata(
3539
for: username,
3640
with: environment)
@@ -42,6 +46,7 @@ struct VerifySignInChallenge: Action {
4246
responseKey: responseKey,
4347
answer: confirmSignEventData.answer,
4448
clientMetadata: confirmSignEventData.metadata,
49+
asfDeviceId: asfDeviceId,
4550
attributes: confirmSignEventData.attributes,
4651
deviceMetadata: deviceMetadata,
4752
environment: userpoolEnv)

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/Utils/ConfirmSignUpInput+Amplify.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extension ConfirmSignUpInput {
1212
init(username: String,
1313
confirmationCode: String,
1414
clientMetadata: [String: String]?,
15-
asfDeviceId: String? = nil,
15+
asfDeviceId: String?,
1616
environment: UserPoolEnvironment
1717
) {
1818

@@ -38,6 +38,7 @@ extension ConfirmSignUpInput {
3838
clientMetadata: clientMetadata,
3939
confirmationCode: confirmationCode,
4040
secretHash: secretHash,
41-
userContextData: userContextData, username: username)
41+
userContextData: userContextData,
42+
username: username)
4243
}
4344
}

AmplifyPlugins/Auth/Sources/AWSCognitoAuthPlugin/Support/Utils/InitiateAuthInput+Amplify.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ extension InitiateAuthInput {
100100
authFlowType: CognitoIdentityProviderClientTypes.AuthFlowType,
101101
authParameters: [String: String],
102102
clientMetadata: [String: String],
103-
asfDeviceId: String? = nil,
103+
asfDeviceId: String?,
104104
deviceMetadata: DeviceMetadata,
105105
environment: UserPoolEnvironment) -> InitiateAuthInput {
106106

0 commit comments

Comments
 (0)