Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## 28.3.0

* Added: `account` passkey methods `listPasskeys`, `createPasskey`, `getPasskey`, `updatePasskey`, `deletePasskey` and `updatePasskeyVerification`
* Added: `account.createPasskeyToken` and `account.updatePasskeyToken` for passkey sign-in
* Added: `users.listPasskeys`, `users.getPasskey`, `users.updatePasskey` and `users.deletePasskey`
* Added: `project.updatePasskeyPolicy` to configure passkey sign-in
* Added: `Passkey`, `PasskeyList`, `PasskeyChallenge` and `TokenSecret` models

## 28.2.0

* Added: optional `interval` parameter on `functions.create` and `functions.update` to run a function every N minutes
Expand Down
2 changes: 1 addition & 1 deletion appwrite.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = 'appwrite'
spec.version = '28.2.0'
spec.version = '28.3.0'
spec.license = 'BSD-3-Clause'
spec.summary = 'Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API'
spec.author = 'Appwrite Team'
Expand Down
14 changes: 14 additions & 0 deletions docs/examples/account/create-passkey-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with

account = Account.new(client)

result = account.create_passkey_token()
```
17 changes: 17 additions & 0 deletions docs/examples/account/create-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with

account = Account.new(client)

result = account.create_passkey(
passkey_id: '<PASSKEY_ID>', # optional
name: '<NAME>' # optional
)
```
16 changes: 16 additions & 0 deletions docs/examples/account/delete-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with

account = Account.new(client)

result = account.delete_passkey(
passkey_id: '<PASSKEY_ID>'
)
```
16 changes: 16 additions & 0 deletions docs/examples/account/get-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with

account = Account.new(client)

result = account.get_passkey(
passkey_id: '<PASSKEY_ID>'
)
```
17 changes: 17 additions & 0 deletions docs/examples/account/list-passkeys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with

account = Account.new(client)

result = account.list_passkeys(
queries: [], # optional
total: false # optional
)
```
17 changes: 17 additions & 0 deletions docs/examples/account/update-passkey-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with

account = Account.new(client)

result = account.update_passkey_token(
challenge_id: '<CHALLENGE_ID>',
credential: {}
)
```
17 changes: 17 additions & 0 deletions docs/examples/account/update-passkey-verification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with

account = Account.new(client)

result = account.update_passkey_verification(
passkey_id: '<PASSKEY_ID>',
credential: {}
)
```
17 changes: 17 additions & 0 deletions docs/examples/account/update-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_session('') # The user session to authenticate with

account = Account.new(client)

result = account.update_passkey(
passkey_id: '<PASSKEY_ID>',
name: '<NAME>'
)
```
16 changes: 16 additions & 0 deletions docs/examples/project/update-passkey-policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key

project = Project.new(client)

result = project.update_passkey_policy(
rp_id: '<RP_ID>'
)
```
17 changes: 17 additions & 0 deletions docs/examples/users/delete-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key

users = Users.new(client)

result = users.delete_passkey(
user_id: '<USER_ID>',
passkey_id: '<PASSKEY_ID>'
)
```
17 changes: 17 additions & 0 deletions docs/examples/users/get-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key

users = Users.new(client)

result = users.get_passkey(
user_id: '<USER_ID>',
passkey_id: '<PASSKEY_ID>'
)
```
18 changes: 18 additions & 0 deletions docs/examples/users/list-passkeys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key

users = Users.new(client)

result = users.list_passkeys(
user_id: '<USER_ID>',
queries: [], # optional
total: false # optional
)
```
18 changes: 18 additions & 0 deletions docs/examples/users/update-passkey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```ruby
require 'appwrite'

include Appwrite

client = Client.new
.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint
.set_project('<YOUR_PROJECT_ID>') # Your project ID
.set_key('<YOUR_API_KEY>') # Your secret API key

users = Users.new(client)

result = users.update_passkey(
user_id: '<USER_ID>',
passkey_id: '<PASSKEY_ID>',
name: '<NAME>'
)
```
4 changes: 4 additions & 0 deletions lib/appwrite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,10 @@
require_relative 'appwrite/models/email_template'
require_relative 'appwrite/models/mfa_challenge'
require_relative 'appwrite/models/mfa_challenge_secret'
require_relative 'appwrite/models/token_secret'
require_relative 'appwrite/models/passkey'
require_relative 'appwrite/models/passkey_challenge'
require_relative 'appwrite/models/passkey_list'
require_relative 'appwrite/models/mfa_recovery_codes'
require_relative 'appwrite/models/mfa_type'
require_relative 'appwrite/models/mfa_factors'
Expand Down
2 changes: 1 addition & 1 deletion lib/appwrite/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def initialize
'x-sdk-name' => 'Ruby',
'x-sdk-platform' => 'server',
'x-sdk-language' => 'ruby',
'x-sdk-version' => '28.2.0',
'x-sdk-version' => '28.3.0',
'X-Appwrite-Response-Format' => '2.0.0'
}
@endpoint = 'https://cloud.appwrite.io/v1'
Expand Down
47 changes: 47 additions & 0 deletions lib/appwrite/models/passkey.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# frozen_string_literal: true

module Appwrite
module Models
class Passkey
attr_reader :id
attr_reader :created_at
attr_reader :updated_at
attr_reader :name
attr_reader :accessed_at

def initialize(
id:,
created_at:,
updated_at:,
name:,
accessed_at:
)
@id = id
@created_at = created_at
@updated_at = updated_at
@name = name
@accessed_at = accessed_at
end

def self.from(map:)
Passkey.new(
id: map["$id"],
created_at: map["$createdAt"],
updated_at: map["$updatedAt"],
name: map["name"],
accessed_at: map["accessedAt"]
)
end

def to_map
{
"$id": @id,
"$createdAt": @created_at,
"$updatedAt": @updated_at,
"name": @name,
"accessedAt": @accessed_at
}
end
end
end
end
47 changes: 47 additions & 0 deletions lib/appwrite/models/passkey_challenge.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# frozen_string_literal: true

module Appwrite
module Models
class PasskeyChallenge
attr_reader :id
attr_reader :created_at
attr_reader :passkey_id
attr_reader :expire
attr_reader :public_key

def initialize(
id:,
created_at:,
passkey_id:,
expire:,
public_key:
)
@id = id
@created_at = created_at
@passkey_id = passkey_id
@expire = expire
@public_key = public_key
end

def self.from(map:)
PasskeyChallenge.new(
id: map["$id"],
created_at: map["$createdAt"],
passkey_id: map["passkeyId"],
expire: map["expire"],
public_key: map["publicKey"]
)
end

def to_map
{
"$id": @id,
"$createdAt": @created_at,
"passkeyId": @passkey_id,
"expire": @expire,
"publicKey": @public_key
}
end
end
end
end
Loading
Loading