0.6.12 • Published 2 days ago

@openfort/openfort-js v0.6.12

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

Openfort Protocol

Openfort.js Library

Version

The Openfort js library provides convinient access to handle client session keys and return signed messages back to Openfort from applications written in client-side JavaScript.

Installation

npm install @openfort/openfort-js
yarn add @openfort/openfort-js

Usage

With the Openfort Unity SDK, you can sign transaction intents using one of four methods or signers:

const sdk = new Openfort("pk_test_XXXXXXX");

1. Session Signer

The Session Signer allows you to use external signing keys, without needing to provide it every time. Here's how to use it:

  • Configure the Session Key: Call configureSessionKey(). This method returns an Ethereum address and a boolean indicating whether you need to register the key from the backend.
const sessionKey = sdk.configureSessionKey();
  • Register Key and Send Signature Session Request: If sessionKey.isRegistered boolean is false, register the key from the backend. Refer to the documentation for session management.
  • Send Signature Transaction Intent Request: When calling sendSignatureTransactionIntentRequest, pass the transaction intent ID and the user operation hash. The session signer will handle the signing.

2. External Sign

This method allows you to externally sign transaction intents without logging in or additional configurations:

  • Call SendSignatureTransactionIntentRequest: Simply pass the transaction intent ID and the signature.
const response = await sdk.sendSignatureTransactionIntentRequest("transactionIntentId", null, "signature");

3. Embedded Signer

The Embedded Signer uses SSS to manage the private key on the client side. To learn more, visit our security documentation.

  • Login and Configure the Embedded Signer: First, ensure the user is logged in, using LoginWithEmailPassword, AuthenticateWithOAuth or if not registred SignUpWithEmailPassword. Then call ConfigureEmbeddedSigner. If a MissingRecoveryMethod exception is thrown, it indicates there's no share on the device and you have to call ConfigureEmbeddedRecovery to provide a recovery method.
try {
    await sdk.loginWithEmailPassword("email", "password");
    sdk.configureEmbeddedSigner(chainId);
} catch (e) {
    if (e instanceof MissingRecoveryMethod) {
        await sdk.configureEmbeddedSignerRecovery(new PasswordRecovery("password"));
    }
}

For now the only recovery method available is the PasswordRecovery method.

  • Send Signature Transaction Intent Request: Similar to the session signer, pass the transaction intent ID and the user operation hash. The embedded signer reconstructs the key and signs the transaction.
const response = await sdk.sendSignatureTransactionIntentRequest("transactionIntentId", "userOp");

Usage examples

0.6.12

2 days ago

0.6.11

3 days ago

0.6.10

17 days ago

0.6.9

19 days ago

0.6.8

19 days ago

0.6.7

20 days ago

0.6.6

20 days ago

0.6.5

20 days ago

0.6.4

29 days ago

0.6.3

1 month ago

0.6.2

1 month ago

0.6.1

1 month ago

0.6.0

1 month ago

0.5.27

1 month ago

0.5.26

1 month ago

0.5.22

1 month ago

0.5.25

1 month ago

0.5.23

1 month ago

0.5.24

1 month ago

0.5.21

2 months ago

0.5.18

2 months ago

0.5.19

2 months ago

0.5.20

2 months ago

0.5.11

2 months ago

0.5.16

2 months ago

0.5.17

2 months ago

0.5.14

2 months ago

0.5.15

2 months ago

0.5.12

2 months ago

0.5.13

2 months ago

0.5.10

2 months ago

0.5.8

2 months ago

0.5.7

2 months ago

0.5.9

2 months ago

0.5.4

2 months ago

0.5.3

2 months ago

0.5.6

2 months ago

0.5.5

2 months ago

0.5.0

2 months ago

0.5.2

2 months ago

0.5.1

2 months ago

0.4.5

2 months ago

0.4.4

2 months ago

0.4.6

2 months ago

0.4.1

2 months ago

0.4.3

2 months ago

0.4.2

2 months ago

0.4.0

2 months ago

0.3.0

10 months ago

0.2.1

10 months ago

0.2.7

10 months ago

0.2.6

10 months ago

0.3.2

6 months ago

0.2.3

10 months ago

0.3.1

6 months ago

0.2.2

10 months ago

0.3.4

5 months ago

0.2.5

10 months ago

0.3.3

6 months ago

0.2.4

10 months ago

0.2.0

10 months ago

0.1.8

11 months ago

0.1.7

11 months ago

0.1.6

11 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.0.2

12 months ago

0.0.1

12 months ago