{"_id":"@amplica-labs/siwf","_rev":"8-54ba9b897a490457d2c35c620d6d0cbd","name":"@amplica-labs/siwf","dist-tags":{"next":"0.0.0-5ad901","latest":"1.1.1"},"versions":{"0.0.0-06d7fc":{"name":"@amplica-labs/siwf","version":"0.0.0-06d7fc","_id":"@amplica-labs/siwf@0.0.0-06d7fc","maintainers":[{"name":"wilwade","email":"wil@wilwade.com"},{"name":"scott_b_unf","email":"scott.bendar@unfinished.com"}],"dist":{"shasum":"cdcf9dd3b49fbf174e84be39db538652678bcda3","tarball":"https://registry.npmjs.org/@amplica-labs/siwf/-/siwf-0.0.0-06d7fc.tgz","fileCount":37,"integrity":"sha512-ZJ3e9GCK9r23ERyV39ouxcEU/uSJLTi5TcVE0LNIwVnnGfLcqjsb1LMeOwLY+a13SqMyxTLwC/1c1kj0K8rOgQ==","signatures":[{"sig":"MEUCIHFumXsAMqjQUsXUdGNvDzGmc79LMO3KoY8yNr9k5+cKAiEAobhn3IxqwaPkDpBMaAzLtb/KtY7COwPzwbN7HztgBm0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3406243},"main":"index.umd.cjs","type":"module","types":"index.d.ts","module":"index.js","exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.umd.cjs"}},"gitHead":"06d7fcd197006d972ed6ad4cec24b1beb8ec7f97","private":false,"scripts":{},"_npmUser":{"name":"wilwade","email":"wil@wilwade.com"},"_npmVersion":"10.2.4","description":"## Description","directories":{},"_nodeVersion":"20.11.1","dependencies":{"@polkadot/api":"^10.12.4","@talismn/siws":"^0.0.18","@polkadot/util":"^12.6.2","@polkadot/types":"^10.12.4","@polkadot/util-crypto":"^12.6.2","@dsnp/frequency-schemas":"^1.1.0","@polkadot/extension-dapp":"^0.46.6","@polkadot/extension-inject":"^0.46.6","@frequency-chain/api-augment":"^1.10.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/siwf_0.0.0-06d7fc_1711997707122_0.10686966418762878","host":"s3://npm-registry-packages"}},"0.0.0-d731cd":{"name":"@amplica-labs/siwf","version":"0.0.0-d731cd","license":"Apache-2.0","_id":"@amplica-labs/siwf@0.0.0-d731cd","maintainers":[{"name":"wilwade","email":"wil@wilwade.com"},{"name":"scott_b_unf","email":"scott.bendar@unfinished.com"}],"dist":{"shasum":"184a23148f23c0b0ddcea1b4ccbcadbbd6765ada","tarball":"https://registry.npmjs.org/@amplica-labs/siwf/-/siwf-0.0.0-d731cd.tgz","fileCount":37,"integrity":"sha512-nAAbaOUXk8g2h896lGB5wQchqlqCWiRN4eG/JpmRbOuwj95jiDJbEv8lQhOwrJ5evkiSFYLUTp/LxZyqdOT1Uw==","signatures":[{"sig":"MEYCIQDfH2B8giVjEkb1DWjgObFbVvXEEJ1m8+Qw2Kaj2qaruAIhAOlUgYeGeJ4WF4bbMrqvt6dwMgupD93th3k3j9W8I0jM","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3406325},"main":"index.umd.cjs","type":"module","types":"index.d.ts","module":"index.js","readme":"# Sign-In With Frequency (SIWF)\n\nEasy setup and validation for Sign-In With Frequency.\n\n## Description\n\nSIWF is an application that facilitates using a selected Polkadot-compatible crypto wallet to perform sign-in and\nonboarding operations over Frequency.\n\n### Supported Operations\n\n- Sign up using Frequency\n- Sign in using Frequency\n\n## Architecture/Design\n\n### Description\n\nSIWF has two parts: a package `@amplica-labs/siwf` and a deployed web application that performs the needed UI for\nassisting the user in the action of login or onboarding. The UI also assists with interfacing with various wallets is\nachieved through interaction with either a supported browser extension (web/mobile) or an installed native app (mobile\nonly)\n\n### Data flow\n\nThis uses the emerging [Sign In With Substrate standard](https://siws.xyz/) for login and a custom system for the\nonboarding. The user/data flows will look as follows:\n\n- [Onboarding sign-up flow](./docs/signup-flow.md)\n- [Sign-in flow](./docs/login-flow.md)\n\n## Usage\n\n### Creating a Sign-up/Sign-in Button\n\n1. Install the SIWF package `npm i @amplica-labs/siwf`\n\n2. Import the `setConfig` and `getLoginOrRegistrationPayload` functions.\n3. `setConfig` is used to set the URL to the current production siwf-ui. The current deployed environment is via GitHub\n   pages at:\n\n   ```\n   https://amplicalabs.github.io/siwf/ui\n   ```\n\n   Note: For SIWF development replace with the address the local application runs on.\n\n   ```ts\n   import { type ControlPanelResponse, getLoginOrRegistrationPayload, setConfig } from '@amplica-labs/siwf';\n   setConfig({\n     // Your providerId\n     providerId: '1',\n     // The url where SIWF UI lives\n     proxyUrl: 'https://amplicalabs.github.io/siwf/ui',\n     // The Frequency RPC endpoint\n     frequencyRpcUrl: 'https://0.rpc.testnet.amplica.io',\n     siwsOptions: {\n       // The expiration for the SIWS payload.\n       expiresInMsecs: 1000,\n     },\n     // The Schema name for which permissions are being requested.\n     // A specific version of a named schema may be requested using the optional `version`\n     // attribute. Named schema versions are monotonically increasing integers, starting from 1. A\n     // value of `0` is the same as omitting the attribute and will resolve to the latest version of the\n     // named schema.\n     schemas: [\n       { name: 'public-key-key-agreement' },\n       { name: 'public-follows' },\n       { name: 'private-follows' },\n       { name: 'private-connections' },\n     ],\n   });\n   ```\n\n   A list for all the schemas DSNP supports can found\n   [in the DSNP Spec](https://spec.dsnp.org/Frequency/Overview.html?highlight=schema#dsnp-over-frequency-schemas).\n\n4. Use `getLoginOrRegistrationPayload` to get the payload from the user.\n\n```html\n<script>\n  async function handleSignInClick() {\n    const payload = await getLoginOrRegistrationPayload();\n  }\n</script>\n\n<button onclick=\"handleSignInClick()\">Get Login/Signup</button>\n```\n\nThe response from `getLoginOrRegistrationPayload`\n\n```ts\nexport type WalletProxyResponse = {\n  signIn?: SignInResponse;\n  signUp?: SignUpResponse;\n};\n```\n\n## Handling Responses\n\nThe response from the SIWF UI during sign-in may vary slightly because it's unknown at the time of invocation whether\nthe user is attempting to sign in with an identity (MSA), is a returning user to the dApp, or requires permission\ngrants.\n\n### Brand new user\n\nIn this scenario, the response indicates that the user does not possess an identity account (MSA) and has authorized the\ndApp to create one for them. This process involves assigning a unique user handle that will be linked to the new MSA\naccount after submitting transactions to Frequency.\n\nThe returned payload includes two encoded transactions (extrinsics) with signatures. One transaction creates a new MSA\nand grants the dApp the authority to act on the user's behalf (delegation), along with a specific set of permissions\n(schema permissions). The other transaction carries a signature that approves the claiming of a user handle for the\naccount.\n\n```json\n{\n  \"signUp\": {\n    \"extrinsics\": [\n      {\n        \"pallet\": \"msa\",\n        \"extrinsicName\": \"createSponsoredAccountWithDelegation\",\n        \"encodedExtrinsic\": \"0xed01043c01b01b4dcafc8a8e73bff98e7558249f53cd0e0e64fa6b8f0159f0913d4874d9360176644186458bad3b00bbd0ac21e6c9bd5a8bed9ced7a772d11a9aac025b47f6559468808e272696f596a02af230951861027c0dc30f7163ecf316838a0723483010000000000000014000000000000000000004d000000\"\n      },\n      {\n        \"pallet\": \"handles\",\n        \"extrinsicName\": \"claimHandle\",\n        \"encodedExtrinsic\": \"0xb901044200b01b4dcafc8a8e73bff98e7558249f53cd0e0e64fa6b8f0159f0913d4874d93601225508ae2da9804c60660a150277eb32b2a0f6b9c8f6e07dd6cad799cb31ae1dfb43896f488e9c0b7ec8b530d930b3f9b690683f2765d5def3fee3fc6540d58714656e6464794d000000\"\n      }\n    ]\n  }\n}\n```\n\n### Authorizes app as a delegate\n\nThis response means that an user already has an MSA. However, the user is new to this application is therefore allowing\nthe application to be added as a delegate, with permissions to the schemas requested by the application.\n\nThis response may also indicate that the user has an active delegation to the requesting application, but the\napplication is requesting additional schema permissions beyond what the user had previously authorized.\n\nTODO: This may in the future not return a signIn payload as all the information needed for validating the sign-in is\nincluded in the sign-up.\n\n```json\n{\n  \"signUp\": {\n    \"extrinsics\": [\n      {\n        \"pallet\": \"msa\",\n        \"extrinsicName\": \"grantDelegation\",\n        \"encodedExtrinsic\": \"0xc501043c03a028a10adc58e0e85c9f604e4b7c1cfe467ea25553b1fd5f19eac25a71d46d770164d9ba24677e28555d98fad2865b069fb0d51f2f45b0e86098dec272e0a5013699d17d9c86ea2c96d0e3e7a3952db232d57b1973d41fbdffcd35bdc78e21a88e0100000000000000004e000000\"\n      }\n    ]\n  },\n  \"signIn\": {\n    \"siwsPayload\": {\n      \"message\": \"localhost wants you to sign in with your Frequency account:\\n5Fghb4Wt3sg9cF6Q2Qucp5jXV5pL2U9uaYXwR9R8W8SYe9np\\n\\nThe domain localhost wants you to sign in with your Frequency account via localhost\\n\\nURI: http://localhost:5173/signin/confirm\\nNonce: N6rLwqyz34oUxJEXJ\\nIssued At: 2024-03-05T23:18:03.041Z\\nExpiration Time: 2024-03-05T23:23:03.041Z\",\n      \"signature\": \"0x38faa2fc6f59bef8ffccfc929fb966e1d53ba45e3af7a029ea1d636eaddcbe78a4be0f89eaf7ff7bbaef20a070ad65f9d0f876889686687ef623214fddddb18b\"\n    }\n  }\n}\n```\n\n### Returning User\n\nThis mean that a user has an MSA account and is a returning user to an application. This user has already granted\ndelegation and schemas permissions and is simply signing in.\n\n```json\n{\n  \"signIn\": {\n    \"siwsPayload\": {\n      \"message\": \"localhost wants you to sign in with your Frequency account:\\n5Fghb4Wt3sg9cF6Q2Qucp5jXV5pL2U9uaYXwR9R8W8SYe9np\\n\\nThe domain localhost wants you to sign in with your Frequency account via localhost\\n\\nURI: http://localhost:5173/signin/confirm\\nNonce: N6rLwqyz34oUxJEXJ\\nIssued At: 2024-03-05T23:18:03.041Z\\nExpiration Time: 2024-03-05T23:23:03.041Z\",\n      \"signature\": \"0x38faa2fc6f59bef8ffccfc929fb966e1d53ba45e3af7a029ea1d636eaddcbe78a4be0f89eaf7ff7bbaef20a070ad65f9d0f876889686687ef623214fddddb18b\"\n    }\n  }\n}\n```\n\n### User manually closes window before\n\nAn empty payload means that a user has closed the popup window before completing the sign in flow.\n\n```\n{}\n```\n\n### Response Parameters\n\nOne of two objects will have data: `signUp` or `signIn`.\n\n#### Signup\n\n`extrinsics`: An array of objects, each representing a signup extrinsic. Each extrinsic object includes:\n\n- `pallet`: The name of the pallet.\n- `extrinsicName`: The name of the extrinsic call.\n- `encodedExtrinsic`: The hex-encoded extrinsic data.\n- `providerMsaId`: The MSA ID of the provider. This ID is used to validate that permissions were granted by the correct\n  provider.\n\n#### SignIn\n\n`siwsPayload`: [Sign In With Substrate standard](https://siws.xyz/)\n\n- `message`: The text message the user signed\n- `signature`: The hex-encoded signature of the message\n\n### Validating Response\n\nIt is nessisary to check the validity of the encoded payload as well as to keep track of the expiration of the grant\ndelegation. This helps with avoiding failed transactions due to expiration of signature for granting delegation. Methods\nfor decoding a hex-encoded extrinsic can be found in the\n[Polkadot documentation](https://wiki.polkadot.network/docs/build-transaction-construction).\n\nThe `validateSignup` and `validateSignin` functions included in the `@amplica-labs/siwf` package performs validation\nparameters to ensure the integrity and correctness of the process. It verifies several critical aspects of the provided\nextrinsics or payload, including the validity and expiration of proofs, the consistency of signing keys, the format of\nencoded data, and the matching of permissions with the provider's MSA ID.\n\n## Signup\n\n### Example\n\n```ts\nimport { validateSignup } from '@amplica-labs/siwf';\nlet response = {\n  signUp: {\n    extrinsics: [\n      {\n        pallet: 'msa',\n        extrinsicName: 'grantDelegation',\n        encodedExtrinsic:\n          '0xc501043c03a028a10adc58e0e85c9f604e4b7c1cfe467ea25553b1fd5f19eac25a71d46d770164d9ba24677e28555d98fad2865b069fb0d51f2f45b0e86098dec272e0a5013699d17d9c86ea2c96d0e3e7a3952db232d57b1973d41fbdffcd35bdc78e21a88e0100000000000000004e000000',\n      },\n    ],\n  },\n};\n\nconst providerMsaId = 1;\n\nconst api: ApiPromise = getApi();\n\nconst {\n  expiration,\n  payloads: { addProviderPayload, claimHandlePayload },\n  publicKey,\n  calls,\n} = await validateSignup(api, response.signUp, providerMsaId);\n```\n\n### Return Value\n\nThe function returns a Promise that resolves to an object containing the following properties:\n\n- `expiration`: The expiration timestamp of the proof.\n- `payloads`: An object containing details of the payloads, such as addProviderPayload and claimHandlePayload, depending\n  on the extrinsics provided.\n- `publicKey`: The public key used for signing the payloads.\n- `calls`: The list of extrinsic calls in the order that they should be submitted on-chain.\n\n### Errors\n\nThe function may throw errors of type SignupError for various failure scenarios. Possible errors include:\n\n- `InvalidSignature`: The signature provided in the extrinsic is invalid.\n- `ExpiredSignature`: The signature associated with the transaction has expired.\n- `UnsupportedExtrinsic`: The extrinsic call provided is not supported.\n- `InvalidMsaId`: The MSA ID provided does not match any valid ID in the system.\n- `SignupKeysMismatch`: The keys used to sign the signup payloads do not match.\n- `InvalidHex`: The extrinsic data is not properly hex-encoded.\n- `ApiNotReady`: The API is not ready to process the request.\n\nSee `SignupError` in [`packages/siwf/src/enums.ts`](packages/siwf/src/enums.ts) for the full list.\n\n## Signin\n\n### Example\n\n```ts\nimport { validateSignin } from '@amplica-labs/siwf';\nlet response = {\n  signIn: {\n    siwsPayload: {\n      message:\n        'localhost wants you to sign in with your Frequency account:\\n5Fghb4Wt3sg9cF6Q2Qucp5jXV5pL2U9uaYXwR9R8W8SYe9np\\n\\nThe domain localhost wants you to sign in with your Frequency account via localhost\\n\\nURI: http://localhost:5173/signin/confirm\\nNonce: N6rLwqyz34oUxJEXJ\\nIssued At: 2024-03-05T23:18:03.041Z\\nExpiration Time: 2024-03-05T23:23:03.041Z',\n      signature:\n        '0x38faa2fc6f59bef8ffccfc929fb966e1d53ba45e3af7a029ea1d636eaddcbe78a4be0f89eaf7ff7bbaef20a070ad65f9d0f876889686687ef623214fddddb18b',\n    },\n  },\n};\n\nconst providerMsaId = 1;\n\nconst api: ApiPromise = getApi();\n\nconst { publicKey, msaId } = await validateSignin(api, response.signIn, signInDomain);\n```\n\n### Return Value\n\nThe function returns a Promise that resolves to an object containing the following properties:\n\n- `publicKey`: The public key of the user that signed the payload.\n- `msaId`: The MSA Id associated with the signin and the address.\n\n### Errors\n\nThe function may throw errors of type SignupError for various failure scenarios. Possible errors include:\n\n- `InvalidMessage`: The message provided was malformed.\n- `InvalidSignature`: The signature provided in did not validate.\n- `ExpiredSignature`: The signature associated with the signin has expired.\n- `InvalidMsaId`: The MSA ID provided does not match any valid ID in the system.\n- `InvalidHex`: The signature is not properly hex-encoded.\n- `ApiNotReady`: The API is not ready to process the request.\n\nSee `SigninError` in [`packages/siwf/src/enums.ts`](packages/siwf/src/enums.ts) for the full list.\n\n## Post Validation\n\nAt this point, it is up to you to create a session following best practices.\n\nReferences for validation are live inside\n[example-app](https://github.com/AmplicaLabs/siwf/tree/main/packages/example/src/lib/components/SignInVerification.svelte)\n\n## Development Setup\n\nInstall [pnpm](https://pnpm.io/installation) Start-up local-chain\n[Frequency](https://hub.docker.com/r/dsnp/instant-seal-node-with-deployed-schemas/tags)\n\n```\npnpm install\n```\n\n#### Terminal 1\n\n```\ncd ./packages/ui\n```\n\n```\npnpm dev\n```\n\n#### Terminal 2\n\n```\ncd ./packages/example\n```\n\n```\npnpm dev\n```\n","exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.umd.cjs"}},"gitHead":"d731cd8c6de6e818aa433dc7edb099ec44b78d9d","private":false,"scripts":{},"_npmUser":{"name":"wilwade","email":"wil@wilwade.com"},"_npmVersion":"10.5.0","description":"Easy setup and validation for Sign-In With Frequency.","directories":{},"_nodeVersion":"20.12.0","dependencies":{"@polkadot/api":"^10.12.4","@talismn/siws":"^0.0.18","@polkadot/util":"^12.6.2","@polkadot/types":"^10.12.4","@polkadot/util-crypto":"^12.6.2","@dsnp/frequency-schemas":"^1.1.0","@polkadot/extension-dapp":"^0.46.6","@polkadot/extension-inject":"^0.46.6","@frequency-chain/api-augment":"^1.10.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/siwf_0.0.0-d731cd_1712073297585_0.6284016321022985","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"@amplica-labs/siwf","version":"1.0.0","license":"Apache-2.0","_id":"@amplica-labs/siwf@1.0.0","maintainers":[{"name":"wilwade","email":"wil@wilwade.com"},{"name":"scott_b_unf","email":"scott.bendar@unfinished.com"}],"dist":{"shasum":"4164a5df65a8f46108a6f1811ccf365649955065","tarball":"https://registry.npmjs.org/@amplica-labs/siwf/-/siwf-1.0.0.tgz","fileCount":37,"integrity":"sha512-E4lD1uXRd+hBvQG4pMyKR3kBvdHB4Fu80oofx+9CJ6X6XSNYXPA3ZqQFWfKeaos6zjnUJtCLJC0PxNJWRywyzA==","signatures":[{"sig":"MEUCIBae9VRikBSgvXwYfIAgc5rPPepclZF5Joptw+cBMzIhAiEAqAHBginZeeQtVI9Kl0bKyrWJ8eQzR3ktY0GnuMhdoz4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3406318},"main":"index.umd.cjs","type":"module","types":"index.d.ts","module":"index.js","exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.umd.cjs"}},"gitHead":"d731cd8c6de6e818aa433dc7edb099ec44b78d9d","private":false,"scripts":{},"_npmUser":{"name":"wilwade","email":"wil@wilwade.com"},"_npmVersion":"10.2.4","description":"Easy setup and validation for Sign-In With Frequency.","directories":{},"_nodeVersion":"20.11.1","dependencies":{"@polkadot/api":"^10.12.4","@talismn/siws":"^0.0.18","@polkadot/util":"^12.6.2","@polkadot/types":"^10.12.4","@polkadot/util-crypto":"^12.6.2","@dsnp/frequency-schemas":"^1.1.0","@polkadot/extension-dapp":"^0.46.6","@polkadot/extension-inject":"^0.46.6","@frequency-chain/api-augment":"^1.10.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/siwf_1.0.0_1712076179911_0.6014455255530065","host":"s3://npm-registry-packages"}},"0.0.0-d6ca79":{"name":"@amplica-labs/siwf","version":"0.0.0-d6ca79","license":"Apache-2.0","_id":"@amplica-labs/siwf@0.0.0-d6ca79","maintainers":[{"name":"wilwade","email":"wil@wilwade.com"},{"name":"scott_b_unf","email":"scott.bendar@unfinished.com"}],"dist":{"shasum":"f8887a82ab74dc05ee6d8f71f85f984cbe971648","tarball":"https://registry.npmjs.org/@amplica-labs/siwf/-/siwf-0.0.0-d6ca79.tgz","fileCount":36,"integrity":"sha512-bFZoagyHDMbMkPs7UDYVVmpl9JpL+o+YKlePD5hIu8xt874kn+kTk/sNQqWEoLzXKnyN3RpI8cEVinPDAdIFCQ==","signatures":[{"sig":"MEQCIBj6ZBSINJmiBI93pXvpAtchrtj0/dpO+yDIcEkw+aUtAiBIRMKNPQt8vEB5ugQbH+Sz13gOtKF2opej/Bo066Bk8w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2433008},"main":"index.cjs","type":"module","types":"index.d.ts","module":"index.js","readme":"# Sign-In With Frequency (SIWF)\n\nEasy setup and validation for Sign-In With Frequency.\n\n## Description\n\nSIWF is an application that facilitates using a selected Polkadot-compatible crypto wallet to perform sign-in and\nonboarding operations over Frequency.\n\n### Supported Operations\n\n- Sign up using Frequency\n- Sign in using Frequency\n\n## Architecture/Design\n\n### Description\n\nSIWF has two parts: a package `@amplica-labs/siwf` and a deployed web application that performs the needed UI for\nassisting the user in the action of login or onboarding. The UI also assists with interfacing with various wallets is\nachieved through interaction with either a supported browser extension (web/mobile) or an installed native app (mobile\nonly)\n\n### Data flow\n\nThis uses the emerging [Sign In With Substrate standard](https://siws.xyz/) for login and a custom system for the\nonboarding. The user/data flows will look as follows:\n\n- [Onboarding sign-up flow](./docs/signup-flow.md)\n- [Sign-in flow](./docs/login-flow.md)\n\n## Usage\n\n### Creating a Sign-up/Sign-in Button\n\n1. Install the SIWF package `npm i @amplica-labs/siwf`\n\n2. Import the `setConfig` and `getLoginOrRegistrationPayload` functions.\n3. `setConfig` is used to set the URL to the current production siwf-ui. The current deployed environment is via GitHub\n   pages at:\n\n   ```\n   https://amplicalabs.github.io/siwf/ui\n   ```\n\n   Note: For SIWF development replace with the address the local application runs on.\n\n   ```ts\n   import { type ControlPanelResponse, getLoginOrRegistrationPayload, setConfig } from '@amplica-labs/siwf';\n   setConfig({\n     // Your providerId\n     providerId: '1',\n     // The url where SIWF UI lives\n     proxyUrl: 'https://amplicalabs.github.io/siwf/ui',\n     // The Frequency RPC endpoint\n     frequencyRpcUrl: 'https://0.rpc.testnet.amplica.io',\n     siwsOptions: {\n       // The expiration for the SIWS payload.\n       expiresInMsecs: 1000,\n     },\n     // The Schema name for which permissions are being requested.\n     // A specific version of a named schema may be requested using the optional `version`\n     // attribute. Named schema versions are monotonically increasing integers, starting from 1. A\n     // value of `0` is the same as omitting the attribute and will resolve to the latest version of the\n     // named schema.\n     schemas: [\n       { name: 'public-key-key-agreement' },\n       { name: 'public-follows' },\n       { name: 'private-follows' },\n       { name: 'private-connections' },\n     ],\n   });\n   ```\n\n   A list for all the schemas DSNP supports can found\n   [in the DSNP Spec](https://spec.dsnp.org/Frequency/Overview.html?highlight=schema#dsnp-over-frequency-schemas).\n\n4. Use `getLoginOrRegistrationPayload` to get the payload from the user.\n\n```html\n<script>\n  async function handleSignInClick() {\n    const payload = await getLoginOrRegistrationPayload();\n  }\n</script>\n\n<button onclick=\"handleSignInClick()\">Get Login/Signup</button>\n```\n\nThe response from `getLoginOrRegistrationPayload`\n\n```ts\nexport type WalletProxyResponse = {\n  signIn?: SignInResponse;\n  signUp?: SignUpResponse;\n};\n```\n\n## Handling Responses\n\nThe response from the SIWF UI during sign-in may vary slightly because it's unknown at the time of invocation whether\nthe user is attempting to sign in with an identity (MSA), is a returning user to the dApp, or requires permission\ngrants.\n\n### Brand new user\n\nIn this scenario, the response indicates that the user does not possess an identity account (MSA) and has authorized the\ndApp to create one for them. This process involves assigning a unique user handle that will be linked to the new MSA\naccount after submitting transactions to Frequency.\n\nThe returned payload includes two encoded transactions (extrinsics) with signatures. One transaction creates a new MSA\nand grants the dApp the authority to act on the user's behalf (delegation), along with a specific set of permissions\n(schema permissions). The other transaction carries a signature that approves the claiming of a user handle for the\naccount.\n\n```json\n{\n  \"signUp\": {\n    \"extrinsics\": [\n      {\n        \"pallet\": \"msa\",\n        \"extrinsicName\": \"createSponsoredAccountWithDelegation\",\n        \"encodedExtrinsic\": \"0xed01043c01b01b4dcafc8a8e73bff98e7558249f53cd0e0e64fa6b8f0159f0913d4874d9360176644186458bad3b00bbd0ac21e6c9bd5a8bed9ced7a772d11a9aac025b47f6559468808e272696f596a02af230951861027c0dc30f7163ecf316838a0723483010000000000000014000000000000000000004d000000\"\n      },\n      {\n        \"pallet\": \"handles\",\n        \"extrinsicName\": \"claimHandle\",\n        \"encodedExtrinsic\": \"0xb901044200b01b4dcafc8a8e73bff98e7558249f53cd0e0e64fa6b8f0159f0913d4874d93601225508ae2da9804c60660a150277eb32b2a0f6b9c8f6e07dd6cad799cb31ae1dfb43896f488e9c0b7ec8b530d930b3f9b690683f2765d5def3fee3fc6540d58714656e6464794d000000\"\n      }\n    ]\n  }\n}\n```\n\n### Authorizes app as a delegate\n\nThis response means that an user already has an MSA. However, the user is new to this application is therefore allowing\nthe application to be added as a delegate, with permissions to the schemas requested by the application.\n\nThis response may also indicate that the user has an active delegation to the requesting application, but the\napplication is requesting additional schema permissions beyond what the user had previously authorized.\n\nTODO: This may in the future not return a signIn payload as all the information needed for validating the sign-in is\nincluded in the sign-up.\n\n```json\n{\n  \"signUp\": {\n    \"extrinsics\": [\n      {\n        \"pallet\": \"msa\",\n        \"extrinsicName\": \"grantDelegation\",\n        \"encodedExtrinsic\": \"0xc501043c03a028a10adc58e0e85c9f604e4b7c1cfe467ea25553b1fd5f19eac25a71d46d770164d9ba24677e28555d98fad2865b069fb0d51f2f45b0e86098dec272e0a5013699d17d9c86ea2c96d0e3e7a3952db232d57b1973d41fbdffcd35bdc78e21a88e0100000000000000004e000000\"\n      }\n    ]\n  },\n  \"signIn\": {\n    \"siwsPayload\": {\n      \"message\": \"localhost wants you to sign in with your Frequency account:\\n5Fghb4Wt3sg9cF6Q2Qucp5jXV5pL2U9uaYXwR9R8W8SYe9np\\n\\nThe domain localhost wants you to sign in with your Frequency account via localhost\\n\\nURI: http://localhost:5173/signin/confirm\\nNonce: N6rLwqyz34oUxJEXJ\\nIssued At: 2024-03-05T23:18:03.041Z\\nExpiration Time: 2024-03-05T23:23:03.041Z\",\n      \"signature\": \"0x38faa2fc6f59bef8ffccfc929fb966e1d53ba45e3af7a029ea1d636eaddcbe78a4be0f89eaf7ff7bbaef20a070ad65f9d0f876889686687ef623214fddddb18b\"\n    }\n  }\n}\n```\n\n### Returning User\n\nThis mean that a user has an MSA account and is a returning user to an application. This user has already granted\ndelegation and schemas permissions and is simply signing in.\n\n```json\n{\n  \"signIn\": {\n    \"siwsPayload\": {\n      \"message\": \"localhost wants you to sign in with your Frequency account:\\n5Fghb4Wt3sg9cF6Q2Qucp5jXV5pL2U9uaYXwR9R8W8SYe9np\\n\\nThe domain localhost wants you to sign in with your Frequency account via localhost\\n\\nURI: http://localhost:5173/signin/confirm\\nNonce: N6rLwqyz34oUxJEXJ\\nIssued At: 2024-03-05T23:18:03.041Z\\nExpiration Time: 2024-03-05T23:23:03.041Z\",\n      \"signature\": \"0x38faa2fc6f59bef8ffccfc929fb966e1d53ba45e3af7a029ea1d636eaddcbe78a4be0f89eaf7ff7bbaef20a070ad65f9d0f876889686687ef623214fddddb18b\"\n    }\n  }\n}\n```\n\n### User manually closes window before\n\nAn empty payload means that a user has closed the popup window before completing the sign in flow.\n\n```\n{}\n```\n\n### Response Parameters\n\nOne of two objects will have data: `signUp` or `signIn`.\n\n#### Signup\n\n`extrinsics`: An array of objects, each representing a signup extrinsic. Each extrinsic object includes:\n\n- `pallet`: The name of the pallet.\n- `extrinsicName`: The name of the extrinsic call.\n- `encodedExtrinsic`: The hex-encoded extrinsic data.\n- `providerMsaId`: The MSA ID of the provider. This ID is used to validate that permissions were granted by the correct\n  provider.\n\n#### SignIn\n\n`siwsPayload`: [Sign In With Substrate standard](https://siws.xyz/)\n\n- `message`: The text message the user signed\n- `signature`: The hex-encoded signature of the message\n\n### Validating Response\n\nIt is nessisary to check the validity of the encoded payload as well as to keep track of the expiration of the grant\ndelegation. This helps with avoiding failed transactions due to expiration of signature for granting delegation. Methods\nfor decoding a hex-encoded extrinsic can be found in the\n[Polkadot documentation](https://wiki.polkadot.network/docs/build-transaction-construction).\n\nThe `validateSignup` and `validateSignin` functions included in the `@amplica-labs/siwf` package performs validation\nparameters to ensure the integrity and correctness of the process. It verifies several critical aspects of the provided\nextrinsics or payload, including the validity and expiration of proofs, the consistency of signing keys, the format of\nencoded data, and the matching of permissions with the provider's MSA ID.\n\n## Signup\n\n### Example\n\n```ts\nimport { validateSignup } from '@amplica-labs/siwf';\nlet response = {\n  signUp: {\n    extrinsics: [\n      {\n        pallet: 'msa',\n        extrinsicName: 'grantDelegation',\n        encodedExtrinsic:\n          '0xc501043c03a028a10adc58e0e85c9f604e4b7c1cfe467ea25553b1fd5f19eac25a71d46d770164d9ba24677e28555d98fad2865b069fb0d51f2f45b0e86098dec272e0a5013699d17d9c86ea2c96d0e3e7a3952db232d57b1973d41fbdffcd35bdc78e21a88e0100000000000000004e000000',\n      },\n    ],\n  },\n};\n\nconst providerMsaId = 1;\n\nconst api: ApiPromise = getApi();\n\nconst {\n  expiration,\n  payloads: { addProviderPayload, claimHandlePayload },\n  publicKey,\n  calls,\n} = await validateSignup(api, response.signUp, providerMsaId);\n```\n\n### Return Value\n\nThe function returns a Promise that resolves to an object containing the following properties:\n\n- `expiration`: The expiration timestamp of the proof.\n- `payloads`: An object containing details of the payloads, such as addProviderPayload and claimHandlePayload, depending\n  on the extrinsics provided.\n- `publicKey`: The public key used for signing the payloads.\n- `calls`: The list of extrinsic calls in the order that they should be submitted on-chain.\n\n### Errors\n\nThe function may throw errors of type SignupError for various failure scenarios. Possible errors include:\n\n- `InvalidSignature`: The signature provided in the extrinsic is invalid.\n- `ExpiredSignature`: The signature associated with the transaction has expired.\n- `UnsupportedExtrinsic`: The extrinsic call provided is not supported.\n- `InvalidMsaId`: The MSA ID provided does not match any valid ID in the system.\n- `SignupKeysMismatch`: The keys used to sign the signup payloads do not match.\n- `InvalidHex`: The extrinsic data is not properly hex-encoded.\n- `ApiNotReady`: The API is not ready to process the request.\n\nSee `SignupError` in [`packages/siwf/src/enums.ts`](packages/siwf/src/enums.ts) for the full list.\n\n## Signin\n\n### Example\n\n```ts\nimport { validateSignin } from '@amplica-labs/siwf';\nlet response = {\n  signIn: {\n    siwsPayload: {\n      message:\n        'localhost wants you to sign in with your Frequency account:\\n5Fghb4Wt3sg9cF6Q2Qucp5jXV5pL2U9uaYXwR9R8W8SYe9np\\n\\nThe domain localhost wants you to sign in with your Frequency account via localhost\\n\\nURI: http://localhost:5173/signin/confirm\\nNonce: N6rLwqyz34oUxJEXJ\\nIssued At: 2024-03-05T23:18:03.041Z\\nExpiration Time: 2024-03-05T23:23:03.041Z',\n      signature:\n        '0x38faa2fc6f59bef8ffccfc929fb966e1d53ba45e3af7a029ea1d636eaddcbe78a4be0f89eaf7ff7bbaef20a070ad65f9d0f876889686687ef623214fddddb18b',\n    },\n  },\n};\n\nconst providerMsaId = 1;\n\nconst api: ApiPromise = getApi();\n\nconst { publicKey, msaId } = await validateSignin(api, response.signIn, signInDomain);\n```\n\n### Return Value\n\nThe function returns a Promise that resolves to an object containing the following properties:\n\n- `publicKey`: The public key of the user that signed the payload.\n- `msaId`: The MSA Id associated with the signin and the address.\n\n### Errors\n\nThe function may throw errors of type SignupError for various failure scenarios. Possible errors include:\n\n- `InvalidMessage`: The message provided was malformed.\n- `InvalidSignature`: The signature provided in did not validate.\n- `ExpiredSignature`: The signature associated with the signin has expired.\n- `InvalidMsaId`: The MSA ID provided does not match any valid ID in the system.\n- `InvalidHex`: The signature is not properly hex-encoded.\n- `ApiNotReady`: The API is not ready to process the request.\n\nSee `SigninError` in [`packages/siwf/src/enums.ts`](packages/siwf/src/enums.ts) for the full list.\n\n## Post Validation\n\nAt this point, it is up to you to create a session following best practices.\n\nReferences for validation are live inside\n[example-app](https://github.com/AmplicaLabs/siwf/tree/main/packages/example/src/lib/components/SignInVerification.svelte)\n\n## Development Setup\n\nInstall [pnpm](https://pnpm.io/installation) Start-up local-chain\n[Frequency](https://hub.docker.com/r/dsnp/instant-seal-node-with-deployed-schemas/tags)\n\n```\npnpm install\n```\n\n#### Terminal 1\n\n```\ncd ./packages/ui\n```\n\n```\npnpm dev\n```\n\n#### Terminal 2\n\n```\ncd ./packages/example\n```\n\n```\npnpm dev\n```\n","exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.cjs"}},"gitHead":"d6ca79be4f91ef0613bad67581442bfd90076f34","private":false,"scripts":{},"_npmUser":{"name":"wilwade","email":"wil@wilwade.com"},"_npmVersion":"10.5.0","description":"Easy setup and validation for Sign-In With Frequency.","directories":{},"_nodeVersion":"20.12.2","dependencies":{"@polkadot/api":"^10.12.4","@talismn/siws":"^0.0.18","@polkadot/util":"^12.6.2","@polkadot/types":"^10.12.4","@polkadot/util-crypto":"^12.6.2","@dsnp/frequency-schemas":"^1.1.0","@polkadot/extension-dapp":"^0.46.6","@polkadot/extension-inject":"^0.46.6","@frequency-chain/api-augment":"^1.10.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/siwf_0.0.0-d6ca79_1713294022979_0.6823046238389476","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@amplica-labs/siwf","version":"1.1.0","license":"Apache-2.0","_id":"@amplica-labs/siwf@1.1.0","maintainers":[{"name":"wilwade","email":"wil@wilwade.com"},{"name":"scott_b_unf","email":"scott.bendar@unfinished.com"}],"dist":{"shasum":"22cb7b22048443b15bbdebc678f1d8fb963fad3c","tarball":"https://registry.npmjs.org/@amplica-labs/siwf/-/siwf-1.1.0.tgz","fileCount":36,"integrity":"sha512-5VS5xa1gU5z96FgaUVlom6Sr7jYMH4J+39gGXYYlPytJycF8iG38ddcAnARwxfZZHLFskdICijUh1aMkpL47qA==","signatures":[{"sig":"MEYCIQCAEaD1xHaZb2wP6LpqqFPc+NRAw8K3egdzQ+G6iF4FDAIhAIBZzeZay9K93sQnaImDWluTRbXz0ez5NWLfoutgOwsa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2433001},"main":"index.cjs","type":"module","types":"index.d.ts","module":"index.js","exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.cjs"}},"gitHead":"d6ca79be4f91ef0613bad67581442bfd90076f34","private":false,"scripts":{},"_npmUser":{"name":"wilwade","email":"wil@wilwade.com"},"_npmVersion":"10.5.0","description":"Easy setup and validation for Sign-In With Frequency.","directories":{},"_nodeVersion":"20.12.1","dependencies":{"@polkadot/api":"^10.12.4","@talismn/siws":"^0.0.18","@polkadot/util":"^12.6.2","@polkadot/types":"^10.12.4","@polkadot/util-crypto":"^12.6.2","@dsnp/frequency-schemas":"^1.1.0","@polkadot/extension-dapp":"^0.46.6","@polkadot/extension-inject":"^0.46.6","@frequency-chain/api-augment":"^1.10.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/siwf_1.1.0_1713295202579_0.372040110140732","host":"s3://npm-registry-packages"}},"0.0.0-5ad901":{"name":"@amplica-labs/siwf","version":"0.0.0-5ad901","license":"Apache-2.0","_id":"@amplica-labs/siwf@0.0.0-5ad901","maintainers":[{"name":"wilwade","email":"wil@wilwade.com"},{"name":"scott_b_unf","email":"scott.bendar@unfinished.com"}],"dist":{"shasum":"a9ed512ddd63d13802784ae7c89d04033ab2d9db","tarball":"https://registry.npmjs.org/@amplica-labs/siwf/-/siwf-0.0.0-5ad901.tgz","fileCount":36,"integrity":"sha512-vu/j5onQGRMbQWiTKnXiYyUiGVDuYvLETUkiHestb7Ote/WrUNpRZskE9L63cdHwcxRtpdQzte3Yl4Shzp3RVg==","signatures":[{"sig":"MEQCIF+TmhjLP1/j38RVFbczvVEQVO99wbx19SeFSbqdENePAiAMxgD2z+vTgM3JKrpFF+l//6qeW+VF9vdu9oIMx08J/w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2433043},"main":"index.cjs","type":"module","types":"index.d.ts","module":"index.js","readme":"# Sign-In With Frequency (SIWF)\n\nEasy setup and validation for Sign-In With Frequency.\n\n## Description\n\nSIWF is an application that facilitates using a selected Polkadot-compatible crypto wallet to perform sign-in and\nonboarding operations over Frequency.\n\n### Supported Operations\n\n- Sign up using Frequency\n- Sign in using Frequency\n\n## Architecture/Design\n\n### Description\n\nSIWF has two parts: a package `@amplica-labs/siwf` and a deployed web application that performs the needed UI for\nassisting the user in the action of login or onboarding. The UI also assists with interfacing with various wallets is\nachieved through interaction with either a supported browser extension (web/mobile) or an installed native app (mobile\nonly)\n\n### Data flow\n\nThis uses the emerging [Sign In With Substrate standard](https://siws.xyz/) for login and a custom system for the\nonboarding. The user/data flows will look as follows:\n\n- [Onboarding sign-up flow](./docs/signup-flow.md)\n- [Sign-in flow](./docs/login-flow.md)\n\n## Usage\n\n### Creating a Sign-up/Sign-in Button\n\n1. Install the SIWF package `npm i @amplica-labs/siwf`\n\n2. Import the `setConfig` and `getLoginOrRegistrationPayload` functions.\n3. `setConfig` is used to set the URL to the current production siwf-ui. The current deployed environment is via GitHub\n   pages at:\n\n   ```\n   https://amplicalabs.github.io/siwf/ui\n   ```\n\n   Note: For SIWF development replace with the address the local application runs on.\n\n   ```ts\n   import { type ControlPanelResponse, getLoginOrRegistrationPayload, setConfig } from '@amplica-labs/siwf';\n   setConfig({\n     // Your providerId\n     providerId: '1',\n     // The url where SIWF UI lives\n     proxyUrl: 'https://amplicalabs.github.io/siwf/ui',\n     // The Frequency RPC endpoint\n     frequencyRpcUrl: 'https://0.rpc.testnet.amplica.io',\n     siwsOptions: {\n       // The expiration for the SIWS payload.\n       expiresInMsecs: 1000,\n     },\n     // The Schema name for which permissions are being requested.\n     // A specific version of a named schema may be requested using the optional `version`\n     // attribute. Named schema versions are monotonically increasing integers, starting from 1. A\n     // value of `0` is the same as omitting the attribute and will resolve to the latest version of the\n     // named schema.\n     schemas: [\n       { name: 'public-key-key-agreement' },\n       { name: 'public-follows' },\n       { name: 'private-follows' },\n       { name: 'private-connections' },\n     ],\n   });\n   ```\n\n   A list for all the schemas DSNP supports can found\n   [in the DSNP Spec](https://spec.dsnp.org/Frequency/Overview.html?highlight=schema#dsnp-over-frequency-schemas).\n\n4. Use `getLoginOrRegistrationPayload` to get the payload from the user.\n\n```html\n<script>\n  async function handleSignInClick() {\n    const payload = await getLoginOrRegistrationPayload();\n  }\n</script>\n\n<button onclick=\"handleSignInClick()\">Get Login/Signup</button>\n```\n\nThe response from `getLoginOrRegistrationPayload`\n\n```ts\nexport type WalletProxyResponse = {\n  signIn?: SignInResponse;\n  signUp?: SignUpResponse;\n};\n```\n\n## Handling Responses\n\nThe response from the SIWF UI during sign-in may vary slightly because it's unknown at the time of invocation whether\nthe user is attempting to sign in with an identity (MSA), is a returning user to the dApp, or requires permission\ngrants.\n\n### Brand new user\n\nIn this scenario, the response indicates that the user does not possess an identity account (MSA) and has authorized the\ndApp to create one for them. This process involves assigning a unique user handle that will be linked to the new MSA\naccount after submitting transactions to Frequency.\n\nThe returned payload includes two encoded transactions (extrinsics) with signatures. One transaction creates a new MSA\nand grants the dApp the authority to act on the user's behalf (delegation), along with a specific set of permissions\n(schema permissions). The other transaction carries a signature that approves the claiming of a user handle for the\naccount.\n\n```json\n{\n  \"signUp\": {\n    \"extrinsics\": [\n      {\n        \"pallet\": \"msa\",\n        \"extrinsicName\": \"createSponsoredAccountWithDelegation\",\n        \"encodedExtrinsic\": \"0xed01043c01b01b4dcafc8a8e73bff98e7558249f53cd0e0e64fa6b8f0159f0913d4874d9360176644186458bad3b00bbd0ac21e6c9bd5a8bed9ced7a772d11a9aac025b47f6559468808e272696f596a02af230951861027c0dc30f7163ecf316838a0723483010000000000000014000000000000000000004d000000\"\n      },\n      {\n        \"pallet\": \"handles\",\n        \"extrinsicName\": \"claimHandle\",\n        \"encodedExtrinsic\": \"0xb901044200b01b4dcafc8a8e73bff98e7558249f53cd0e0e64fa6b8f0159f0913d4874d93601225508ae2da9804c60660a150277eb32b2a0f6b9c8f6e07dd6cad799cb31ae1dfb43896f488e9c0b7ec8b530d930b3f9b690683f2765d5def3fee3fc6540d58714656e6464794d000000\"\n      }\n    ]\n  }\n}\n```\n\n### Authorizes app as a delegate\n\nThis response means that an user already has an MSA. However, the user is new to this application is therefore allowing\nthe application to be added as a delegate, with permissions to the schemas requested by the application.\n\nThis response may also indicate that the user has an active delegation to the requesting application, but the\napplication is requesting additional schema permissions beyond what the user had previously authorized.\n\nTODO: This may in the future not return a signIn payload as all the information needed for validating the sign-in is\nincluded in the sign-up.\n\n```json\n{\n  \"signUp\": {\n    \"extrinsics\": [\n      {\n        \"pallet\": \"msa\",\n        \"extrinsicName\": \"grantDelegation\",\n        \"encodedExtrinsic\": \"0xc501043c03a028a10adc58e0e85c9f604e4b7c1cfe467ea25553b1fd5f19eac25a71d46d770164d9ba24677e28555d98fad2865b069fb0d51f2f45b0e86098dec272e0a5013699d17d9c86ea2c96d0e3e7a3952db232d57b1973d41fbdffcd35bdc78e21a88e0100000000000000004e000000\"\n      }\n    ]\n  },\n  \"signIn\": {\n    \"siwsPayload\": {\n      \"message\": \"localhost wants you to sign in with your Frequency account:\\n5Fghb4Wt3sg9cF6Q2Qucp5jXV5pL2U9uaYXwR9R8W8SYe9np\\n\\nThe domain localhost wants you to sign in with your Frequency account via localhost\\n\\nURI: http://localhost:5173/signin/confirm\\nNonce: N6rLwqyz34oUxJEXJ\\nIssued At: 2024-03-05T23:18:03.041Z\\nExpiration Time: 2024-03-05T23:23:03.041Z\",\n      \"signature\": \"0x38faa2fc6f59bef8ffccfc929fb966e1d53ba45e3af7a029ea1d636eaddcbe78a4be0f89eaf7ff7bbaef20a070ad65f9d0f876889686687ef623214fddddb18b\"\n    }\n  }\n}\n```\n\n### Returning User\n\nThis mean that a user has an MSA account and is a returning user to an application. This user has already granted\ndelegation and schemas permissions and is simply signing in.\n\n```json\n{\n  \"signIn\": {\n    \"siwsPayload\": {\n      \"message\": \"localhost wants you to sign in with your Frequency account:\\n5Fghb4Wt3sg9cF6Q2Qucp5jXV5pL2U9uaYXwR9R8W8SYe9np\\n\\nThe domain localhost wants you to sign in with your Frequency account via localhost\\n\\nURI: http://localhost:5173/signin/confirm\\nNonce: N6rLwqyz34oUxJEXJ\\nIssued At: 2024-03-05T23:18:03.041Z\\nExpiration Time: 2024-03-05T23:23:03.041Z\",\n      \"signature\": \"0x38faa2fc6f59bef8ffccfc929fb966e1d53ba45e3af7a029ea1d636eaddcbe78a4be0f89eaf7ff7bbaef20a070ad65f9d0f876889686687ef623214fddddb18b\"\n    }\n  }\n}\n```\n\n### User manually closes window before\n\nAn empty payload means that a user has closed the popup window before completing the sign in flow.\n\n```\n{}\n```\n\n### Response Parameters\n\nOne of two objects will have data: `signUp` or `signIn`.\n\n#### Signup\n\n`extrinsics`: An array of objects, each representing a signup extrinsic. Each extrinsic object includes:\n\n- `pallet`: The name of the pallet.\n- `extrinsicName`: The name of the extrinsic call.\n- `encodedExtrinsic`: The hex-encoded extrinsic data.\n- `providerMsaId`: The MSA ID of the provider. This ID is used to validate that permissions were granted by the correct\n  provider.\n\n#### SignIn\n\n`siwsPayload`: [Sign In With Substrate standard](https://siws.xyz/)\n\n- `message`: The text message the user signed\n- `signature`: The hex-encoded signature of the message\n\n### Validating Response\n\nIt is nessisary to check the validity of the encoded payload as well as to keep track of the expiration of the grant\ndelegation. This helps with avoiding failed transactions due to expiration of signature for granting delegation. Methods\nfor decoding a hex-encoded extrinsic can be found in the\n[Polkadot documentation](https://wiki.polkadot.network/docs/build-transaction-construction).\n\nThe `validateSignup` and `validateSignin` functions included in the `@amplica-labs/siwf` package performs validation\nparameters to ensure the integrity and correctness of the process. It verifies several critical aspects of the provided\nextrinsics or payload, including the validity and expiration of proofs, the consistency of signing keys, the format of\nencoded data, and the matching of permissions with the provider's MSA ID.\n\n## Signup\n\n### Example\n\n```ts\nimport { validateSignup } from '@amplica-labs/siwf';\nlet response = {\n  signUp: {\n    extrinsics: [\n      {\n        pallet: 'msa',\n        extrinsicName: 'grantDelegation',\n        encodedExtrinsic:\n          '0xc501043c03a028a10adc58e0e85c9f604e4b7c1cfe467ea25553b1fd5f19eac25a71d46d770164d9ba24677e28555d98fad2865b069fb0d51f2f45b0e86098dec272e0a5013699d17d9c86ea2c96d0e3e7a3952db232d57b1973d41fbdffcd35bdc78e21a88e0100000000000000004e000000',\n      },\n    ],\n  },\n};\n\nconst providerMsaId = 1;\n\nconst api: ApiPromise = getApi();\n\nconst {\n  expiration,\n  payloads: { addProviderPayload, claimHandlePayload },\n  publicKey,\n  calls,\n} = await validateSignup(api, response.signUp, providerMsaId);\n```\n\n### Return Value\n\nThe function returns a Promise that resolves to an object containing the following properties:\n\n- `expiration`: The expiration timestamp of the proof.\n- `payloads`: An object containing details of the payloads, such as addProviderPayload and claimHandlePayload, depending\n  on the extrinsics provided.\n- `publicKey`: The public key used for signing the payloads.\n- `calls`: The list of extrinsic calls in the order that they should be submitted on-chain.\n\n### Errors\n\nThe function may throw errors of type SignupError for various failure scenarios. Possible errors include:\n\n- `InvalidSignature`: The signature provided in the extrinsic is invalid.\n- `ExpiredSignature`: The signature associated with the transaction has expired.\n- `UnsupportedExtrinsic`: The extrinsic call provided is not supported.\n- `InvalidMsaId`: The MSA ID provided does not match any valid ID in the system.\n- `SignupKeysMismatch`: The keys used to sign the signup payloads do not match.\n- `InvalidHex`: The extrinsic data is not properly hex-encoded.\n- `ApiNotReady`: The API is not ready to process the request.\n\nSee `SignupError` in [`packages/siwf/src/enums.ts`](packages/siwf/src/enums.ts) for the full list.\n\n## Signin\n\n### Example\n\n```ts\nimport { validateSignin } from '@amplica-labs/siwf';\nlet response = {\n  signIn: {\n    siwsPayload: {\n      message:\n        'localhost wants you to sign in with your Frequency account:\\n5Fghb4Wt3sg9cF6Q2Qucp5jXV5pL2U9uaYXwR9R8W8SYe9np\\n\\nThe domain localhost wants you to sign in with your Frequency account via localhost\\n\\nURI: http://localhost:5173/signin/confirm\\nNonce: N6rLwqyz34oUxJEXJ\\nIssued At: 2024-03-05T23:18:03.041Z\\nExpiration Time: 2024-03-05T23:23:03.041Z',\n      signature:\n        '0x38faa2fc6f59bef8ffccfc929fb966e1d53ba45e3af7a029ea1d636eaddcbe78a4be0f89eaf7ff7bbaef20a070ad65f9d0f876889686687ef623214fddddb18b',\n    },\n  },\n};\n\nconst providerMsaId = 1;\n\nconst api: ApiPromise = getApi();\n\nconst { publicKey, msaId } = await validateSignin(api, response.signIn, signInDomain);\n```\n\n### Return Value\n\nThe function returns a Promise that resolves to an object containing the following properties:\n\n- `publicKey`: The public key of the user that signed the payload.\n- `msaId`: The MSA Id associated with the signin and the address.\n\n### Errors\n\nThe function may throw errors of type SignupError for various failure scenarios. Possible errors include:\n\n- `InvalidMessage`: The message provided was malformed.\n- `InvalidSignature`: The signature provided in did not validate.\n- `ExpiredSignature`: The signature associated with the signin has expired.\n- `InvalidMsaId`: The MSA ID provided does not match any valid ID in the system.\n- `InvalidHex`: The signature is not properly hex-encoded.\n- `ApiNotReady`: The API is not ready to process the request.\n\nSee `SigninError` in [`packages/siwf/src/enums.ts`](packages/siwf/src/enums.ts) for the full list.\n\n## Post Validation\n\nAt this point, it is up to you to create a session following best practices.\n\nReferences for validation are live inside\n[example-app](https://github.com/AmplicaLabs/siwf/tree/main/packages/example/src/lib/components/SignInVerification.svelte)\n\n## Development Setup\n\nInstall [pnpm](https://pnpm.io/installation) Start-up local-chain\n[Frequency](https://hub.docker.com/r/dsnp/instant-seal-node-with-deployed-schemas/tags)\n\n```\npnpm install\n```\n\n#### Terminal 1\n\n```\ncd ./packages/ui\n```\n\n```\npnpm dev\n```\n\n#### Terminal 2\n\n```\ncd ./packages/example\n```\n\n```\npnpm dev\n```\n","exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.cjs"}},"gitHead":"5ad901bdfa60fd5277a06c5346fef78066ed2095","private":false,"scripts":{},"_npmUser":{"name":"wilwade","email":"wil@wilwade.com"},"_npmVersion":"10.5.0","description":"Easy setup and validation for Sign-In With Frequency.","directories":{},"_nodeVersion":"20.12.2","dependencies":{"@polkadot/api":"^10.12.4","@talismn/siws":"^0.0.18","@polkadot/util":"^12.6.2","@polkadot/types":"^10.12.4","@polkadot/util-crypto":"^12.6.2","@dsnp/frequency-schemas":"^1.1.0","@polkadot/extension-dapp":"^0.46.9","@polkadot/extension-inject":"^0.46.9","@frequency-chain/api-augment":"^1.11.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/siwf_0.0.0-5ad901_1713367201404_0.9801218273959384","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"@amplica-labs/siwf","version":"1.1.1","license":"Apache-2.0","_id":"@amplica-labs/siwf@1.1.1","maintainers":[{"name":"wilwade","email":"wil@wilwade.com"},{"name":"scott_b_unf","email":"scott.bendar@unfinished.com"}],"dist":{"shasum":"a7838a6a5ea2b0f5ce6810675fc1d314f3a9441b","tarball":"https://registry.npmjs.org/@amplica-labs/siwf/-/siwf-1.1.1.tgz","fileCount":36,"integrity":"sha512-srUiz4YqjlR1XsWmmbBIxgOV7o8a2+4XBfgpSwYBpdZUGDh8AK/RfdZgNztekCd4luj66tZ7EJ5jAWsSxACryw==","signatures":[{"sig":"MEUCIQCOkiHgYmZG8lCeJ9XTR20Da+iyvYLZX9QIRVWj0Sld1QIgEvUTNRsQmQh+uDDV0F8jiIDVn8AKtY0alQUSQmiBqcs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2433036},"main":"index.cjs","type":"module","types":"index.d.ts","module":"index.js","exports":{".":{"types":"./index.d.ts","import":"./index.js","default":"./index.js","require":"./index.cjs"}},"gitHead":"5ad901bdfa60fd5277a06c5346fef78066ed2095","private":false,"scripts":{},"_npmUser":{"name":"wilwade","email":"wil@wilwade.com"},"_npmVersion":"10.5.0","description":"Easy setup and validation for Sign-In With Frequency.","directories":{},"_nodeVersion":"20.12.2","dependencies":{"@polkadot/api":"^10.12.4","@talismn/siws":"^0.0.18","@polkadot/util":"^12.6.2","@polkadot/types":"^10.12.4","@polkadot/util-crypto":"^12.6.2","@dsnp/frequency-schemas":"^1.1.0","@polkadot/extension-dapp":"^0.46.9","@polkadot/extension-inject":"^0.46.9","@frequency-chain/api-augment":"^1.11.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/siwf_1.1.1_1713367229075_0.013706625940407058","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-04-01T18:55:07.012Z","modified":"2025-09-03T19:05:56.123Z","0.0.0-06d7fc":"2024-04-01T18:55:07.421Z","0.0.0-d731cd":"2024-04-02T15:54:57.893Z","1.0.0":"2024-04-02T16:43:00.160Z","0.0.0-d6ca79":"2024-04-16T19:00:23.166Z","1.1.0":"2024-04-16T19:20:02.837Z","0.0.0-5ad901":"2024-04-17T15:20:01.640Z","1.1.1":"2024-04-17T15:20:29.272Z"},"license":"Apache-2.0","description":"Easy setup and validation for Sign-In With Frequency.","maintainers":[{"email":"scott.bendar@unfinished.com","name":"scott_b_unf"}],"readme":"# Sign-In With Frequency (SIWF)\n\nEasy setup and validation for Sign-In With Frequency.\n\n## Description\n\nSIWF is an application that facilitates using a selected Polkadot-compatible crypto wallet to perform sign-in and\nonboarding operations over Frequency.\n\n### Supported Operations\n\n- Sign up using Frequency\n- Sign in using Frequency\n\n## Architecture/Design\n\n### Description\n\nSIWF has two parts: a package `@amplica-labs/siwf` and a deployed web application that performs the needed UI for\nassisting the user in the action of login or onboarding. The UI also assists with interfacing with various wallets is\nachieved through interaction with either a supported browser extension (web/mobile) or an installed native app (mobile\nonly)\n\n### Data flow\n\nThis uses the emerging [Sign In With Substrate standard](https://siws.xyz/) for login and a custom system for the\nonboarding. The user/data flows will look as follows:\n\n- [Onboarding sign-up flow](./docs/signup-flow.md)\n- [Sign-in flow](./docs/login-flow.md)\n\n## Usage\n\n### Creating a Sign-up/Sign-in Button\n\n1. Install the SIWF package `npm i @amplica-labs/siwf`\n\n2. Import the `setConfig` and `getLoginOrRegistrationPayload` functions.\n3. `setConfig` is used to set the URL to the current production siwf-ui. The current deployed environment is via GitHub\n   pages at:\n\n   ```\n   https://amplicalabs.github.io/siwf/ui\n   ```\n\n   Note: For SIWF development replace with the address the local application runs on.\n\n   ```ts\n   import { type ControlPanelResponse, getLoginOrRegistrationPayload, setConfig } from '@amplica-labs/siwf';\n   setConfig({\n     // Your providerId\n     providerId: '1',\n     // The url where SIWF UI lives\n     proxyUrl: 'https://amplicalabs.github.io/siwf/ui',\n     // The Frequency RPC endpoint\n     frequencyRpcUrl: 'https://0.rpc.testnet.amplica.io',\n     siwsOptions: {\n       // The expiration for the SIWS payload.\n       expiresInMsecs: 1000,\n     },\n     // The Schema name for which permissions are being requested.\n     // A specific version of a named schema may be requested using the optional `version`\n     // attribute. Named schema versions are monotonically increasing integers, starting from 1. A\n     // value of `0` is the same as omitting the attribute and will resolve to the latest version of the\n     // named schema.\n     schemas: [\n       { name: 'public-key-key-agreement' },\n       { name: 'public-follows' },\n       { name: 'private-follows' },\n       { name: 'private-connections' },\n     ],\n   });\n   ```\n\n   A list for all the schemas DSNP supports can found\n   [in the DSNP Spec](https://spec.dsnp.org/Frequency/Overview.html?highlight=schema#dsnp-over-frequency-schemas).\n\n4. Use `getLoginOrRegistrationPayload` to get the payload from the user.\n\n```html\n<script>\n  async function handleSignInClick() {\n    const payload = await getLoginOrRegistrationPayload();\n  }\n</script>\n\n<button onclick=\"handleSignInClick()\">Get Login/Signup</button>\n```\n\nThe response from `getLoginOrRegistrationPayload`\n\n```ts\nexport type WalletProxyResponse = {\n  signIn?: SignInResponse;\n  signUp?: SignUpResponse;\n};\n```\n\n## Handling Responses\n\nThe response from the SIWF UI during sign-in may vary slightly because it's unknown at the time of invocation whether\nthe user is attempting to sign in with an identity (MSA), is a returning user to the dApp, or requires permission\ngrants.\n\n### Brand new user\n\nIn this scenario, the response indicates that the user does not possess an identity account (MSA) and has authorized the\ndApp to create one for them. This process involves assigning a unique user handle that will be linked to the new MSA\naccount after submitting transactions to Frequency.\n\nThe returned payload includes two encoded transactions (extrinsics) with signatures. One transaction creates a new MSA\nand grants the dApp the authority to act on the user's behalf (delegation), along with a specific set of permissions\n(schema permissions). The other transaction carries a signature that approves the claiming of a user handle for the\naccount.\n\n```json\n{\n  \"signUp\": {\n    \"extrinsics\": [\n      {\n        \"pallet\": \"msa\",\n        \"extrinsicName\": \"createSponsoredAccountWithDelegation\",\n        \"encodedExtrinsic\": \"0xed01043c01b01b4dcafc8a8e73bff98e7558249f53cd0e0e64fa6b8f0159f0913d4874d9360176644186458bad3b00bbd0ac21e6c9bd5a8bed9ced7a772d11a9aac025b47f6559468808e272696f596a02af230951861027c0dc30f7163ecf316838a0723483010000000000000014000000000000000000004d000000\"\n      },\n      {\n        \"pallet\": \"handles\",\n        \"extrinsicName\": \"claimHandle\",\n        \"encodedExtrinsic\": \"0xb901044200b01b4dcafc8a8e73bff98e7558249f53cd0e0e64fa6b8f0159f0913d4874d93601225508ae2da9804c60660a150277eb32b2a0f6b9c8f6e07dd6cad799cb31ae1dfb43896f488e9c0b7ec8b530d930b3f9b690683f2765d5def3fee3fc6540d58714656e6464794d000000\"\n      }\n    ]\n  }\n}\n```\n\n### Authorizes app as a delegate\n\nThis response means that an user already has an MSA. However, the user is new to this application is therefore allowing\nthe application to be added as a delegate, with permissions to the schemas requested by the application.\n\nThis response may also indicate that the user has an active delegation to the requesting application, but the\napplication is requesting additional schema permissions beyond what the user had previously authorized.\n\nTODO: This may in the future not return a signIn payload as all the information needed for validating the sign-in is\nincluded in the sign-up.\n\n```json\n{\n  \"signUp\": {\n    \"extrinsics\": [\n      {\n        \"pallet\": \"msa\",\n        \"extrinsicName\": \"grantDelegation\",\n        \"encodedExtrinsic\": \"0xc501043c03a028a10adc58e0e85c9f604e4b7c1cfe467ea25553b1fd5f19eac25a71d46d770164d9ba24677e28555d98fad2865b069fb0d51f2f45b0e86098dec272e0a5013699d17d9c86ea2c96d0e3e7a3952db232d57b1973d41fbdffcd35bdc78e21a88e0100000000000000004e000000\"\n      }\n    ]\n  },\n  \"signIn\": {\n    \"siwsPayload\": {\n      \"message\": \"localhost wants you to sign in with your Frequency account:\\n5Fghb4Wt3sg9cF6Q2Qucp5jXV5pL2U9uaYXwR9R8W8SYe9np\\n\\nThe domain localhost wants you to sign in with your Frequency account via localhost\\n\\nURI: http://localhost:5173/signin/confirm\\nNonce: N6rLwqyz34oUxJEXJ\\nIssued At: 2024-03-05T23:18:03.041Z\\nExpiration Time: 2024-03-05T23:23:03.041Z\",\n      \"signature\": \"0x38faa2fc6f59bef8ffccfc929fb966e1d53ba45e3af7a029ea1d636eaddcbe78a4be0f89eaf7ff7bbaef20a070ad65f9d0f876889686687ef623214fddddb18b\"\n    }\n  }\n}\n```\n\n### Returning User\n\nThis mean that a user has an MSA account and is a returning user to an application. This user has already granted\ndelegation and schemas permissions and is simply signing in.\n\n```json\n{\n  \"signIn\": {\n    \"siwsPayload\": {\n      \"message\": \"localhost wants you to sign in with your Frequency account:\\n5Fghb4Wt3sg9cF6Q2Qucp5jXV5pL2U9uaYXwR9R8W8SYe9np\\n\\nThe domain localhost wants you to sign in with your Frequency account via localhost\\n\\nURI: http://localhost:5173/signin/confirm\\nNonce: N6rLwqyz34oUxJEXJ\\nIssued At: 2024-03-05T23:18:03.041Z\\nExpiration Time: 2024-03-05T23:23:03.041Z\",\n      \"signature\": \"0x38faa2fc6f59bef8ffccfc929fb966e1d53ba45e3af7a029ea1d636eaddcbe78a4be0f89eaf7ff7bbaef20a070ad65f9d0f876889686687ef623214fddddb18b\"\n    }\n  }\n}\n```\n\n### User manually closes window before\n\nAn empty payload means that a user has closed the popup window before completing the sign in flow.\n\n```\n{}\n```\n\n### Response Parameters\n\nOne of two objects will have data: `signUp` or `signIn`.\n\n#### Signup\n\n`extrinsics`: An array of objects, each representing a signup extrinsic. Each extrinsic object includes:\n\n- `pallet`: The name of the pallet.\n- `extrinsicName`: The name of the extrinsic call.\n- `encodedExtrinsic`: The hex-encoded extrinsic data.\n- `providerMsaId`: The MSA ID of the provider. This ID is used to validate that permissions were granted by the correct\n  provider.\n\n#### SignIn\n\n`siwsPayload`: [Sign In With Substrate standard](https://siws.xyz/)\n\n- `message`: The text message the user signed\n- `signature`: The hex-encoded signature of the message\n\n### Validating Response\n\nIt is nessisary to check the validity of the encoded payload as well as to keep track of the expiration of the grant\ndelegation. This helps with avoiding failed transactions due to expiration of signature for granting delegation. Methods\nfor decoding a hex-encoded extrinsic can be found in the\n[Polkadot documentation](https://wiki.polkadot.network/docs/build-transaction-construction).\n\nThe `validateSignup` and `validateSignin` functions included in the `@amplica-labs/siwf` package performs validation\nparameters to ensure the integrity and correctness of the process. It verifies several critical aspects of the provided\nextrinsics or payload, including the validity and expiration of proofs, the consistency of signing keys, the format of\nencoded data, and the matching of permissions with the provider's MSA ID.\n\n## Signup\n\n### Example\n\n```ts\nimport { validateSignup } from '@amplica-labs/siwf';\nlet response = {\n  signUp: {\n    extrinsics: [\n      {\n        pallet: 'msa',\n        extrinsicName: 'grantDelegation',\n        encodedExtrinsic:\n          '0xc501043c03a028a10adc58e0e85c9f604e4b7c1cfe467ea25553b1fd5f19eac25a71d46d770164d9ba24677e28555d98fad2865b069fb0d51f2f45b0e86098dec272e0a5013699d17d9c86ea2c96d0e3e7a3952db232d57b1973d41fbdffcd35bdc78e21a88e0100000000000000004e000000',\n      },\n    ],\n  },\n};\n\nconst providerMsaId = 1;\n\nconst api: ApiPromise = getApi();\n\nconst {\n  expiration,\n  payloads: { addProviderPayload, claimHandlePayload },\n  publicKey,\n  calls,\n} = await validateSignup(api, response.signUp, providerMsaId);\n```\n\n### Return Value\n\nThe function returns a Promise that resolves to an object containing the following properties:\n\n- `expiration`: The expiration timestamp of the proof.\n- `payloads`: An object containing details of the payloads, such as addProviderPayload and claimHandlePayload, depending\n  on the extrinsics provided.\n- `publicKey`: The public key used for signing the payloads.\n- `calls`: The list of extrinsic calls in the order that they should be submitted on-chain.\n\n### Errors\n\nThe function may throw errors of type SignupError for various failure scenarios. Possible errors include:\n\n- `InvalidSignature`: The signature provided in the extrinsic is invalid.\n- `ExpiredSignature`: The signature associated with the transaction has expired.\n- `UnsupportedExtrinsic`: The extrinsic call provided is not supported.\n- `InvalidMsaId`: The MSA ID provided does not match any valid ID in the system.\n- `SignupKeysMismatch`: The keys used to sign the signup payloads do not match.\n- `InvalidHex`: The extrinsic data is not properly hex-encoded.\n- `ApiNotReady`: The API is not ready to process the request.\n\nSee `SignupError` in [`packages/siwf/src/enums.ts`](packages/siwf/src/enums.ts) for the full list.\n\n## Signin\n\n### Example\n\n```ts\nimport { validateSignin } from '@amplica-labs/siwf';\nlet response = {\n  signIn: {\n    siwsPayload: {\n      message:\n        'localhost wants you to sign in with your Frequency account:\\n5Fghb4Wt3sg9cF6Q2Qucp5jXV5pL2U9uaYXwR9R8W8SYe9np\\n\\nThe domain localhost wants you to sign in with your Frequency account via localhost\\n\\nURI: http://localhost:5173/signin/confirm\\nNonce: N6rLwqyz34oUxJEXJ\\nIssued At: 2024-03-05T23:18:03.041Z\\nExpiration Time: 2024-03-05T23:23:03.041Z',\n      signature:\n        '0x38faa2fc6f59bef8ffccfc929fb966e1d53ba45e3af7a029ea1d636eaddcbe78a4be0f89eaf7ff7bbaef20a070ad65f9d0f876889686687ef623214fddddb18b',\n    },\n  },\n};\n\nconst providerMsaId = 1;\n\nconst api: ApiPromise = getApi();\n\nconst { publicKey, msaId } = await validateSignin(api, response.signIn, signInDomain);\n```\n\n### Return Value\n\nThe function returns a Promise that resolves to an object containing the following properties:\n\n- `publicKey`: The public key of the user that signed the payload.\n- `msaId`: The MSA Id associated with the signin and the address.\n\n### Errors\n\nThe function may throw errors of type SignupError for various failure scenarios. Possible errors include:\n\n- `InvalidMessage`: The message provided was malformed.\n- `InvalidSignature`: The signature provided in did not validate.\n- `ExpiredSignature`: The signature associated with the signin has expired.\n- `InvalidMsaId`: The MSA ID provided does not match any valid ID in the system.\n- `InvalidHex`: The signature is not properly hex-encoded.\n- `ApiNotReady`: The API is not ready to process the request.\n\nSee `SigninError` in [`packages/siwf/src/enums.ts`](packages/siwf/src/enums.ts) for the full list.\n\n## Post Validation\n\nAt this point, it is up to you to create a session following best practices.\n\nReferences for validation are live inside\n[example-app](https://github.com/AmplicaLabs/siwf/tree/main/packages/example/src/lib/components/SignInVerification.svelte)\n\n## Development Setup\n\nInstall [pnpm](https://pnpm.io/installation) Start-up local-chain\n[Frequency](https://hub.docker.com/r/dsnp/instant-seal-node-with-deployed-schemas/tags)\n\n```\npnpm install\n```\n\n#### Terminal 1\n\n```\ncd ./packages/ui\n```\n\n```\npnpm dev\n```\n\n#### Terminal 2\n\n```\ncd ./packages/example\n```\n\n```\npnpm dev\n```\n","readmeFilename":"README.md"}