@chipi-stack/backend 14.15.1 → 14.17.0
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.
- package/README.md +48 -0
- package/dist/index.d.mts +543 -65
- package/dist/index.d.ts +543 -65
- package/dist/index.js +1026 -317
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +997 -319
- package/dist/index.mjs.map +1 -1
- package/dist/skuPurchases.js +16 -2
- package/dist/skuPurchases.js.map +1 -1
- package/dist/skuPurchases.mjs +16 -2
- package/dist/skuPurchases.mjs.map +1 -1
- package/dist/transactions.js +16 -2
- package/dist/transactions.js.map +1 -1
- package/dist/transactions.mjs +16 -2
- package/dist/transactions.mjs.map +1 -1
- package/dist/wallets.js +25 -3
- package/dist/wallets.js.map +1 -1
- package/dist/wallets.mjs +25 -3
- package/dist/wallets.mjs.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -93,6 +93,54 @@ A quorum can only **raise** `requiredApprovals` above the wallet's on-chain
|
|
|
93
93
|
threshold. The chain is the hard floor, so a quorum below it produces proposals
|
|
94
94
|
that reach approved and then revert at execute.
|
|
95
95
|
|
|
96
|
+
## Bramble and other Starknet wallets
|
|
97
|
+
|
|
98
|
+
Users who already have Bramble, Braavos or Ready can use it with Chipi. Their key never leaves that wallet.
|
|
99
|
+
|
|
100
|
+
**Sign in with Starknet** (14.16.0+): Bramble signs a SNIP-12 message with a one-time nonce, and the account checks it.
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { createStarknetSignInTypedData, verifyStarknetSignIn } from "@chipi-stack/backend";
|
|
104
|
+
import { RpcProvider } from "starknet";
|
|
105
|
+
|
|
106
|
+
const now = Math.floor(Date.now() / 1000);
|
|
107
|
+
const typedData = createStarknetSignInTypedData({
|
|
108
|
+
domain: "app.example.com",
|
|
109
|
+
uri: "https://app.example.com",
|
|
110
|
+
address: brambleAddress, // from wallet_requestAccounts
|
|
111
|
+
nonce,
|
|
112
|
+
issuedAt: now,
|
|
113
|
+
expirationTime: now + 600,
|
|
114
|
+
});
|
|
115
|
+
// The browser asks Bramble: wallet_signTypedData(typedData) → signature
|
|
116
|
+
const result = await verifyStarknetSignIn({
|
|
117
|
+
typedData,
|
|
118
|
+
signature,
|
|
119
|
+
provider: new RpcProvider({ nodeUrl }),
|
|
120
|
+
expected: { domain: "app.example.com", uri: "https://app.example.com", nonce },
|
|
121
|
+
});
|
|
122
|
+
if (result.ok) console.log("signed in as", result.address);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Trusted wallets** (14.17.0+): Bramble can be a co-owner or a recovery guardian of a Chipi wallet, through the `STARK_SNIP12` signer kind. Once added as a co-owner, Bramble approves transactions with `wallet_signTypedData` and Chipi relays them gaslessly:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
const txHash = await sdk.executeWithExternalSigner({
|
|
129
|
+
params: {
|
|
130
|
+
walletAddress: chipiWallet.publicKey,
|
|
131
|
+
ownerIndex: brambleOwnerId,
|
|
132
|
+
calls,
|
|
133
|
+
signTypedData: async (typedData) =>
|
|
134
|
+
(await bramble.request({ type: "wallet_signTypedData", params: typedData })) as string[],
|
|
135
|
+
// Checked off-chain before relaying (key from resolveStarkSnip12Signer).
|
|
136
|
+
signer: { address: brambleAddress, starkPubkey },
|
|
137
|
+
},
|
|
138
|
+
bearerToken,
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The `STARK_SNIP12` verifier class is declared on mainnet; `isShhhVerifierDeclared` checks it on any network. Guides: [Sign in with Starknet](https://docs.chipipay.com/sdk/guides/sign-in-with-starknet) and [Trusted wallets](https://docs.chipipay.com/sdk/guides/trusted-wallets).
|
|
143
|
+
|
|
96
144
|
## What you can ship
|
|
97
145
|
|
|
98
146
|
- **Wallet-as-a-service APIs** — provision and manage wallets for your users from your backend
|