diff --git a/.vscode/settings.json b/.vscode/settings.json
index eb932e8f..0b83f500 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -7,7 +7,9 @@
"cSpell.words": [
"Commitlint",
"Monerium",
+ "PKCE",
"sepolia",
+ "SIWE",
"stylelint"
],
"editor.codeActionsOnSave": {
diff --git a/apps/customer/app/test/page.tsx b/apps/customer/app/test/page.tsx
index 4dba8499..081c3629 100644
--- a/apps/customer/app/test/page.tsx
+++ b/apps/customer/app/test/page.tsx
@@ -1,5 +1,5 @@
'use client';
-import { ChangeEvent, FormEvent, useContext, useEffect, useState } from 'react';
+import { ChangeEvent, FormEvent, useContext, useState } from 'react';
import Link from 'next/link';
import { useAccount, useChainId, useSignMessage } from 'wagmi';
import { ConnectButton } from '@rainbow-me/rainbowkit';
@@ -14,6 +14,7 @@ import {
OrderState,
PaymentStandard,
placeOrderMessage,
+ rfc3339,
} from '@monerium/sdk';
import {
MoneriumContext,
@@ -48,11 +49,16 @@ export default function Test() {
* Monerium queries
*/
const context = useContext(MoneriumContext);
- const { isAuthorized, authorize, revokeAccess, error: authError } = useAuth();
- const { data: profile } = useProfile();
+ const {
+ isAuthorized,
+ authorize,
+ siwe,
+ revokeAccess,
+ error: authError,
+ } = useAuth();
- // const { authContext } = useAuthContext();
+ const { data: profile } = useProfile();
const { data: orders } = useOrders();
@@ -634,7 +640,34 @@ export default function Test() {
const autoLink = () => {
signMessageAsync({ message: constants.LINK_MESSAGE }).then((signature) => {
- authorize({ address, signature, chain: chainId });
+ authorize({ address: `${address}`, signature, chain: chainId });
+ });
+ };
+ const authorizeSiwe = () => {
+ const date = new Date();
+ const issueDate = rfc3339(new Date(date.toISOString()));
+
+ date.setMinutes(date.getMinutes() + 5);
+ const expiryDate = date.toISOString();
+
+ const siwe_message = `localhost:3000 wants you to sign in with your Ethereum account:
+0xB64Fed2aFF534D5320BF401d0D5B93Ed7AbCf13E
+
+Allow SDK TEST APP to access my data on Monerium
+
+URI: http://localhost:3000/dashboard
+Version: 1
+Chain ID: 100
+Nonce: ${Math.random().toString(36).substring(2, 16)}
+Issued At: ${issueDate}
+Expiration Time: ${expiryDate}
+Resources:
+- https://monerium.com/siwe
+- https://example.com/privacy-policy
+- https://example.com/terms-of-service`;
+
+ signMessageAsync({ message: siwe_message }).then((signature) => {
+ siwe({ message: siwe_message, signature });
});
};
@@ -663,7 +696,7 @@ export default function Test() {
{!isAuthorized ? (
<>
-