appwrite 28.2.0 → 28.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +1 -1
- data/lib/appwrite/enums/project_auth_method_id.rb +1 -0
- data/lib/appwrite/enums/project_policy_id.rb +1 -0
- data/lib/appwrite/models/passkey.rb +47 -0
- data/lib/appwrite/models/passkey_challenge.rb +47 -0
- data/lib/appwrite/models/passkey_list.rb +32 -0
- data/lib/appwrite/models/policy_passkey.rb +37 -0
- data/lib/appwrite/models/project_auth_method.rb +1 -0
- data/lib/appwrite/models/token_secret.rb +52 -0
- data/lib/appwrite/services/account.rb +298 -0
- data/lib/appwrite/services/project.rb +44 -1
- data/lib/appwrite/services/users.rb +162 -0
- data/lib/appwrite.rb +5 -0
- metadata +7 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d33f32c4b7b5557724d97e3eab7874520e653dd702c1b41e16ef0049ad336f58
|
|
4
|
+
data.tar.gz: 5137c83b95f254bf39775c0e43240e46f80eef5faf44ee3707747d3dd2ee8699
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ae10b86bf1314cf6c35501bee2fe9fcd59ccf34d8a0eddd328ab279768d0edf25bbc0e194127f89f4adf65b851761e45d3c839a7abbc34fc18ee77a15cce77f
|
|
7
|
+
data.tar.gz: b4694dedb552937c1b1c48d98b7e7bd8bae0f9531990ee6684f7fea8a15ec6cb5c8745bb6570f2cc7daec3f6ce4c814e8f7d1af8aa10dc53e911cbfff4de28c6
|
data/lib/appwrite/client.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Appwrite
|
|
|
14
14
|
'x-sdk-name' => 'Ruby',
|
|
15
15
|
'x-sdk-platform' => 'server',
|
|
16
16
|
'x-sdk-language' => 'ruby',
|
|
17
|
-
'x-sdk-version' => '28.
|
|
17
|
+
'x-sdk-version' => '28.3.1',
|
|
18
18
|
'X-Appwrite-Response-Format' => '2.0.0'
|
|
19
19
|
}
|
|
20
20
|
@endpoint = 'https://cloud.appwrite.io/v1'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class Passkey
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :created_at
|
|
8
|
+
attr_reader :updated_at
|
|
9
|
+
attr_reader :name
|
|
10
|
+
attr_reader :accessed_at
|
|
11
|
+
|
|
12
|
+
def initialize(
|
|
13
|
+
id:,
|
|
14
|
+
created_at:,
|
|
15
|
+
updated_at:,
|
|
16
|
+
name:,
|
|
17
|
+
accessed_at:
|
|
18
|
+
)
|
|
19
|
+
@id = id
|
|
20
|
+
@created_at = created_at
|
|
21
|
+
@updated_at = updated_at
|
|
22
|
+
@name = name
|
|
23
|
+
@accessed_at = accessed_at
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.from(map:)
|
|
27
|
+
Passkey.new(
|
|
28
|
+
id: map["$id"],
|
|
29
|
+
created_at: map["$createdAt"],
|
|
30
|
+
updated_at: map["$updatedAt"],
|
|
31
|
+
name: map["name"],
|
|
32
|
+
accessed_at: map["accessedAt"]
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def to_map
|
|
37
|
+
{
|
|
38
|
+
"$id": @id,
|
|
39
|
+
"$createdAt": @created_at,
|
|
40
|
+
"$updatedAt": @updated_at,
|
|
41
|
+
"name": @name,
|
|
42
|
+
"accessedAt": @accessed_at
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class PasskeyChallenge
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :created_at
|
|
8
|
+
attr_reader :passkey_id
|
|
9
|
+
attr_reader :expire
|
|
10
|
+
attr_reader :public_key
|
|
11
|
+
|
|
12
|
+
def initialize(
|
|
13
|
+
id:,
|
|
14
|
+
created_at:,
|
|
15
|
+
passkey_id:,
|
|
16
|
+
expire:,
|
|
17
|
+
public_key:
|
|
18
|
+
)
|
|
19
|
+
@id = id
|
|
20
|
+
@created_at = created_at
|
|
21
|
+
@passkey_id = passkey_id
|
|
22
|
+
@expire = expire
|
|
23
|
+
@public_key = public_key
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.from(map:)
|
|
27
|
+
PasskeyChallenge.new(
|
|
28
|
+
id: map["$id"],
|
|
29
|
+
created_at: map["$createdAt"],
|
|
30
|
+
passkey_id: map["passkeyId"],
|
|
31
|
+
expire: map["expire"],
|
|
32
|
+
public_key: map["publicKey"]
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def to_map
|
|
37
|
+
{
|
|
38
|
+
"$id": @id,
|
|
39
|
+
"$createdAt": @created_at,
|
|
40
|
+
"passkeyId": @passkey_id,
|
|
41
|
+
"expire": @expire,
|
|
42
|
+
"publicKey": @public_key
|
|
43
|
+
}
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class PasskeyList
|
|
6
|
+
attr_reader :total
|
|
7
|
+
attr_reader :passkeys
|
|
8
|
+
|
|
9
|
+
def initialize(
|
|
10
|
+
total:,
|
|
11
|
+
passkeys:
|
|
12
|
+
)
|
|
13
|
+
@total = total
|
|
14
|
+
@passkeys = passkeys
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.from(map:)
|
|
18
|
+
PasskeyList.new(
|
|
19
|
+
total: map["total"],
|
|
20
|
+
passkeys: map["passkeys"].map { |it| Passkey.from(map: it) }
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def to_map
|
|
25
|
+
{
|
|
26
|
+
"total": @total,
|
|
27
|
+
"passkeys": @passkeys.map { |it| it.to_map }
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class PolicyPasskey
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :rp_id
|
|
8
|
+
attr_reader :origins
|
|
9
|
+
|
|
10
|
+
def initialize(
|
|
11
|
+
id:,
|
|
12
|
+
rp_id:,
|
|
13
|
+
origins:
|
|
14
|
+
)
|
|
15
|
+
@id = id
|
|
16
|
+
@rp_id = rp_id
|
|
17
|
+
@origins = origins
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.from(map:)
|
|
21
|
+
PolicyPasskey.new(
|
|
22
|
+
id: map["$id"],
|
|
23
|
+
rp_id: map["rpId"],
|
|
24
|
+
origins: map["origins"]
|
|
25
|
+
)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def to_map
|
|
29
|
+
{
|
|
30
|
+
"$id": @id,
|
|
31
|
+
"rpId": @rp_id,
|
|
32
|
+
"origins": @origins
|
|
33
|
+
}
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class TokenSecret
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :created_at
|
|
8
|
+
attr_reader :user_id
|
|
9
|
+
attr_reader :secret
|
|
10
|
+
attr_reader :expire
|
|
11
|
+
attr_reader :phrase
|
|
12
|
+
|
|
13
|
+
def initialize(
|
|
14
|
+
id:,
|
|
15
|
+
created_at:,
|
|
16
|
+
user_id:,
|
|
17
|
+
secret:,
|
|
18
|
+
expire:,
|
|
19
|
+
phrase:
|
|
20
|
+
)
|
|
21
|
+
@id = id
|
|
22
|
+
@created_at = created_at
|
|
23
|
+
@user_id = user_id
|
|
24
|
+
@secret = secret
|
|
25
|
+
@expire = expire
|
|
26
|
+
@phrase = phrase
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.from(map:)
|
|
30
|
+
TokenSecret.new(
|
|
31
|
+
id: map["$id"],
|
|
32
|
+
created_at: map["$createdAt"],
|
|
33
|
+
user_id: map["userId"],
|
|
34
|
+
secret: map["secret"],
|
|
35
|
+
expire: map["expire"],
|
|
36
|
+
phrase: map["phrase"]
|
|
37
|
+
)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def to_map
|
|
41
|
+
{
|
|
42
|
+
"$id": @id,
|
|
43
|
+
"$createdAt": @created_at,
|
|
44
|
+
"userId": @user_id,
|
|
45
|
+
"secret": @secret,
|
|
46
|
+
"expire": @expire,
|
|
47
|
+
"phrase": @phrase
|
|
48
|
+
}
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -797,6 +797,226 @@ module Appwrite
|
|
|
797
797
|
)
|
|
798
798
|
end
|
|
799
799
|
|
|
800
|
+
# Get the list of verified passkeys registered by the currently logged in
|
|
801
|
+
# user.
|
|
802
|
+
#
|
|
803
|
+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter and order on the following attributes: $id, $createdAt, $updatedAt, name, accessedAt
|
|
804
|
+
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
|
|
805
|
+
#
|
|
806
|
+
# @return [PasskeyList]
|
|
807
|
+
def list_passkeys(
|
|
808
|
+
queries: nil,
|
|
809
|
+
total: nil
|
|
810
|
+
)
|
|
811
|
+
api_path = '/account/passkeys'
|
|
812
|
+
|
|
813
|
+
api_params = {
|
|
814
|
+
queries: queries,
|
|
815
|
+
total: total,
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
api_headers = {
|
|
819
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
820
|
+
"accept": 'application/json',
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
@client.call(
|
|
824
|
+
method: 'GET',
|
|
825
|
+
path: api_path,
|
|
826
|
+
headers: api_headers,
|
|
827
|
+
params: api_params,
|
|
828
|
+
response_type: Models::PasskeyList
|
|
829
|
+
)
|
|
830
|
+
end
|
|
831
|
+
|
|
832
|
+
# Start registering a passkey for the currently logged in user. The session
|
|
833
|
+
# must have signed in or completed an MFA challenge within the last 10
|
|
834
|
+
# minutes. Pass the returned `publicKey` options to
|
|
835
|
+
# `navigator.credentials.create()`, then complete the registration with
|
|
836
|
+
# [Update passkey
|
|
837
|
+
# verification](/docs/references/cloud/client-web/account#updatePasskeyVerification).
|
|
838
|
+
# The passkey stays pending until verified, and the challenge expires after 5
|
|
839
|
+
# minutes.
|
|
840
|
+
#
|
|
841
|
+
# @param [String] passkey_id Passkey ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
|
|
842
|
+
# @param [String] name Passkey name, shown when listing passkeys. Max length: 128 chars.
|
|
843
|
+
#
|
|
844
|
+
# @return [PasskeyChallenge]
|
|
845
|
+
def create_passkey(
|
|
846
|
+
passkey_id: nil,
|
|
847
|
+
name: nil
|
|
848
|
+
)
|
|
849
|
+
api_path = '/account/passkeys'
|
|
850
|
+
|
|
851
|
+
api_params = {
|
|
852
|
+
passkeyId: passkey_id,
|
|
853
|
+
name: name,
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
api_headers = {
|
|
857
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
858
|
+
"content-type": 'application/json',
|
|
859
|
+
"accept": 'application/json',
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
@client.call(
|
|
863
|
+
method: 'POST',
|
|
864
|
+
path: api_path,
|
|
865
|
+
headers: api_headers,
|
|
866
|
+
params: api_params,
|
|
867
|
+
response_type: Models::PasskeyChallenge
|
|
868
|
+
)
|
|
869
|
+
end
|
|
870
|
+
|
|
871
|
+
# Get a verified passkey of the currently logged in user by its unique ID.
|
|
872
|
+
#
|
|
873
|
+
# @param [String] passkey_id Passkey ID.
|
|
874
|
+
#
|
|
875
|
+
# @return [Passkey]
|
|
876
|
+
def get_passkey(
|
|
877
|
+
passkey_id:
|
|
878
|
+
)
|
|
879
|
+
if passkey_id.nil? || passkey_id == ''
|
|
880
|
+
raise Appwrite::Exception.new('Missing required parameter: "passkeyId"')
|
|
881
|
+
end
|
|
882
|
+
|
|
883
|
+
api_path = '/account/passkeys/{passkeyId}'
|
|
884
|
+
.gsub('{passkeyId}', passkey_id)
|
|
885
|
+
|
|
886
|
+
api_params = {}
|
|
887
|
+
|
|
888
|
+
api_headers = {
|
|
889
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
890
|
+
"accept": 'application/json',
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
@client.call(
|
|
894
|
+
method: 'GET',
|
|
895
|
+
path: api_path,
|
|
896
|
+
headers: api_headers,
|
|
897
|
+
params: api_params,
|
|
898
|
+
response_type: Models::Passkey
|
|
899
|
+
)
|
|
900
|
+
end
|
|
901
|
+
|
|
902
|
+
# Rename a passkey of the currently logged in user.
|
|
903
|
+
#
|
|
904
|
+
# @param [String] passkey_id Passkey ID.
|
|
905
|
+
# @param [String] name Passkey name. Max length: 128 chars.
|
|
906
|
+
#
|
|
907
|
+
# @return [Passkey]
|
|
908
|
+
def update_passkey(
|
|
909
|
+
passkey_id:,
|
|
910
|
+
name:
|
|
911
|
+
)
|
|
912
|
+
if passkey_id.nil? || passkey_id == ''
|
|
913
|
+
raise Appwrite::Exception.new('Missing required parameter: "passkeyId"')
|
|
914
|
+
end
|
|
915
|
+
|
|
916
|
+
if name.nil?
|
|
917
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
|
918
|
+
end
|
|
919
|
+
|
|
920
|
+
api_path = '/account/passkeys/{passkeyId}'
|
|
921
|
+
.gsub('{passkeyId}', passkey_id)
|
|
922
|
+
|
|
923
|
+
api_params = {
|
|
924
|
+
name: name,
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
api_headers = {
|
|
928
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
929
|
+
"content-type": 'application/json',
|
|
930
|
+
"accept": 'application/json',
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
@client.call(
|
|
934
|
+
method: 'PATCH',
|
|
935
|
+
path: api_path,
|
|
936
|
+
headers: api_headers,
|
|
937
|
+
params: api_params,
|
|
938
|
+
response_type: Models::Passkey
|
|
939
|
+
)
|
|
940
|
+
end
|
|
941
|
+
|
|
942
|
+
# Delete a passkey from the currently logged in user. The passkey can no
|
|
943
|
+
# longer be used to sign in, although it may remain stored on the user's
|
|
944
|
+
# device. The session must have signed in or completed an MFA challenge
|
|
945
|
+
# within the last 10 minutes.
|
|
946
|
+
#
|
|
947
|
+
# @param [String] passkey_id Passkey ID.
|
|
948
|
+
#
|
|
949
|
+
# @return []
|
|
950
|
+
def delete_passkey(
|
|
951
|
+
passkey_id:
|
|
952
|
+
)
|
|
953
|
+
if passkey_id.nil? || passkey_id == ''
|
|
954
|
+
raise Appwrite::Exception.new('Missing required parameter: "passkeyId"')
|
|
955
|
+
end
|
|
956
|
+
|
|
957
|
+
api_path = '/account/passkeys/{passkeyId}'
|
|
958
|
+
.gsub('{passkeyId}', passkey_id)
|
|
959
|
+
|
|
960
|
+
api_params = {}
|
|
961
|
+
|
|
962
|
+
api_headers = {
|
|
963
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
964
|
+
"content-type": 'application/json',
|
|
965
|
+
"accept": 'application/json',
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
@client.call(
|
|
969
|
+
method: 'DELETE',
|
|
970
|
+
path: api_path,
|
|
971
|
+
headers: api_headers,
|
|
972
|
+
params: api_params,
|
|
973
|
+
)
|
|
974
|
+
end
|
|
975
|
+
|
|
976
|
+
# Complete a passkey registration started with [Create
|
|
977
|
+
# passkey](/docs/references/cloud/client-web/account#createPasskey). Pass the
|
|
978
|
+
# JSON form of the credential returned by `navigator.credentials.create()`,
|
|
979
|
+
# for example `credential.toJSON()`. Each registration can be verified once;
|
|
980
|
+
# a failed attempt requires starting it again.
|
|
981
|
+
#
|
|
982
|
+
# @param [String] passkey_id Passkey ID.
|
|
983
|
+
# @param [Hash] credential Registration credential returned by the authenticator, in the JSON form produced by `PublicKeyCredential.toJSON()`.
|
|
984
|
+
#
|
|
985
|
+
# @return [Passkey]
|
|
986
|
+
def update_passkey_verification(
|
|
987
|
+
passkey_id:,
|
|
988
|
+
credential:
|
|
989
|
+
)
|
|
990
|
+
if passkey_id.nil? || passkey_id == ''
|
|
991
|
+
raise Appwrite::Exception.new('Missing required parameter: "passkeyId"')
|
|
992
|
+
end
|
|
993
|
+
|
|
994
|
+
if credential.nil?
|
|
995
|
+
raise Appwrite::Exception.new('Missing required parameter: "credential"')
|
|
996
|
+
end
|
|
997
|
+
|
|
998
|
+
api_path = '/account/passkeys/{passkeyId}/verification'
|
|
999
|
+
.gsub('{passkeyId}', passkey_id)
|
|
1000
|
+
|
|
1001
|
+
api_params = {
|
|
1002
|
+
credential: credential,
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
api_headers = {
|
|
1006
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
1007
|
+
"content-type": 'application/json',
|
|
1008
|
+
"accept": 'application/json',
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
@client.call(
|
|
1012
|
+
method: 'PUT',
|
|
1013
|
+
path: api_path,
|
|
1014
|
+
headers: api_headers,
|
|
1015
|
+
params: api_params,
|
|
1016
|
+
response_type: Models::Passkey
|
|
1017
|
+
)
|
|
1018
|
+
end
|
|
1019
|
+
|
|
800
1020
|
# Update currently logged in user password. For validation, user is required
|
|
801
1021
|
# to pass in the new password, and the old password. For users created with
|
|
802
1022
|
# OAuth, Team Invites and Magic URL, oldPassword is optional.
|
|
@@ -1592,6 +1812,84 @@ module Appwrite
|
|
|
1592
1812
|
)
|
|
1593
1813
|
end
|
|
1594
1814
|
|
|
1815
|
+
# Start signing in with a passkey. No email or user ID is needed: pass the
|
|
1816
|
+
# returned `publicKey` options to `navigator.credentials.get()` and the user
|
|
1817
|
+
# picks one of their passkeys. Then call [Update passkey
|
|
1818
|
+
# token](/docs/references/cloud/client-web/account#updatePasskeyToken) with
|
|
1819
|
+
# the credential to receive a token, and exchange it with [Create
|
|
1820
|
+
# session](/docs/references/cloud/client-web/account#createSession). The
|
|
1821
|
+
# challenge expires after 5 minutes.
|
|
1822
|
+
#
|
|
1823
|
+
#
|
|
1824
|
+
# @return [PasskeyChallenge]
|
|
1825
|
+
def create_passkey_token()
|
|
1826
|
+
api_path = '/account/tokens/passkey'
|
|
1827
|
+
|
|
1828
|
+
api_params = {}
|
|
1829
|
+
|
|
1830
|
+
api_headers = {
|
|
1831
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
1832
|
+
"content-type": 'application/json',
|
|
1833
|
+
"accept": 'application/json',
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
@client.call(
|
|
1837
|
+
method: 'POST',
|
|
1838
|
+
path: api_path,
|
|
1839
|
+
headers: api_headers,
|
|
1840
|
+
params: api_params,
|
|
1841
|
+
response_type: Models::PasskeyChallenge
|
|
1842
|
+
)
|
|
1843
|
+
end
|
|
1844
|
+
|
|
1845
|
+
# Complete a passkey sign-in started with [Create passkey
|
|
1846
|
+
# token](/docs/references/cloud/client-web/account#createPasskeyToken). Pass
|
|
1847
|
+
# the challenge ID and the JSON form of the credential returned by
|
|
1848
|
+
# `navigator.credentials.get()`, for example `credential.toJSON()`. The
|
|
1849
|
+
# returned token includes its secret and expires after 1 minute: exchange it
|
|
1850
|
+
# for a session with [Create
|
|
1851
|
+
# session](/docs/references/cloud/client-web/account#createSession). Passkeys
|
|
1852
|
+
# require user verification, so the session also satisfies MFA. Each
|
|
1853
|
+
# challenge can only be used once.
|
|
1854
|
+
#
|
|
1855
|
+
# @param [String] challenge_id Challenge ID returned by createPasskeyToken.
|
|
1856
|
+
# @param [Hash] credential Authentication credential returned by the authenticator, in the JSON form produced by `PublicKeyCredential.toJSON()`.
|
|
1857
|
+
#
|
|
1858
|
+
# @return [TokenSecret]
|
|
1859
|
+
def update_passkey_token(
|
|
1860
|
+
challenge_id:,
|
|
1861
|
+
credential:
|
|
1862
|
+
)
|
|
1863
|
+
if challenge_id.nil?
|
|
1864
|
+
raise Appwrite::Exception.new('Missing required parameter: "challengeId"')
|
|
1865
|
+
end
|
|
1866
|
+
|
|
1867
|
+
if credential.nil?
|
|
1868
|
+
raise Appwrite::Exception.new('Missing required parameter: "credential"')
|
|
1869
|
+
end
|
|
1870
|
+
|
|
1871
|
+
api_path = '/account/tokens/passkey'
|
|
1872
|
+
|
|
1873
|
+
api_params = {
|
|
1874
|
+
challengeId: challenge_id,
|
|
1875
|
+
credential: credential,
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
api_headers = {
|
|
1879
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
1880
|
+
"content-type": 'application/json',
|
|
1881
|
+
"accept": 'application/json',
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
@client.call(
|
|
1885
|
+
method: 'PUT',
|
|
1886
|
+
path: api_path,
|
|
1887
|
+
headers: api_headers,
|
|
1888
|
+
params: api_params,
|
|
1889
|
+
response_type: Models::TokenSecret
|
|
1890
|
+
)
|
|
1891
|
+
end
|
|
1892
|
+
|
|
1595
1893
|
# Sends the user an SMS with a secret key for creating a session. If the
|
|
1596
1894
|
# provided user ID has not be registered, a new user will be created. Use the
|
|
1597
1895
|
# returned user ID and secret and submit a request to the [POST
|
|
@@ -3386,6 +3386,44 @@ module Appwrite
|
|
|
3386
3386
|
)
|
|
3387
3387
|
end
|
|
3388
3388
|
|
|
3389
|
+
# Set the relying party ID passkeys are bound to: the domain of your
|
|
3390
|
+
# application. Passkeys work on the project's web platforms on that domain or
|
|
3391
|
+
# its subdomains, and on the domain itself for Apple apps. A localhost web
|
|
3392
|
+
# platform enables passkeys for local development without a relying party ID.
|
|
3393
|
+
# The relying party ID cannot change while users have passkeys, and any
|
|
3394
|
+
# change invalidates ceremonies in progress.
|
|
3395
|
+
#
|
|
3396
|
+
# @param [String] rp_id Relying party ID: the domain of your application, such as `example.com`. Use `localhost` for local development, or an empty string to unset it.
|
|
3397
|
+
#
|
|
3398
|
+
# @return [Project]
|
|
3399
|
+
def update_passkey_policy(
|
|
3400
|
+
rp_id:
|
|
3401
|
+
)
|
|
3402
|
+
if rp_id.nil?
|
|
3403
|
+
raise Appwrite::Exception.new('Missing required parameter: "rpId"')
|
|
3404
|
+
end
|
|
3405
|
+
|
|
3406
|
+
api_path = '/project/policies/passkey'
|
|
3407
|
+
|
|
3408
|
+
api_params = {
|
|
3409
|
+
rpId: rp_id,
|
|
3410
|
+
}
|
|
3411
|
+
|
|
3412
|
+
api_headers = {
|
|
3413
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
3414
|
+
"content-type": 'application/json',
|
|
3415
|
+
"accept": 'application/json',
|
|
3416
|
+
}
|
|
3417
|
+
|
|
3418
|
+
@client.call(
|
|
3419
|
+
method: 'PATCH',
|
|
3420
|
+
path: api_path,
|
|
3421
|
+
headers: api_headers,
|
|
3422
|
+
params: api_params,
|
|
3423
|
+
response_type: Models::Project
|
|
3424
|
+
)
|
|
3425
|
+
end
|
|
3426
|
+
|
|
3389
3427
|
# Updating this policy allows you to control if new passwords are checked
|
|
3390
3428
|
# against most common passwords dictionary. When enabled, and user changes
|
|
3391
3429
|
# their password, password must not be contained in the dictionary.
|
|
@@ -3719,7 +3757,7 @@ module Appwrite
|
|
|
3719
3757
|
#
|
|
3720
3758
|
# @param [ProjectPolicyId] policy_id Policy ID. Can be one of: password-dictionary, password-history, password-strength, password-personal-data, session-alert, session-duration, session-invalidation, session-limit, user-limit, membership-privacy, mfa-factors, deny-aliased-email, deny-disposable-email, deny-free-email, deny-corporate-email.
|
|
3721
3759
|
#
|
|
3722
|
-
# @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyMfaFactors, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail, PolicyDenyCorporateEmail]
|
|
3760
|
+
# @return [PolicyPasswordDictionary, PolicyPasswordHistory, PolicyPasswordStrength, PolicyPasswordPersonalData, PolicySessionAlert, PolicySessionDuration, PolicySessionInvalidation, PolicySessionLimit, PolicyUserLimit, PolicyMembershipPrivacy, PolicyMfaFactors, PolicyDenyAliasedEmail, PolicyDenyDisposableEmail, PolicyDenyFreeEmail, PolicyDenyCorporateEmail, PolicyPasskey]
|
|
3723
3761
|
def get_policy(
|
|
3724
3762
|
policy_id:
|
|
3725
3763
|
)
|
|
@@ -3823,6 +3861,11 @@ module Appwrite
|
|
|
3823
3861
|
return Models::PolicyDenyCorporateEmail.from(map: response)
|
|
3824
3862
|
end
|
|
3825
3863
|
|
|
3864
|
+
if response['$id'] == 'passkey'
|
|
3865
|
+
|
|
3866
|
+
return Models::PolicyPasskey.from(map: response)
|
|
3867
|
+
end
|
|
3868
|
+
|
|
3826
3869
|
raise Exception, "Unable to match response to any expected response model"
|
|
3827
3870
|
end
|
|
3828
3871
|
|
|
@@ -1188,6 +1188,168 @@ module Appwrite
|
|
|
1188
1188
|
)
|
|
1189
1189
|
end
|
|
1190
1190
|
|
|
1191
|
+
# Get the list of verified passkeys registered by a user.
|
|
1192
|
+
#
|
|
1193
|
+
# @param [String] user_id User ID.
|
|
1194
|
+
# @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter and order on the following attributes: $id, $createdAt, $updatedAt, name, accessedAt
|
|
1195
|
+
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
|
|
1196
|
+
#
|
|
1197
|
+
# @return [PasskeyList]
|
|
1198
|
+
def list_passkeys(
|
|
1199
|
+
user_id:,
|
|
1200
|
+
queries: nil,
|
|
1201
|
+
total: nil
|
|
1202
|
+
)
|
|
1203
|
+
if user_id.nil? || user_id == ''
|
|
1204
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
|
1205
|
+
end
|
|
1206
|
+
|
|
1207
|
+
api_path = '/users/{userId}/passkeys'
|
|
1208
|
+
.gsub('{userId}', user_id)
|
|
1209
|
+
|
|
1210
|
+
api_params = {
|
|
1211
|
+
queries: queries,
|
|
1212
|
+
total: total,
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
api_headers = {
|
|
1216
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
1217
|
+
"accept": 'application/json',
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
@client.call(
|
|
1221
|
+
method: 'GET',
|
|
1222
|
+
path: api_path,
|
|
1223
|
+
headers: api_headers,
|
|
1224
|
+
params: api_params,
|
|
1225
|
+
response_type: Models::PasskeyList
|
|
1226
|
+
)
|
|
1227
|
+
end
|
|
1228
|
+
|
|
1229
|
+
# Get a verified passkey of a user by its unique ID.
|
|
1230
|
+
#
|
|
1231
|
+
# @param [String] user_id User ID.
|
|
1232
|
+
# @param [String] passkey_id Passkey ID.
|
|
1233
|
+
#
|
|
1234
|
+
# @return [Passkey]
|
|
1235
|
+
def get_passkey(
|
|
1236
|
+
user_id:,
|
|
1237
|
+
passkey_id:
|
|
1238
|
+
)
|
|
1239
|
+
if user_id.nil? || user_id == ''
|
|
1240
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
|
1241
|
+
end
|
|
1242
|
+
|
|
1243
|
+
if passkey_id.nil? || passkey_id == ''
|
|
1244
|
+
raise Appwrite::Exception.new('Missing required parameter: "passkeyId"')
|
|
1245
|
+
end
|
|
1246
|
+
|
|
1247
|
+
api_path = '/users/{userId}/passkeys/{passkeyId}'
|
|
1248
|
+
.gsub('{userId}', user_id)
|
|
1249
|
+
.gsub('{passkeyId}', passkey_id)
|
|
1250
|
+
|
|
1251
|
+
api_params = {}
|
|
1252
|
+
|
|
1253
|
+
api_headers = {
|
|
1254
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
1255
|
+
"accept": 'application/json',
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
@client.call(
|
|
1259
|
+
method: 'GET',
|
|
1260
|
+
path: api_path,
|
|
1261
|
+
headers: api_headers,
|
|
1262
|
+
params: api_params,
|
|
1263
|
+
response_type: Models::Passkey
|
|
1264
|
+
)
|
|
1265
|
+
end
|
|
1266
|
+
|
|
1267
|
+
# Rename a passkey of a user.
|
|
1268
|
+
#
|
|
1269
|
+
# @param [String] user_id User ID.
|
|
1270
|
+
# @param [String] passkey_id Passkey ID.
|
|
1271
|
+
# @param [String] name Passkey name. Max length: 128 chars.
|
|
1272
|
+
#
|
|
1273
|
+
# @return [Passkey]
|
|
1274
|
+
def update_passkey(
|
|
1275
|
+
user_id:,
|
|
1276
|
+
passkey_id:,
|
|
1277
|
+
name:
|
|
1278
|
+
)
|
|
1279
|
+
if user_id.nil? || user_id == ''
|
|
1280
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
|
1281
|
+
end
|
|
1282
|
+
|
|
1283
|
+
if passkey_id.nil? || passkey_id == ''
|
|
1284
|
+
raise Appwrite::Exception.new('Missing required parameter: "passkeyId"')
|
|
1285
|
+
end
|
|
1286
|
+
|
|
1287
|
+
if name.nil?
|
|
1288
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
|
1289
|
+
end
|
|
1290
|
+
|
|
1291
|
+
api_path = '/users/{userId}/passkeys/{passkeyId}'
|
|
1292
|
+
.gsub('{userId}', user_id)
|
|
1293
|
+
.gsub('{passkeyId}', passkey_id)
|
|
1294
|
+
|
|
1295
|
+
api_params = {
|
|
1296
|
+
name: name,
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
api_headers = {
|
|
1300
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
1301
|
+
"content-type": 'application/json',
|
|
1302
|
+
"accept": 'application/json',
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
@client.call(
|
|
1306
|
+
method: 'PATCH',
|
|
1307
|
+
path: api_path,
|
|
1308
|
+
headers: api_headers,
|
|
1309
|
+
params: api_params,
|
|
1310
|
+
response_type: Models::Passkey
|
|
1311
|
+
)
|
|
1312
|
+
end
|
|
1313
|
+
|
|
1314
|
+
# Delete a passkey from a user, for example when a device is lost. The
|
|
1315
|
+
# passkey can no longer be used to sign in.
|
|
1316
|
+
#
|
|
1317
|
+
# @param [String] user_id User ID.
|
|
1318
|
+
# @param [String] passkey_id Passkey ID.
|
|
1319
|
+
#
|
|
1320
|
+
# @return []
|
|
1321
|
+
def delete_passkey(
|
|
1322
|
+
user_id:,
|
|
1323
|
+
passkey_id:
|
|
1324
|
+
)
|
|
1325
|
+
if user_id.nil? || user_id == ''
|
|
1326
|
+
raise Appwrite::Exception.new('Missing required parameter: "userId"')
|
|
1327
|
+
end
|
|
1328
|
+
|
|
1329
|
+
if passkey_id.nil? || passkey_id == ''
|
|
1330
|
+
raise Appwrite::Exception.new('Missing required parameter: "passkeyId"')
|
|
1331
|
+
end
|
|
1332
|
+
|
|
1333
|
+
api_path = '/users/{userId}/passkeys/{passkeyId}'
|
|
1334
|
+
.gsub('{userId}', user_id)
|
|
1335
|
+
.gsub('{passkeyId}', passkey_id)
|
|
1336
|
+
|
|
1337
|
+
api_params = {}
|
|
1338
|
+
|
|
1339
|
+
api_headers = {
|
|
1340
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
1341
|
+
"content-type": 'application/json',
|
|
1342
|
+
"accept": 'application/json',
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
@client.call(
|
|
1346
|
+
method: 'DELETE',
|
|
1347
|
+
path: api_path,
|
|
1348
|
+
headers: api_headers,
|
|
1349
|
+
params: api_params,
|
|
1350
|
+
)
|
|
1351
|
+
end
|
|
1352
|
+
|
|
1191
1353
|
# Update the user password by its unique ID.
|
|
1192
1354
|
#
|
|
1193
1355
|
# @param [String] user_id User ID.
|
data/lib/appwrite.rb
CHANGED
|
@@ -204,6 +204,7 @@ require_relative 'appwrite/models/policy_session_limit'
|
|
|
204
204
|
require_relative 'appwrite/models/policy_user_limit'
|
|
205
205
|
require_relative 'appwrite/models/policy_membership_privacy'
|
|
206
206
|
require_relative 'appwrite/models/policy_mfa_factors'
|
|
207
|
+
require_relative 'appwrite/models/policy_passkey'
|
|
207
208
|
require_relative 'appwrite/models/platform_web'
|
|
208
209
|
require_relative 'appwrite/models/platform_apple'
|
|
209
210
|
require_relative 'appwrite/models/platform_android'
|
|
@@ -222,6 +223,10 @@ require_relative 'appwrite/models/proxy_rule'
|
|
|
222
223
|
require_relative 'appwrite/models/email_template'
|
|
223
224
|
require_relative 'appwrite/models/mfa_challenge'
|
|
224
225
|
require_relative 'appwrite/models/mfa_challenge_secret'
|
|
226
|
+
require_relative 'appwrite/models/token_secret'
|
|
227
|
+
require_relative 'appwrite/models/passkey'
|
|
228
|
+
require_relative 'appwrite/models/passkey_challenge'
|
|
229
|
+
require_relative 'appwrite/models/passkey_list'
|
|
225
230
|
require_relative 'appwrite/models/mfa_recovery_codes'
|
|
226
231
|
require_relative 'appwrite/models/mfa_type'
|
|
227
232
|
require_relative 'appwrite/models/mfa_factors'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: appwrite
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 28.
|
|
4
|
+
version: 28.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Appwrite Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: mime-types
|
|
@@ -325,6 +325,9 @@ files:
|
|
|
325
325
|
- lib/appwrite/models/oauth2_reject.rb
|
|
326
326
|
- lib/appwrite/models/oauth2_token.rb
|
|
327
327
|
- lib/appwrite/models/organization.rb
|
|
328
|
+
- lib/appwrite/models/passkey.rb
|
|
329
|
+
- lib/appwrite/models/passkey_challenge.rb
|
|
330
|
+
- lib/appwrite/models/passkey_list.rb
|
|
328
331
|
- lib/appwrite/models/phone.rb
|
|
329
332
|
- lib/appwrite/models/phone_list.rb
|
|
330
333
|
- lib/appwrite/models/platform_android.rb
|
|
@@ -340,6 +343,7 @@ files:
|
|
|
340
343
|
- lib/appwrite/models/policy_list.rb
|
|
341
344
|
- lib/appwrite/models/policy_membership_privacy.rb
|
|
342
345
|
- lib/appwrite/models/policy_mfa_factors.rb
|
|
346
|
+
- lib/appwrite/models/policy_passkey.rb
|
|
343
347
|
- lib/appwrite/models/policy_password_dictionary.rb
|
|
344
348
|
- lib/appwrite/models/policy_password_history.rb
|
|
345
349
|
- lib/appwrite/models/policy_password_personal_data.rb
|
|
@@ -387,6 +391,7 @@ files:
|
|
|
387
391
|
- lib/appwrite/models/team.rb
|
|
388
392
|
- lib/appwrite/models/team_list.rb
|
|
389
393
|
- lib/appwrite/models/token.rb
|
|
394
|
+
- lib/appwrite/models/token_secret.rb
|
|
390
395
|
- lib/appwrite/models/topic.rb
|
|
391
396
|
- lib/appwrite/models/topic_list.rb
|
|
392
397
|
- lib/appwrite/models/transaction.rb
|