Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit f61fa39

Browse files
committed
Initial draft of Permissioned Signer documentation
1 parent ccf7e14 commit f61fa39

File tree

5 files changed

+1137
-863
lines changed

5 files changed

+1137
-863
lines changed

apps/nextra/pages/en/build/sdks/ts-sdk/account/_meta.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ export default {
22
"account-abstraction": {
33
title: "Account Abstraction",
44
},
5+
"permissioned-signer": {
6+
title: "Permissioned Signer",
7+
},
58
};

apps/nextra/pages/en/build/sdks/ts-sdk/account/account-abstraction.mdx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ An enum variant defining the authentication data to be passed to the authenticat
5858

5959
```move
6060
enum AbstractionAuthData has copy, drop {
61-
V1 {
61+
V1 {
6262
digest: vector<u8>, // SHA3-256 hash of the signing message
6363
authenticator: vector<u8> // Custom auth data (e.g., signatures)
6464
},
@@ -113,7 +113,7 @@ const abstractedAccount = new AbstractedAccount({
113113

114114
### 1. Deploy Authentication Module
115115

116-
In this example, we will deploy the `hello_world_authenticator` module. The `authenticate` function takes an `AbstractionAuthData` and returns a `signer`
116+
In this example, we will deploy the `hello_world_authenticator` module. The `authenticate` function takes an `AbstractionAuthData` and returns a `signer`
117117
if the authentication is successful, otherwise it aborts the transaction. The authentication logic will only allow transactions that have an authenticator equal to `"hello world"`.
118118

119119
```move
@@ -132,7 +132,7 @@ module deployer::hello_world_authenticator {
132132
}
133133
```
134134

135-
To deploy the module, you can use the following commands from the [Aptos CLI](../../../../build/cli). We assume that you already have set up a workspace with `aptos init` and
135+
To deploy the module, you can use the following commands from the [Aptos CLI](../../../../build/cli). We assume that you already have set up a workspace with `aptos init` and
136136
declared the named addresses in your `Move.toml` file.
137137

138138
```bash
@@ -169,8 +169,8 @@ console.log("Account Abstraction status: ", accountAbstractionStatus);
169169

170170
### 4. Enable the Authentication Function
171171

172-
Assuming that the account does not have account abstraction enabled, you need to enable the authentication function for the account. This can be done by calling
173-
the `enableAccountAbstractionTransaction` function. This creates a raw transaction that needs to be signed and submitted to the network. In this example, `alice`
172+
Assuming that the account does not have account abstraction enabled, you need to enable the authentication function for the account. This can be done by calling
173+
the `enableAccountAbstractionTransaction` function. This creates a raw transaction that needs to be signed and submitted to the network. In this example, `alice`
174174
will be the account that will be enabled.
175175

176176
```ts
@@ -267,7 +267,7 @@ console.log("Coin transfer transaction submitted! ", pendingCoinTransferTransact
267267

268268
### 7. Conclusion
269269

270-
To verify that you have successfully sign and submitted the transaction using the abstracted account, you can use the explorer to check the transaction. If the
270+
To verify that you have successfully sign and submitted the transaction using the abstracted account, you can use the explorer to check the transaction. If the
271271
transaction signature contains a `function_info` and `auth_data` field, it means you succesfully used account abstraction! The full E2E demo can be found [here](https://github.com/aptos-labs/aptos-ts-sdk/blob/main/examples/typescript/public_key_authenticator_account_abstraction.ts).
272272

273273
![Transaction Signature](https://i.imgur.com/HZylFnc.png)
@@ -353,7 +353,7 @@ module deployer::public_key_authenticator {
353353
) acquires PublicKeyPermissions {
354354
let account_addr = signer::address_of(signer);
355355
assert!(std::vector::length(&public_key) == 32, EINVALID_PUBLIC_KEY);
356-
356+
357357
if (!exists<PublicKeyPermissions>(account_addr)) {
358358
move_to(signer, PublicKeyPermissions {
359359
public_key_table: smart_table::new(),
@@ -362,20 +362,20 @@ module deployer::public_key_authenticator {
362362
363363
let permissions = borrow_global_mut<PublicKeyPermissions>(account_addr);
364364
assert!(
365-
!smart_table::contains(&permissions.public_key_table, public_key),
365+
!smart_table::contains(&permissions.public_key_table, public_key),
366366
EENTRY_ALREADY_EXISTS
367367
);
368368
369369
smart_table::add(&mut permissions.public_key_table, public_key, true);
370-
370+
371371
}
372372
373373
public entry fun revoke_public_key(
374374
signer: &signer,
375375
public_key: vector<u8>
376376
) acquires PublicKeyPermissions {
377377
let account_addr = signer::address_of(signer);
378-
378+
379379
assert!(exists<PublicKeyPermissions>(account_addr), ENO_PERMISSIONS);
380380
381381
let permissions = borrow_global_mut<PublicKeyPermissions>(account_addr);
@@ -395,11 +395,11 @@ whether a public key is permitted to sign transactions on behalf of the user.
395395
```move
396396
module deployer::public_key_authenticator {
397397
// ...
398-
398+
399399
struct PublicKeyPermissions has key {
400400
public_key_table: SmartTable<vector<u8>, bool>,
401-
}
402-
401+
}
402+
403403
}
404404
```
405405

@@ -417,7 +417,7 @@ module deployer::public_key_authenticator {
417417
) acquires PublicKeyPermissions {
418418
let account_addr = signer::address_of(signer);
419419
assert!(std::vector::length(&public_key) == 32, EINVALID_PUBLIC_KEY);
420-
420+
421421
if (!exists<PublicKeyPermissions>(account_addr)) {
422422
move_to(signer, PublicKeyPermissions {
423423
public_key_table: smart_table::new(),
@@ -426,20 +426,20 @@ module deployer::public_key_authenticator {
426426
427427
let permissions = borrow_global_mut<PublicKeyPermissions>(account_addr);
428428
assert!(
429-
!smart_table::contains(&permissions.public_key_table, public_key),
429+
!smart_table::contains(&permissions.public_key_table, public_key),
430430
EENTRY_ALREADY_EXISTS
431431
);
432432
433433
smart_table::add(&mut permissions.public_key_table, public_key, true);
434-
434+
435435
}
436436
437437
public entry fun revoke_public_key(
438438
signer: &signer,
439439
public_key: vector<u8>
440440
) acquires PublicKeyPermissions {
441441
let account_addr = signer::address_of(signer);
442-
442+
443443
assert!(exists<PublicKeyPermissions>(account_addr), ENO_PERMISSIONS);
444444
445445
let permissions = borrow_global_mut<PublicKeyPermissions>(account_addr);
@@ -453,7 +453,7 @@ module deployer::public_key_authenticator {
453453
The `authenticate` function is the main function that allows users to authenticate on behalf of somebody else using account abstraction. The `authenticator`
454454
will contain the **public key** and a **signature** of the user. We will verify that the public key is permitted and that the signature is valid.
455455

456-
The signature is the result of signing the `digest`. The `digest` is the sha256 hash of the **signing message** which contains information about the transaction.
456+
The signature is the result of signing the `digest`. The `digest` is the sha256 hash of the **signing message** which contains information about the transaction.
457457
By signing the `digest`, we confirm that the user has approved the specific transaction that was submitted.
458458

459459
```move
@@ -490,7 +490,7 @@ module deployer::public_key_authenticator {
490490
}
491491
```
492492

493-
To deploy the module, you can use the following commands from the [Aptos CLI](../../../../build/cli). We assume that you already have set up a workspace with `aptos init` and
493+
To deploy the module, you can use the following commands from the [Aptos CLI](../../../../build/cli). We assume that you already have set up a workspace with `aptos init` and
494494
declared the named addresses in your `Move.toml` file.
495495

496496
```bash
@@ -528,8 +528,8 @@ console.log("Account Abstraction status: ", accountAbstractionStatus);
528528

529529
### 4. Enable the Authentication Function
530530

531-
Assuming that the account does not have account abstraction enabled, we need to enable the authentication function for the account. This can be done by calling
532-
the `enableAccountAbstractionTransaction` function. This creates a raw transaction that needs to be signed and submitted to the network. In this example, `alice`
531+
Assuming that the account does not have account abstraction enabled, we need to enable the authentication function for the account. This can be done by calling
532+
the `enableAccountAbstractionTransaction` function. This creates a raw transaction that needs to be signed and submitted to the network. In this example, `alice`
533533
will be the account that will be enabled.
534534

535535
```ts
@@ -617,7 +617,7 @@ console.log("Coin transfer transaction submitted! ", pendingCoinTransferTransact
617617

618618
### 8. Conclusion
619619

620-
To verify that you have successfully sign and submitted the transaction using the abstracted account, you can use the explorer to check the transaction. If the
620+
To verify that you have successfully sign and submitted the transaction using the abstracted account, you can use the explorer to check the transaction. If the
621621
transaction signature contains a `function_info` and `auth_data` field, it means you succesfully used account abstraction! The full E2E demo can be found [here](https://github.com/aptos-labs/aptos-ts-sdk/blob/main/examples/typescript/public_key_authenticator_account_abstraction.ts)
622622

623623
![Transaction Signature](https://i.imgur.com/3U40YSb.png)
@@ -641,7 +641,7 @@ const transaction = aptos.abstraction.disableAccountAbstractionTransaction({
641641

642642
## Application User Experience
643643

644-
Applications that want to leverage account abstraction will want to provide a user experience that allows users to check if the account has account abstraction enabled,
644+
Applications that want to leverage account abstraction will want to provide a user experience that allows users to check if the account has account abstraction enabled,
645645
and to enable it, if it is not enabled.
646646

647647

0 commit comments

Comments
 (0)