@opendatalabs/vana-sdk 3.0.0 → 3.0.1-pr.147.a4abdb1
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/dist/account/personal-server-lite-owner-binding.cjs +81 -0
- package/dist/account/personal-server-lite-owner-binding.cjs.map +1 -0
- package/dist/account/personal-server-lite-owner-binding.d.ts +30 -0
- package/dist/account/personal-server-lite-owner-binding.js +59 -0
- package/dist/account/personal-server-lite-owner-binding.js.map +1 -0
- package/dist/account/personal-server-lite-owner-binding.test.d.ts +1 -0
- package/dist/account/personal-server-registration.cjs +196 -0
- package/dist/account/personal-server-registration.cjs.map +1 -0
- package/dist/account/personal-server-registration.d.ts +66 -0
- package/dist/account/personal-server-registration.js +172 -0
- package/dist/account/personal-server-registration.js.map +1 -0
- package/dist/account/personal-server-registration.test.d.ts +1 -0
- package/dist/auth/web3-signed.cjs +28 -3
- package/dist/auth/web3-signed.cjs.map +1 -1
- package/dist/auth/web3-signed.js +28 -3
- package/dist/auth/web3-signed.js.map +1 -1
- package/dist/index.browser.d.ts +5 -0
- package/dist/index.browser.js +562 -16
- package/dist/index.browser.js.map +4 -4
- package/dist/index.node.cjs +580 -16
- package/dist/index.node.cjs.map +4 -4
- package/dist/index.node.d.ts +5 -0
- package/dist/index.node.js +562 -16
- package/dist/index.node.js.map +4 -4
- package/dist/protocol/eip712.cjs.map +1 -1
- package/dist/protocol/eip712.d.ts +1 -1
- package/dist/protocol/eip712.js.map +1 -1
- package/dist/protocol/grants.cjs +146 -0
- package/dist/protocol/grants.cjs.map +1 -0
- package/dist/protocol/grants.d.ts +31 -0
- package/dist/protocol/grants.js +123 -0
- package/dist/protocol/grants.js.map +1 -0
- package/dist/protocol/grants.test.d.ts +1 -0
- package/dist/protocol/personal-server-lite-owner-binding.cjs +93 -0
- package/dist/protocol/personal-server-lite-owner-binding.cjs.map +1 -0
- package/dist/protocol/personal-server-lite-owner-binding.d.ts +44 -0
- package/dist/protocol/personal-server-lite-owner-binding.js +65 -0
- package/dist/protocol/personal-server-lite-owner-binding.js.map +1 -0
- package/dist/protocol/personal-server-lite-owner-binding.test.d.ts +1 -0
- package/dist/protocol/personal-server-registration.cjs +122 -0
- package/dist/protocol/personal-server-registration.cjs.map +1 -0
- package/dist/protocol/personal-server-registration.d.ts +62 -0
- package/dist/protocol/personal-server-registration.js +97 -0
- package/dist/protocol/personal-server-registration.js.map +1 -0
- package/dist/protocol/personal-server-registration.test.d.ts +1 -0
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/providers/vana-storage.cjs +1 -1
- package/dist/storage/providers/vana-storage.cjs.map +1 -1
- package/dist/storage/providers/vana-storage.d.ts +2 -2
- package/dist/storage/providers/vana-storage.js +1 -1
- package/dist/storage/providers/vana-storage.js.map +1 -1
- package/dist/types/ps-errors.cjs +37 -12
- package/dist/types/ps-errors.cjs.map +1 -1
- package/dist/types/ps-errors.d.ts +7 -6
- package/dist/types/ps-errors.js +37 -12
- package/dist/types/ps-errors.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/protocol/eip712.ts"],"sourcesContent":["/**\n * EIP-712 domain and type builders for Data Portability protocol writes.\n *\n * These helpers are shared primitives only. Personal Server runtimes own when\n * to sign and submit these payloads.\n *\n * @category Protocol\n */\n\nimport type { TypedDataDomain } from \"viem\";\n\nconst DOMAIN_NAME = \"Vana Data Portability\";\nconst DOMAIN_VERSION = \"1\";\n\nexport interface DataPortabilityContracts {\n dataRegistry: string;\n dataPortabilityPermissions: string;\n dataPortabilityServer: string;\n dataPortabilityGrantees: string;\n}\n\nexport interface DataPortabilityGatewayConfig {\n chainId: number;\n contracts: DataPortabilityContracts;\n}\n\nfunction buildDomain(\n chainId: number,\n verifyingContract: `0x${string}`,\n): TypedDataDomain {\n return {\n name: DOMAIN_NAME,\n version: DOMAIN_VERSION,\n chainId,\n verifyingContract,\n };\n}\n\nexport function fileRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataRegistry as `0x${string}`,\n );\n}\n\nexport function grantRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function grantRevocationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function serverRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityServer as `0x${string}`,\n );\n}\n\nexport function builderRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityGrantees as `0x${string}`,\n );\n}\n\nexport const FILE_REGISTRATION_TYPES = {\n FileRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"url\", type: \"string\" },\n { name: \"schemaId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport const GRANT_REGISTRATION_TYPES = {\n GrantRegistration: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"granteeId\", type: \"bytes32\" },\n { name: \"grant\", type: \"string\" },\n { name: \"fileIds\", type: \"uint256[]\" },\n ],\n} as const;\n\nexport const GRANT_REVOCATION_TYPES = {\n GrantRevocation: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"grantId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport const SERVER_REGISTRATION_TYPES = {\n ServerRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"serverAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"serverUrl\", type: \"string\" },\n ],\n} as const;\n\nexport const BUILDER_REGISTRATION_TYPES = {\n BuilderRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"granteeAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"appUrl\", type: \"string\" },\n ],\n} as const;\n\nexport interface FileRegistrationMessage {\n ownerAddress: `0x${string}`;\n url: string;\n schemaId: `0x${string}`;\n}\n\nexport interface GrantRegistrationMessage {\n grantorAddress: `0x${string}`;\n granteeId: `0x${string}`;\n grant: string;\n fileIds: bigint[];\n}\n\nexport interface GrantRevocationMessage {\n grantorAddress: `0x${string}`;\n grantId: `0x${string}`;\n}\n\nexport interface ServerRegistrationMessage {\n ownerAddress: `0x${string}`;\n serverAddress: `0x${string}`;\n publicKey:
|
|
1
|
+
{"version":3,"sources":["../../src/protocol/eip712.ts"],"sourcesContent":["/**\n * EIP-712 domain and type builders for Data Portability protocol writes.\n *\n * These helpers are shared primitives only. Personal Server runtimes own when\n * to sign and submit these payloads.\n *\n * @category Protocol\n */\n\nimport type { TypedDataDomain } from \"viem\";\n\nconst DOMAIN_NAME = \"Vana Data Portability\";\nconst DOMAIN_VERSION = \"1\";\n\nexport interface DataPortabilityContracts {\n dataRegistry: string;\n dataPortabilityPermissions: string;\n dataPortabilityServer: string;\n dataPortabilityGrantees: string;\n}\n\nexport interface DataPortabilityGatewayConfig {\n chainId: number;\n contracts: DataPortabilityContracts;\n}\n\nfunction buildDomain(\n chainId: number,\n verifyingContract: `0x${string}`,\n): TypedDataDomain {\n return {\n name: DOMAIN_NAME,\n version: DOMAIN_VERSION,\n chainId,\n verifyingContract,\n };\n}\n\nexport function fileRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataRegistry as `0x${string}`,\n );\n}\n\nexport function grantRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function grantRevocationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function serverRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityServer as `0x${string}`,\n );\n}\n\nexport function builderRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityGrantees as `0x${string}`,\n );\n}\n\nexport const FILE_REGISTRATION_TYPES = {\n FileRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"url\", type: \"string\" },\n { name: \"schemaId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport const GRANT_REGISTRATION_TYPES = {\n GrantRegistration: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"granteeId\", type: \"bytes32\" },\n { name: \"grant\", type: \"string\" },\n { name: \"fileIds\", type: \"uint256[]\" },\n ],\n} as const;\n\nexport const GRANT_REVOCATION_TYPES = {\n GrantRevocation: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"grantId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport const SERVER_REGISTRATION_TYPES = {\n ServerRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"serverAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"serverUrl\", type: \"string\" },\n ],\n} as const;\n\nexport const BUILDER_REGISTRATION_TYPES = {\n BuilderRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"granteeAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"appUrl\", type: \"string\" },\n ],\n} as const;\n\nexport interface FileRegistrationMessage {\n ownerAddress: `0x${string}`;\n url: string;\n schemaId: `0x${string}`;\n}\n\nexport interface GrantRegistrationMessage {\n grantorAddress: `0x${string}`;\n granteeId: `0x${string}`;\n grant: string;\n fileIds: bigint[];\n}\n\nexport interface GrantRevocationMessage {\n grantorAddress: `0x${string}`;\n grantId: `0x${string}`;\n}\n\nexport interface ServerRegistrationMessage {\n ownerAddress: `0x${string}`;\n serverAddress: `0x${string}`;\n publicKey: string;\n serverUrl: string;\n}\n\nexport interface BuilderRegistrationMessage {\n ownerAddress: `0x${string}`;\n granteeAddress: `0x${string}`;\n publicKey: string;\n appUrl: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AAcvB,SAAS,YACP,SACA,mBACiB;AACjB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,uBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,wBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,sBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,yBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,0BACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,MAAM,0BAA0B;AAAA,EACrC,kBAAkB;AAAA,IAChB,EAAE,MAAM,gBAAgB,MAAM,UAAU;AAAA,IACxC,EAAE,MAAM,OAAO,MAAM,SAAS;AAAA,IAC9B,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,EACtC;AACF;AAEO,MAAM,2BAA2B;AAAA,EACtC,mBAAmB;AAAA,IACjB,EAAE,MAAM,kBAAkB,MAAM,UAAU;AAAA,IAC1C,EAAE,MAAM,aAAa,MAAM,UAAU;AAAA,IACrC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,IAChC,EAAE,MAAM,WAAW,MAAM,YAAY;AAAA,EACvC;AACF;AAEO,MAAM,yBAAyB;AAAA,EACpC,iBAAiB;AAAA,IACf,EAAE,MAAM,kBAAkB,MAAM,UAAU;AAAA,IAC1C,EAAE,MAAM,WAAW,MAAM,UAAU;AAAA,EACrC;AACF;AAEO,MAAM,4BAA4B;AAAA,EACvC,oBAAoB;AAAA,IAClB,EAAE,MAAM,gBAAgB,MAAM,UAAU;AAAA,IACxC,EAAE,MAAM,iBAAiB,MAAM,UAAU;AAAA,IACzC,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,IACpC,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,EACtC;AACF;AAEO,MAAM,6BAA6B;AAAA,EACxC,qBAAqB;AAAA,IACnB,EAAE,MAAM,gBAAgB,MAAM,UAAU;AAAA,IACxC,EAAE,MAAM,kBAAkB,MAAM,UAAU;AAAA,IAC1C,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,IACpC,EAAE,MAAM,UAAU,MAAM,SAAS;AAAA,EACnC;AACF;","names":[]}
|
|
@@ -106,7 +106,7 @@ export interface GrantRevocationMessage {
|
|
|
106
106
|
export interface ServerRegistrationMessage {
|
|
107
107
|
ownerAddress: `0x${string}`;
|
|
108
108
|
serverAddress: `0x${string}`;
|
|
109
|
-
publicKey:
|
|
109
|
+
publicKey: string;
|
|
110
110
|
serverUrl: string;
|
|
111
111
|
}
|
|
112
112
|
export interface BuilderRegistrationMessage {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/protocol/eip712.ts"],"sourcesContent":["/**\n * EIP-712 domain and type builders for Data Portability protocol writes.\n *\n * These helpers are shared primitives only. Personal Server runtimes own when\n * to sign and submit these payloads.\n *\n * @category Protocol\n */\n\nimport type { TypedDataDomain } from \"viem\";\n\nconst DOMAIN_NAME = \"Vana Data Portability\";\nconst DOMAIN_VERSION = \"1\";\n\nexport interface DataPortabilityContracts {\n dataRegistry: string;\n dataPortabilityPermissions: string;\n dataPortabilityServer: string;\n dataPortabilityGrantees: string;\n}\n\nexport interface DataPortabilityGatewayConfig {\n chainId: number;\n contracts: DataPortabilityContracts;\n}\n\nfunction buildDomain(\n chainId: number,\n verifyingContract: `0x${string}`,\n): TypedDataDomain {\n return {\n name: DOMAIN_NAME,\n version: DOMAIN_VERSION,\n chainId,\n verifyingContract,\n };\n}\n\nexport function fileRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataRegistry as `0x${string}`,\n );\n}\n\nexport function grantRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function grantRevocationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function serverRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityServer as `0x${string}`,\n );\n}\n\nexport function builderRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityGrantees as `0x${string}`,\n );\n}\n\nexport const FILE_REGISTRATION_TYPES = {\n FileRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"url\", type: \"string\" },\n { name: \"schemaId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport const GRANT_REGISTRATION_TYPES = {\n GrantRegistration: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"granteeId\", type: \"bytes32\" },\n { name: \"grant\", type: \"string\" },\n { name: \"fileIds\", type: \"uint256[]\" },\n ],\n} as const;\n\nexport const GRANT_REVOCATION_TYPES = {\n GrantRevocation: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"grantId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport const SERVER_REGISTRATION_TYPES = {\n ServerRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"serverAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"serverUrl\", type: \"string\" },\n ],\n} as const;\n\nexport const BUILDER_REGISTRATION_TYPES = {\n BuilderRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"granteeAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"appUrl\", type: \"string\" },\n ],\n} as const;\n\nexport interface FileRegistrationMessage {\n ownerAddress: `0x${string}`;\n url: string;\n schemaId: `0x${string}`;\n}\n\nexport interface GrantRegistrationMessage {\n grantorAddress: `0x${string}`;\n granteeId: `0x${string}`;\n grant: string;\n fileIds: bigint[];\n}\n\nexport interface GrantRevocationMessage {\n grantorAddress: `0x${string}`;\n grantId: `0x${string}`;\n}\n\nexport interface ServerRegistrationMessage {\n ownerAddress: `0x${string}`;\n serverAddress: `0x${string}`;\n publicKey:
|
|
1
|
+
{"version":3,"sources":["../../src/protocol/eip712.ts"],"sourcesContent":["/**\n * EIP-712 domain and type builders for Data Portability protocol writes.\n *\n * These helpers are shared primitives only. Personal Server runtimes own when\n * to sign and submit these payloads.\n *\n * @category Protocol\n */\n\nimport type { TypedDataDomain } from \"viem\";\n\nconst DOMAIN_NAME = \"Vana Data Portability\";\nconst DOMAIN_VERSION = \"1\";\n\nexport interface DataPortabilityContracts {\n dataRegistry: string;\n dataPortabilityPermissions: string;\n dataPortabilityServer: string;\n dataPortabilityGrantees: string;\n}\n\nexport interface DataPortabilityGatewayConfig {\n chainId: number;\n contracts: DataPortabilityContracts;\n}\n\nfunction buildDomain(\n chainId: number,\n verifyingContract: `0x${string}`,\n): TypedDataDomain {\n return {\n name: DOMAIN_NAME,\n version: DOMAIN_VERSION,\n chainId,\n verifyingContract,\n };\n}\n\nexport function fileRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataRegistry as `0x${string}`,\n );\n}\n\nexport function grantRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function grantRevocationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityPermissions as `0x${string}`,\n );\n}\n\nexport function serverRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityServer as `0x${string}`,\n );\n}\n\nexport function builderRegistrationDomain(\n config: DataPortabilityGatewayConfig,\n): TypedDataDomain {\n return buildDomain(\n config.chainId,\n config.contracts.dataPortabilityGrantees as `0x${string}`,\n );\n}\n\nexport const FILE_REGISTRATION_TYPES = {\n FileRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"url\", type: \"string\" },\n { name: \"schemaId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport const GRANT_REGISTRATION_TYPES = {\n GrantRegistration: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"granteeId\", type: \"bytes32\" },\n { name: \"grant\", type: \"string\" },\n { name: \"fileIds\", type: \"uint256[]\" },\n ],\n} as const;\n\nexport const GRANT_REVOCATION_TYPES = {\n GrantRevocation: [\n { name: \"grantorAddress\", type: \"address\" },\n { name: \"grantId\", type: \"bytes32\" },\n ],\n} as const;\n\nexport const SERVER_REGISTRATION_TYPES = {\n ServerRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"serverAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"serverUrl\", type: \"string\" },\n ],\n} as const;\n\nexport const BUILDER_REGISTRATION_TYPES = {\n BuilderRegistration: [\n { name: \"ownerAddress\", type: \"address\" },\n { name: \"granteeAddress\", type: \"address\" },\n { name: \"publicKey\", type: \"string\" },\n { name: \"appUrl\", type: \"string\" },\n ],\n} as const;\n\nexport interface FileRegistrationMessage {\n ownerAddress: `0x${string}`;\n url: string;\n schemaId: `0x${string}`;\n}\n\nexport interface GrantRegistrationMessage {\n grantorAddress: `0x${string}`;\n granteeId: `0x${string}`;\n grant: string;\n fileIds: bigint[];\n}\n\nexport interface GrantRevocationMessage {\n grantorAddress: `0x${string}`;\n grantId: `0x${string}`;\n}\n\nexport interface ServerRegistrationMessage {\n ownerAddress: `0x${string}`;\n serverAddress: `0x${string}`;\n publicKey: string;\n serverUrl: string;\n}\n\nexport interface BuilderRegistrationMessage {\n ownerAddress: `0x${string}`;\n granteeAddress: `0x${string}`;\n publicKey: string;\n appUrl: string;\n}\n"],"mappings":"AAWA,MAAM,cAAc;AACpB,MAAM,iBAAiB;AAcvB,SAAS,YACP,SACA,mBACiB;AACjB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,uBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,wBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,sBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,yBACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,SAAS,0BACd,QACiB;AACjB,SAAO;AAAA,IACL,OAAO;AAAA,IACP,OAAO,UAAU;AAAA,EACnB;AACF;AAEO,MAAM,0BAA0B;AAAA,EACrC,kBAAkB;AAAA,IAChB,EAAE,MAAM,gBAAgB,MAAM,UAAU;AAAA,IACxC,EAAE,MAAM,OAAO,MAAM,SAAS;AAAA,IAC9B,EAAE,MAAM,YAAY,MAAM,UAAU;AAAA,EACtC;AACF;AAEO,MAAM,2BAA2B;AAAA,EACtC,mBAAmB;AAAA,IACjB,EAAE,MAAM,kBAAkB,MAAM,UAAU;AAAA,IAC1C,EAAE,MAAM,aAAa,MAAM,UAAU;AAAA,IACrC,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,IAChC,EAAE,MAAM,WAAW,MAAM,YAAY;AAAA,EACvC;AACF;AAEO,MAAM,yBAAyB;AAAA,EACpC,iBAAiB;AAAA,IACf,EAAE,MAAM,kBAAkB,MAAM,UAAU;AAAA,IAC1C,EAAE,MAAM,WAAW,MAAM,UAAU;AAAA,EACrC;AACF;AAEO,MAAM,4BAA4B;AAAA,EACvC,oBAAoB;AAAA,IAClB,EAAE,MAAM,gBAAgB,MAAM,UAAU;AAAA,IACxC,EAAE,MAAM,iBAAiB,MAAM,UAAU;AAAA,IACzC,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,IACpC,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,EACtC;AACF;AAEO,MAAM,6BAA6B;AAAA,EACxC,qBAAqB;AAAA,IACnB,EAAE,MAAM,gBAAgB,MAAM,UAAU;AAAA,IACxC,EAAE,MAAM,kBAAkB,MAAM,UAAU;AAAA,IAC1C,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,IACpC,EAAE,MAAM,UAAU,MAAM,SAAS;AAAA,EACnC;AACF;","names":[]}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var grants_exports = {};
|
|
20
|
+
__export(grants_exports, {
|
|
21
|
+
isDataPortabilityGatewayConfig: () => isDataPortabilityGatewayConfig,
|
|
22
|
+
parseGrantRegistrationPayload: () => parseGrantRegistrationPayload,
|
|
23
|
+
verifyGrantRegistration: () => verifyGrantRegistration
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(grants_exports);
|
|
26
|
+
var import_viem = require("viem");
|
|
27
|
+
var import_eip712 = require("./eip712");
|
|
28
|
+
function isHexString(value) {
|
|
29
|
+
return typeof value === "string" && value.startsWith("0x");
|
|
30
|
+
}
|
|
31
|
+
function isDataPortabilityGatewayConfig(value) {
|
|
32
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
const config = value;
|
|
36
|
+
const contracts = config["contracts"];
|
|
37
|
+
if (typeof config["chainId"] !== "number" || !Number.isInteger(config["chainId"]) || config["chainId"] <= 0 || contracts === null || typeof contracts !== "object" || Array.isArray(contracts)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
const c = contracts;
|
|
41
|
+
return isHexString(c["dataRegistry"]) && isHexString(c["dataPortabilityPermissions"]) && isHexString(c["dataPortabilityServer"]) && isHexString(c["dataPortabilityGrantees"]);
|
|
42
|
+
}
|
|
43
|
+
function parseGrantRegistrationPayload(grant) {
|
|
44
|
+
let parsed;
|
|
45
|
+
try {
|
|
46
|
+
parsed = JSON.parse(grant);
|
|
47
|
+
} catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const value = parsed;
|
|
54
|
+
if (!Array.isArray(value["scopes"]) || value["scopes"].length === 0) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
if (!value["scopes"].every((scope) => typeof scope === "string")) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
if (typeof value["expiresAt"] !== "number" || !Number.isFinite(value["expiresAt"])) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
if (value["user"] !== void 0 && !isHexString(value["user"])) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
if (value["builder"] !== void 0 && !isHexString(value["builder"])) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
if (value["nonce"] !== void 0 && (typeof value["nonce"] !== "number" || !Number.isFinite(value["nonce"]))) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
user: value["user"],
|
|
74
|
+
builder: value["builder"],
|
|
75
|
+
scopes: value["scopes"],
|
|
76
|
+
expiresAt: value["expiresAt"],
|
|
77
|
+
nonce: value["nonce"]
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function parseFileIds(fileIds) {
|
|
81
|
+
try {
|
|
82
|
+
const values = (fileIds ?? []).map((fileId) => BigInt(fileId));
|
|
83
|
+
return {
|
|
84
|
+
values,
|
|
85
|
+
display: values.map((fileId) => fileId.toString())
|
|
86
|
+
};
|
|
87
|
+
} catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async function verifyGrantRegistration(input) {
|
|
92
|
+
const payload = parseGrantRegistrationPayload(input.grant);
|
|
93
|
+
if (!payload) {
|
|
94
|
+
return {
|
|
95
|
+
valid: false,
|
|
96
|
+
error: "Grant must be JSON with scopes and expiresAt"
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const fileIds = parseFileIds(input.fileIds);
|
|
100
|
+
if (!fileIds) {
|
|
101
|
+
return { valid: false, error: "fileIds must contain integer values" };
|
|
102
|
+
}
|
|
103
|
+
let valid;
|
|
104
|
+
try {
|
|
105
|
+
valid = await (0, import_viem.verifyTypedData)({
|
|
106
|
+
address: input.grantorAddress,
|
|
107
|
+
domain: (0, import_eip712.grantRegistrationDomain)(input.gatewayConfig),
|
|
108
|
+
types: import_eip712.GRANT_REGISTRATION_TYPES,
|
|
109
|
+
primaryType: "GrantRegistration",
|
|
110
|
+
message: {
|
|
111
|
+
grantorAddress: input.grantorAddress,
|
|
112
|
+
granteeId: input.granteeId,
|
|
113
|
+
grant: input.grant,
|
|
114
|
+
fileIds: fileIds.values
|
|
115
|
+
},
|
|
116
|
+
signature: input.signature
|
|
117
|
+
});
|
|
118
|
+
} catch {
|
|
119
|
+
return { valid: false, error: "EIP-712 signature verification failed" };
|
|
120
|
+
}
|
|
121
|
+
if (!valid) {
|
|
122
|
+
return { valid: false, error: "Grant signature does not match grantor" };
|
|
123
|
+
}
|
|
124
|
+
const nowSeconds = input.nowSeconds ?? Math.floor(Date.now() / 1e3);
|
|
125
|
+
if (payload.expiresAt > 0 && payload.expiresAt < nowSeconds) {
|
|
126
|
+
return { valid: false, error: "Grant has expired" };
|
|
127
|
+
}
|
|
128
|
+
if (payload.user !== void 0 && payload.user.toLowerCase() !== input.grantorAddress.toLowerCase()) {
|
|
129
|
+
return { valid: false, error: "Grant user does not match grantorAddress" };
|
|
130
|
+
}
|
|
131
|
+
return {
|
|
132
|
+
valid: true,
|
|
133
|
+
grantorAddress: input.grantorAddress,
|
|
134
|
+
granteeId: input.granteeId,
|
|
135
|
+
grant: input.grant,
|
|
136
|
+
payload,
|
|
137
|
+
fileIds: fileIds.display
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
141
|
+
0 && (module.exports = {
|
|
142
|
+
isDataPortabilityGatewayConfig,
|
|
143
|
+
parseGrantRegistrationPayload,
|
|
144
|
+
verifyGrantRegistration
|
|
145
|
+
});
|
|
146
|
+
//# sourceMappingURL=grants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/protocol/grants.ts"],"sourcesContent":["import { verifyTypedData } from \"viem\";\nimport {\n GRANT_REGISTRATION_TYPES,\n grantRegistrationDomain,\n type DataPortabilityGatewayConfig,\n} from \"./eip712\";\n\nexport interface DataPortabilityGrantPayload {\n user?: `0x${string}`;\n builder?: `0x${string}`;\n scopes: string[];\n expiresAt: number;\n nonce?: number;\n}\n\nexport interface VerifyGrantRegistrationInput {\n gatewayConfig: DataPortabilityGatewayConfig;\n grantorAddress: `0x${string}`;\n granteeId: `0x${string}`;\n grant: string;\n fileIds?: Array<string | number | bigint>;\n signature: `0x${string}`;\n nowSeconds?: number;\n}\n\nexport type VerifyGrantRegistrationResult =\n | {\n valid: true;\n grantorAddress: `0x${string}`;\n granteeId: `0x${string}`;\n grant: string;\n payload: DataPortabilityGrantPayload;\n fileIds: string[];\n }\n | {\n valid: false;\n error: string;\n };\n\nfunction isHexString(value: unknown): value is `0x${string}` {\n return typeof value === \"string\" && value.startsWith(\"0x\");\n}\n\nexport function isDataPortabilityGatewayConfig(\n value: unknown,\n): value is DataPortabilityGatewayConfig {\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n return false;\n }\n const config = value as Record<string, unknown>;\n const contracts = config[\"contracts\"];\n if (\n typeof config[\"chainId\"] !== \"number\" ||\n !Number.isInteger(config[\"chainId\"]) ||\n config[\"chainId\"] <= 0 ||\n contracts === null ||\n typeof contracts !== \"object\" ||\n Array.isArray(contracts)\n ) {\n return false;\n }\n const c = contracts as Record<string, unknown>;\n return (\n isHexString(c[\"dataRegistry\"]) &&\n isHexString(c[\"dataPortabilityPermissions\"]) &&\n isHexString(c[\"dataPortabilityServer\"]) &&\n isHexString(c[\"dataPortabilityGrantees\"])\n );\n}\n\nexport function parseGrantRegistrationPayload(\n grant: string,\n): DataPortabilityGrantPayload | null {\n let parsed: unknown;\n try {\n parsed = JSON.parse(grant);\n } catch {\n return null;\n }\n if (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n return null;\n }\n const value = parsed as Record<string, unknown>;\n if (!Array.isArray(value[\"scopes\"]) || value[\"scopes\"].length === 0) {\n return null;\n }\n if (!value[\"scopes\"].every((scope) => typeof scope === \"string\")) {\n return null;\n }\n if (\n typeof value[\"expiresAt\"] !== \"number\" ||\n !Number.isFinite(value[\"expiresAt\"])\n ) {\n return null;\n }\n if (value[\"user\"] !== undefined && !isHexString(value[\"user\"])) {\n return null;\n }\n if (value[\"builder\"] !== undefined && !isHexString(value[\"builder\"])) {\n return null;\n }\n if (\n value[\"nonce\"] !== undefined &&\n (typeof value[\"nonce\"] !== \"number\" || !Number.isFinite(value[\"nonce\"]))\n ) {\n return null;\n }\n return {\n user: value[\"user\"] as `0x${string}` | undefined,\n builder: value[\"builder\"] as `0x${string}` | undefined,\n scopes: value[\"scopes\"] as string[],\n expiresAt: value[\"expiresAt\"],\n nonce: value[\"nonce\"] as number | undefined,\n };\n}\n\nfunction parseFileIds(fileIds: Array<string | number | bigint> | undefined): {\n values: bigint[];\n display: string[];\n} | null {\n try {\n const values = (fileIds ?? []).map((fileId) => BigInt(fileId));\n return {\n values,\n display: values.map((fileId) => fileId.toString()),\n };\n } catch {\n return null;\n }\n}\n\nexport async function verifyGrantRegistration(\n input: VerifyGrantRegistrationInput,\n): Promise<VerifyGrantRegistrationResult> {\n const payload = parseGrantRegistrationPayload(input.grant);\n if (!payload) {\n return {\n valid: false,\n error: \"Grant must be JSON with scopes and expiresAt\",\n };\n }\n\n const fileIds = parseFileIds(input.fileIds);\n if (!fileIds) {\n return { valid: false, error: \"fileIds must contain integer values\" };\n }\n\n let valid: boolean;\n try {\n valid = await verifyTypedData({\n address: input.grantorAddress,\n domain: grantRegistrationDomain(input.gatewayConfig),\n types: GRANT_REGISTRATION_TYPES,\n primaryType: \"GrantRegistration\",\n message: {\n grantorAddress: input.grantorAddress,\n granteeId: input.granteeId,\n grant: input.grant,\n fileIds: fileIds.values,\n },\n signature: input.signature,\n });\n } catch {\n return { valid: false, error: \"EIP-712 signature verification failed\" };\n }\n\n if (!valid) {\n return { valid: false, error: \"Grant signature does not match grantor\" };\n }\n\n const nowSeconds = input.nowSeconds ?? Math.floor(Date.now() / 1000);\n if (payload.expiresAt > 0 && payload.expiresAt < nowSeconds) {\n return { valid: false, error: \"Grant has expired\" };\n }\n\n if (\n payload.user !== undefined &&\n payload.user.toLowerCase() !== input.grantorAddress.toLowerCase()\n ) {\n return { valid: false, error: \"Grant user does not match grantorAddress\" };\n }\n\n return {\n valid: true,\n grantorAddress: input.grantorAddress,\n granteeId: input.granteeId,\n grant: input.grant,\n payload,\n fileIds: fileIds.display,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgC;AAChC,oBAIO;AAkCP,SAAS,YAAY,OAAwC;AAC3D,SAAO,OAAO,UAAU,YAAY,MAAM,WAAW,IAAI;AAC3D;AAEO,SAAS,+BACd,OACuC;AACvC,MAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG;AACvE,WAAO;AAAA,EACT;AACA,QAAM,SAAS;AACf,QAAM,YAAY,OAAO,WAAW;AACpC,MACE,OAAO,OAAO,SAAS,MAAM,YAC7B,CAAC,OAAO,UAAU,OAAO,SAAS,CAAC,KACnC,OAAO,SAAS,KAAK,KACrB,cAAc,QACd,OAAO,cAAc,YACrB,MAAM,QAAQ,SAAS,GACvB;AACA,WAAO;AAAA,EACT;AACA,QAAM,IAAI;AACV,SACE,YAAY,EAAE,cA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SAAO;AAAA,IACL,OAAO;AAAA,IACP,gBAAgB,MAAM;AAAA,IACtB,WAAW,MAAM;AAAA,IACjB,OAAO,MAAM;AAAA,IACb;AAAA,IACA,SAAS,QAAQ;AAAA,EACnB;AACF;","names":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type DataPortabilityGatewayConfig } from "./eip712";
|
|
2
|
+
export interface DataPortabilityGrantPayload {
|
|
3
|
+
user?: `0x${string}`;
|
|
4
|
+
builder?: `0x${string}`;
|
|
5
|
+
scopes: string[];
|
|
6
|
+
expiresAt: number;
|
|
7
|
+
nonce?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface VerifyGrantRegistrationInput {
|
|
10
|
+
gatewayConfig: DataPortabilityGatewayConfig;
|
|
11
|
+
grantorAddress: `0x${string}`;
|
|
12
|
+
granteeId: `0x${string}`;
|
|
13
|
+
grant: string;
|
|
14
|
+
fileIds?: Array<string | number | bigint>;
|
|
15
|
+
signature: `0x${string}`;
|
|
16
|
+
nowSeconds?: number;
|
|
17
|
+
}
|
|
18
|
+
export type VerifyGrantRegistrationResult = {
|
|
19
|
+
valid: true;
|
|
20
|
+
grantorAddress: `0x${string}`;
|
|
21
|
+
granteeId: `0x${string}`;
|
|
22
|
+
grant: string;
|
|
23
|
+
payload: DataPortabilityGrantPayload;
|
|
24
|
+
fileIds: string[];
|
|
25
|
+
} | {
|
|
26
|
+
valid: false;
|
|
27
|
+
error: string;
|
|
28
|
+
};
|
|
29
|
+
export declare function isDataPortabilityGatewayConfig(value: unknown): value is DataPortabilityGatewayConfig;
|
|
30
|
+
export declare function parseGrantRegistrationPayload(grant: string): DataPortabilityGrantPayload | null;
|
|
31
|
+
export declare function verifyGrantRegistration(input: VerifyGrantRegistrationInput): Promise<VerifyGrantRegistrationResult>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { verifyTypedData } from "viem";
|
|
2
|
+
import {
|
|
3
|
+
GRANT_REGISTRATION_TYPES,
|
|
4
|
+
grantRegistrationDomain
|
|
5
|
+
} from "./eip712";
|
|
6
|
+
function isHexString(value) {
|
|
7
|
+
return typeof value === "string" && value.startsWith("0x");
|
|
8
|
+
}
|
|
9
|
+
function isDataPortabilityGatewayConfig(value) {
|
|
10
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const config = value;
|
|
14
|
+
const contracts = config["contracts"];
|
|
15
|
+
if (typeof config["chainId"] !== "number" || !Number.isInteger(config["chainId"]) || config["chainId"] <= 0 || contracts === null || typeof contracts !== "object" || Array.isArray(contracts)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const c = contracts;
|
|
19
|
+
return isHexString(c["dataRegistry"]) && isHexString(c["dataPortabilityPermissions"]) && isHexString(c["dataPortabilityServer"]) && isHexString(c["dataPortabilityGrantees"]);
|
|
20
|
+
}
|
|
21
|
+
function parseGrantRegistrationPayload(grant) {
|
|
22
|
+
let parsed;
|
|
23
|
+
try {
|
|
24
|
+
parsed = JSON.parse(grant);
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const value = parsed;
|
|
32
|
+
if (!Array.isArray(value["scopes"]) || value["scopes"].length === 0) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
if (!value["scopes"].every((scope) => typeof scope === "string")) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
if (typeof value["expiresAt"] !== "number" || !Number.isFinite(value["expiresAt"])) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
if (value["user"] !== void 0 && !isHexString(value["user"])) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
if (value["builder"] !== void 0 && !isHexString(value["builder"])) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
if (value["nonce"] !== void 0 && (typeof value["nonce"] !== "number" || !Number.isFinite(value["nonce"]))) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
user: value["user"],
|
|
52
|
+
builder: value["builder"],
|
|
53
|
+
scopes: value["scopes"],
|
|
54
|
+
expiresAt: value["expiresAt"],
|
|
55
|
+
nonce: value["nonce"]
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function parseFileIds(fileIds) {
|
|
59
|
+
try {
|
|
60
|
+
const values = (fileIds ?? []).map((fileId) => BigInt(fileId));
|
|
61
|
+
return {
|
|
62
|
+
values,
|
|
63
|
+
display: values.map((fileId) => fileId.toString())
|
|
64
|
+
};
|
|
65
|
+
} catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function verifyGrantRegistration(input) {
|
|
70
|
+
const payload = parseGrantRegistrationPayload(input.grant);
|
|
71
|
+
if (!payload) {
|
|
72
|
+
return {
|
|
73
|
+
valid: false,
|
|
74
|
+
error: "Grant must be JSON with scopes and expiresAt"
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const fileIds = parseFileIds(input.fileIds);
|
|
78
|
+
if (!fileIds) {
|
|
79
|
+
return { valid: false, error: "fileIds must contain integer values" };
|
|
80
|
+
}
|
|
81
|
+
let valid;
|
|
82
|
+
try {
|
|
83
|
+
valid = await verifyTypedData({
|
|
84
|
+
address: input.grantorAddress,
|
|
85
|
+
domain: grantRegistrationDomain(input.gatewayConfig),
|
|
86
|
+
types: GRANT_REGISTRATION_TYPES,
|
|
87
|
+
primaryType: "GrantRegistration",
|
|
88
|
+
message: {
|
|
89
|
+
grantorAddress: input.grantorAddress,
|
|
90
|
+
granteeId: input.granteeId,
|
|
91
|
+
grant: input.grant,
|
|
92
|
+
fileIds: fileIds.values
|
|
93
|
+
},
|
|
94
|
+
signature: input.signature
|
|
95
|
+
});
|
|
96
|
+
} catch {
|
|
97
|
+
return { valid: false, error: "EIP-712 signature verification failed" };
|
|
98
|
+
}
|
|
99
|
+
if (!valid) {
|
|
100
|
+
return { valid: false, error: "Grant signature does not match grantor" };
|
|
101
|
+
}
|
|
102
|
+
const nowSeconds = input.nowSeconds ?? Math.floor(Date.now() / 1e3);
|
|
103
|
+
if (payload.expiresAt > 0 && payload.expiresAt < nowSeconds) {
|
|
104
|
+
return { valid: false, error: "Grant has expired" };
|
|
105
|
+
}
|
|
106
|
+
if (payload.user !== void 0 && payload.user.toLowerCase() !== input.grantorAddress.toLowerCase()) {
|
|
107
|
+
return { valid: false, error: "Grant user does not match grantorAddress" };
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
valid: true,
|
|
111
|
+
grantorAddress: input.grantorAddress,
|
|
112
|
+
granteeId: input.granteeId,
|
|
113
|
+
grant: input.grant,
|
|
114
|
+
payload,
|
|
115
|
+
fileIds: fileIds.display
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
isDataPortabilityGatewayConfig,
|
|
120
|
+
parseGrantRegistrationPayload,
|
|
121
|
+
verifyGrantRegistration
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=grants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/protocol/grants.ts"],"sourcesContent":["import { verifyTypedData } from \"viem\";\nimport {\n GRANT_REGISTRATION_TYPES,\n grantRegistrationDomain,\n type DataPortabilityGatewayConfig,\n} from \"./eip712\";\n\nexport interface DataPortabilityGrantPayload {\n user?: `0x${string}`;\n builder?: `0x${string}`;\n scopes: string[];\n expiresAt: number;\n nonce?: number;\n}\n\nexport interface VerifyGrantRegistrationInput {\n gatewayConfig: DataPortabilityGatewayConfig;\n grantorAddress: `0x${string}`;\n granteeId: `0x${string}`;\n grant: string;\n fileIds?: Array<string | number | bigint>;\n signature: `0x${string}`;\n nowSeconds?: number;\n}\n\nexport type VerifyGrantRegistrationResult =\n | {\n valid: true;\n grantorAddress: `0x${string}`;\n granteeId: `0x${string}`;\n grant: string;\n payload: DataPortabilityGrantPayload;\n fileIds: string[];\n }\n | {\n valid: false;\n error: string;\n };\n\nfunction isHexString(value: unknown): value is `0x${string}` {\n return typeof value === \"string\" && value.startsWith(\"0x\");\n}\n\nexport function isDataPortabilityGatewayConfig(\n value: unknown,\n): value is DataPortabilityGatewayConfig {\n if (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n return false;\n }\n const config = value as Record<string, unknown>;\n const contracts = config[\"contracts\"];\n if (\n typeof config[\"chainId\"] !== \"number\" ||\n !Number.isInteger(config[\"chainId\"]) ||\n config[\"chainId\"] <= 0 ||\n contracts === null ||\n typeof contracts !== \"object\" ||\n Array.isArray(contracts)\n ) {\n return false;\n }\n const c = contracts as Record<string, unknown>;\n return (\n isHexString(c[\"dataRegistry\"]) &&\n isHexString(c[\"dataPortabilityPermissions\"]) &&\n isHexString(c[\"dataPortabilityServer\"]) &&\n isHexString(c[\"dataPortabilityGrantees\"])\n );\n}\n\nexport function parseGrantRegistrationPayload(\n grant: string,\n): DataPortabilityGrantPayload | null {\n let parsed: unknown;\n try {\n parsed = JSON.parse(grant);\n } catch {\n return null;\n }\n if (parsed === null || typeof parsed !== \"object\" || Array.isArray(parsed)) {\n return null;\n }\n const value = parsed as Record<string, unknown>;\n if (!Array.isArray(value[\"scopes\"]) || value[\"scopes\"].length === 0) {\n return null;\n }\n if (!value[\"scopes\"].every((scope) => typeof scope === \"string\")) {\n return null;\n }\n if (\n typeof value[\"expiresAt\"] !== \"number\" ||\n !Number.isFinite(value[\"expiresAt\"])\n ) {\n return null;\n }\n if (value[\"user\"] !== undefined && !isHexString(value[\"user\"])) {\n return null;\n }\n if (value[\"builder\"] !== undefined && !isHexString(value[\"builder\"])) {\n return null;\n }\n if (\n value[\"nonce\"] !== undefined &&\n (typeof value[\"nonce\"] !== \"number\" || !Number.isFinite(value[\"nonce\"]))\n ) {\n return null;\n }\n return {\n user: value[\"user\"] as `0x${string}` | undefined,\n builder: value[\"builder\"] as `0x${string}` | undefined,\n scopes: value[\"scopes\"] as string[],\n expiresAt: value[\"expiresAt\"],\n nonce: value[\"nonce\"] as number | undefined,\n };\n}\n\nfunction parseFileIds(fileIds: Array<string | number | bigint> | undefined): {\n values: bigint[];\n display: string[];\n} | null {\n try {\n const values = (fileIds ?? []).map((fileId) => BigInt(fileId));\n return {\n values,\n display: values.map((fileId) => fileId.toString()),\n };\n } catch {\n return null;\n }\n}\n\nexport async function verifyGrantRegistration(\n input: VerifyGrantRegistrationInput,\n): Promise<VerifyGrantRegistrationResult> {\n const payload = parseGrantRegistrationPayload(input.grant);\n if (!payload) {\n return {\n valid: false,\n error: \"Grant must be JSON with scopes and expiresAt\",\n };\n }\n\n const fileIds = parseFileIds(input.fileIds);\n if (!fileIds) {\n return { valid: false, error: \"fileIds must contain integer values\" };\n }\n\n let valid: boolean;\n try {\n valid = await verifyTypedData({\n address: input.grantorAddress,\n domain: grantRegistrationDomain(input.gatewayConfig),\n types: GRANT_REGISTRATION_TYPES,\n primaryType: \"GrantRegistration\",\n message: {\n grantorAddress: input.grantorAddress,\n granteeId: input.granteeId,\n grant: input.grant,\n fileIds: fileIds.values,\n },\n signature: input.signature,\n });\n } catch {\n return { valid: false, error: \"EIP-712 signature verification failed\" };\n }\n\n if (!valid) {\n return { valid: false, error: \"Grant signature does not match grantor\" };\n }\n\n const nowSeconds = input.nowSeconds ?? Math.floor(Date.now() / 1000);\n if (payload.expiresAt > 0 && payload.expiresAt < nowSeconds) {\n return { valid: false, error: \"Grant has expired\" };\n }\n\n if (\n payload.user !== undefined &&\n payload.user.toLowerCase() !== input.grantorAddress.toLowerCase()\n ) {\n return { valid: false, error: \"Grant user does not match grantorAddress\" };\n }\n\n return {\n valid: true,\n grantorAddress: input.grantorAddress,\n granteeId: input.granteeId,\n grant: input.grant,\n payload,\n fileIds: fileIds.display,\n };\n}\n"],"mappings":"AAAA,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;A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ACnB,CAAC;AAAA,EACH,QAAQ;AACN,WAAO,EAAE,OAAO,OAAO,OAAO,wCAAwC;AAAA,EACxE;AAEA,MAAI,CAAC,OAAO;AACV,WAAO,EAAE,OAAO,OAAO,OAAO,yCAAyC;AAAA,EACzE;AAEA,QAAM,aAAa,MAAM,cAAc,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI;AACnE,MAAI,QAAQ,YAAY,KAAK,QAAQ,YAAY,YAAY;AAC3D,WAAO,EAAE,OAAO,OAAO,OAAO,oBAAoB;AAAA,EACpD;AAEA,MACE,QAAQ,SAAS,UACjB,QAAQ,KAAK,YAAY,MAAM,MAAM,eAAe,YAAY,GAChE;AACA,WAAO,EAAE,OAAO,OAAO,OAAO,2CAA2C;AAAA,EAC3E;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,IACP,gBAAgB,MAAM;AAAA,IACtB,WAAW,MAAM;AAAA,IACjB,OAAO,MAAM;AAAA,IACb;AAAA,IACA,SAAS,QAAQ;AAAA,EACnB;AACF;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var personal_server_lite_owner_binding_exports = {};
|
|
20
|
+
__export(personal_server_lite_owner_binding_exports, {
|
|
21
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX: () => PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX,
|
|
22
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE: () => PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,
|
|
23
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION: () => PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION,
|
|
24
|
+
buildPersonalServerLiteOwnerBindingMessage: () => buildPersonalServerLiteOwnerBindingMessage,
|
|
25
|
+
buildPersonalServerLiteOwnerBindingSignature: () => buildPersonalServerLiteOwnerBindingSignature,
|
|
26
|
+
createViemPersonalServerLiteOwnerBindingSigner: () => createViemPersonalServerLiteOwnerBindingSigner,
|
|
27
|
+
signPersonalServerLiteOwnerBinding: () => signPersonalServerLiteOwnerBinding
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(personal_server_lite_owner_binding_exports);
|
|
30
|
+
var import_viem = require("viem");
|
|
31
|
+
const PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = "vana.account.v1";
|
|
32
|
+
const PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE = "ps-lite-owner";
|
|
33
|
+
const PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX = `${PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION}:${PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE}:`;
|
|
34
|
+
function assertAddress(value, name) {
|
|
35
|
+
if (!(0, import_viem.isAddress)(value)) {
|
|
36
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function getAccountAddress(account) {
|
|
40
|
+
if (!account) {
|
|
41
|
+
return void 0;
|
|
42
|
+
}
|
|
43
|
+
return typeof account === "string" ? account : account.address;
|
|
44
|
+
}
|
|
45
|
+
function isPersonalServerLiteOwnerBindingSigner(source) {
|
|
46
|
+
return "address" in source && typeof source.signMessage === "function";
|
|
47
|
+
}
|
|
48
|
+
function buildPersonalServerLiteOwnerBindingMessage(ownerAddress) {
|
|
49
|
+
assertAddress(ownerAddress, "ownerAddress");
|
|
50
|
+
return `${PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX}${ownerAddress.toLowerCase()}`;
|
|
51
|
+
}
|
|
52
|
+
function createViemPersonalServerLiteOwnerBindingSigner(source, options = {}) {
|
|
53
|
+
if (isPersonalServerLiteOwnerBindingSigner(source)) {
|
|
54
|
+
return source;
|
|
55
|
+
}
|
|
56
|
+
const accountAddress = getAccountAddress(options.account) ?? getAccountAddress(source.account);
|
|
57
|
+
if (accountAddress) {
|
|
58
|
+
return {
|
|
59
|
+
address: accountAddress,
|
|
60
|
+
signMessage: ({ message }) => source.signMessage({
|
|
61
|
+
account: options.account ?? source.account ?? accountAddress,
|
|
62
|
+
message
|
|
63
|
+
})
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
throw new Error(
|
|
67
|
+
"Viem wallet client requires an account option or account property"
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
async function buildPersonalServerLiteOwnerBindingSignature(input) {
|
|
71
|
+
const message = buildPersonalServerLiteOwnerBindingMessage(
|
|
72
|
+
input.signer.address
|
|
73
|
+
);
|
|
74
|
+
const signature = await input.signer.signMessage({ message });
|
|
75
|
+
return {
|
|
76
|
+
signature,
|
|
77
|
+
signerAddress: input.signer.address,
|
|
78
|
+
message,
|
|
79
|
+
purpose: PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const signPersonalServerLiteOwnerBinding = buildPersonalServerLiteOwnerBindingSignature;
|
|
83
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
+
0 && (module.exports = {
|
|
85
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX,
|
|
86
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,
|
|
87
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION,
|
|
88
|
+
buildPersonalServerLiteOwnerBindingMessage,
|
|
89
|
+
buildPersonalServerLiteOwnerBindingSignature,
|
|
90
|
+
createViemPersonalServerLiteOwnerBindingSigner,
|
|
91
|
+
signPersonalServerLiteOwnerBinding
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=personal-server-lite-owner-binding.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/protocol/personal-server-lite-owner-binding.ts"],"sourcesContent":["/**\n * PS Lite owner-binding message and signing helpers.\n *\n * PS Lite uses this replayable personal-sign message as a wallet-owned input\n * for opening the user's local encrypted runtime. This is intentionally\n * separate from Personal Server registration, which is EIP-712 typed data.\n *\n * @category Protocol\n */\n\nimport {\n isAddress,\n type Account,\n type Address,\n type Hex,\n type SignableMessage,\n} from \"viem\";\n\nexport const PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = \"vana.account.v1\";\nexport const PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE = \"ps-lite-owner\";\nexport const PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX =\n `${PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION}:${PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE}:` as const;\n\nexport type PersonalServerLiteOwnerBindingPurpose =\n typeof PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE;\n\nexport type PersonalServerLiteOwnerBindingMessage =\n `${typeof PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX}${Lowercase<Address>}`;\n\nexport interface PersonalServerLiteOwnerBindingSigner {\n address: Address;\n signMessage(input: {\n message: PersonalServerLiteOwnerBindingMessage;\n }): Promise<Hex> | Hex;\n}\n\nexport interface ViemPersonalServerLiteOwnerBindingWalletClient {\n account?: Account | Address | null;\n signMessage(input: {\n account?: Account | Address;\n message: SignableMessage;\n }): Promise<Hex>;\n}\n\nexport type ViemPersonalServerLiteOwnerBindingSignerSource =\n | PersonalServerLiteOwnerBindingSigner\n | ViemPersonalServerLiteOwnerBindingWalletClient;\n\nexport interface BuildPersonalServerLiteOwnerBindingSignatureInput {\n signer: PersonalServerLiteOwnerBindingSigner;\n}\n\nexport interface PersonalServerLiteOwnerBindingSignature {\n signature: Hex;\n signerAddress: Address;\n message: PersonalServerLiteOwnerBindingMessage;\n purpose: PersonalServerLiteOwnerBindingPurpose;\n}\n\nfunction assertAddress(value: Address, name: string): void {\n if (!isAddress(value)) {\n throw new Error(`${name} must be a valid EVM address`);\n }\n}\n\nfunction getAccountAddress(\n account: Account | Address | null | undefined,\n): Address | undefined {\n if (!account) {\n return undefined;\n }\n\n return typeof account === \"string\" ? account : account.address;\n}\n\nfunction isPersonalServerLiteOwnerBindingSigner(\n source: ViemPersonalServerLiteOwnerBindingSignerSource,\n): source is PersonalServerLiteOwnerBindingSigner {\n return \"address\" in source && typeof source.signMessage === \"function\";\n}\n\nexport function buildPersonalServerLiteOwnerBindingMessage(\n ownerAddress: Address,\n): PersonalServerLiteOwnerBindingMessage {\n assertAddress(ownerAddress, \"ownerAddress\");\n return `${PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX}${ownerAddress.toLowerCase()}` as PersonalServerLiteOwnerBindingMessage;\n}\n\nexport function createViemPersonalServerLiteOwnerBindingSigner(\n source: ViemPersonalServerLiteOwnerBindingSignerSource,\n options: { account?: Account | Address } = {},\n): PersonalServerLiteOwnerBindingSigner {\n if (isPersonalServerLiteOwnerBindingSigner(source)) {\n return source;\n }\n\n const accountAddress =\n getAccountAddress(options.account) ?? getAccountAddress(source.account);\n\n if (accountAddress) {\n return {\n address: accountAddress,\n signMessage: ({ message }) =>\n source.signMessage({\n account: options.account ?? source.account ?? accountAddress,\n message,\n }),\n };\n }\n\n throw new Error(\n \"Viem wallet client requires an account option or account property\",\n );\n}\n\nexport async function buildPersonalServerLiteOwnerBindingSignature(\n input: BuildPersonalServerLiteOwnerBindingSignatureInput,\n): Promise<PersonalServerLiteOwnerBindingSignature> {\n const message = buildPersonalServerLiteOwnerBindingMessage(\n input.signer.address,\n );\n const signature = await input.signer.signMessage({ message });\n\n return {\n signature,\n signerAddress: input.signer.address,\n message,\n purpose: PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,\n };\n}\n\nexport const signPersonalServerLiteOwnerBinding =\n buildPersonalServerLiteOwnerBindingSignature;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,kBAMO;AAEA,MAAM,6CAA6C;AACnD,MAAM,6CAA6C;AACnD,MAAM,4CACX,GAAG,0CAA0C,IAAI,0CAA0C;AAsC7F,SAAS,cAAc,OAAgB,MAAoB;AACzD,MAAI,KAAC,uBAAU,KAAK,GAAG;AACrB,UAAM,IAAI,MAAM,GAAG,IAAI,8BAA8B;AAAA,EACvD;AACF;AAEA,SAAS,kBACP,SACqB;AACrB,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ;AACzD;AAEA,SAAS,uCACP,QACgD;AAChD,SAAO,aAAa,UAAU,OAAO,OAAO,gBAAgB;AAC9D;AAEO,SAAS,2CACd,cACuC;AACvC,gBAAc,cAAc,cAAc;AAC1C,SAAO,GAAG,yCAAyC,GAAG,aAAa,YAAY,CAAC;AAClF;AAEO,SAAS,+CACd,QACA,UAA2C,CAAC,GACN;AACtC,MAAI,uCAAuC,MAAM,GAAG;AAClD,WAAO;AAAA,EACT;AAEA,QAAM,iBACJ,kBAAkB,QAAQ,OAAO,KAAK,kBAAkB,OAAO,OAAO;AAExE,MAAI,gBAAgB;AAClB,WAAO;AAAA,MACL,SAAS;AAAA,MACT,aAAa,CAAC,EAAE,QAAQ,MACtB,OAAO,YAAY;AAAA,QACjB,SAAS,QAAQ,WAAW,OAAO,WAAW;AAAA,QAC9C;AAAA,MACF,CAAC;AAAA,IACL;AAAA,EACF;AAEA,QAAM,IAAI;AAAA,IACR;AAAA,EACF;AACF;AAEA,eAAsB,6CACpB,OACkD;AAClD,QAAM,UAAU;AAAA,IACd,MAAM,OAAO;AAAA,EACf;AACA,QAAM,YAAY,MAAM,MAAM,OAAO,YAAY,EAAE,QAAQ,CAAC;AAE5D,SAAO;AAAA,IACL;AAAA,IACA,eAAe,MAAM,OAAO;AAAA,IAC5B;AAAA,IACA,SAAS;AAAA,EACX;AACF;AAEO,MAAM,qCACX;","names":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PS Lite owner-binding message and signing helpers.
|
|
3
|
+
*
|
|
4
|
+
* PS Lite uses this replayable personal-sign message as a wallet-owned input
|
|
5
|
+
* for opening the user's local encrypted runtime. This is intentionally
|
|
6
|
+
* separate from Personal Server registration, which is EIP-712 typed data.
|
|
7
|
+
*
|
|
8
|
+
* @category Protocol
|
|
9
|
+
*/
|
|
10
|
+
import { type Account, type Address, type Hex, type SignableMessage } from "viem";
|
|
11
|
+
export declare const PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = "vana.account.v1";
|
|
12
|
+
export declare const PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE = "ps-lite-owner";
|
|
13
|
+
export declare const PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX: "vana.account.v1:ps-lite-owner:";
|
|
14
|
+
export type PersonalServerLiteOwnerBindingPurpose = typeof PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE;
|
|
15
|
+
export type PersonalServerLiteOwnerBindingMessage = `${typeof PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX}${Lowercase<Address>}`;
|
|
16
|
+
export interface PersonalServerLiteOwnerBindingSigner {
|
|
17
|
+
address: Address;
|
|
18
|
+
signMessage(input: {
|
|
19
|
+
message: PersonalServerLiteOwnerBindingMessage;
|
|
20
|
+
}): Promise<Hex> | Hex;
|
|
21
|
+
}
|
|
22
|
+
export interface ViemPersonalServerLiteOwnerBindingWalletClient {
|
|
23
|
+
account?: Account | Address | null;
|
|
24
|
+
signMessage(input: {
|
|
25
|
+
account?: Account | Address;
|
|
26
|
+
message: SignableMessage;
|
|
27
|
+
}): Promise<Hex>;
|
|
28
|
+
}
|
|
29
|
+
export type ViemPersonalServerLiteOwnerBindingSignerSource = PersonalServerLiteOwnerBindingSigner | ViemPersonalServerLiteOwnerBindingWalletClient;
|
|
30
|
+
export interface BuildPersonalServerLiteOwnerBindingSignatureInput {
|
|
31
|
+
signer: PersonalServerLiteOwnerBindingSigner;
|
|
32
|
+
}
|
|
33
|
+
export interface PersonalServerLiteOwnerBindingSignature {
|
|
34
|
+
signature: Hex;
|
|
35
|
+
signerAddress: Address;
|
|
36
|
+
message: PersonalServerLiteOwnerBindingMessage;
|
|
37
|
+
purpose: PersonalServerLiteOwnerBindingPurpose;
|
|
38
|
+
}
|
|
39
|
+
export declare function buildPersonalServerLiteOwnerBindingMessage(ownerAddress: Address): PersonalServerLiteOwnerBindingMessage;
|
|
40
|
+
export declare function createViemPersonalServerLiteOwnerBindingSigner(source: ViemPersonalServerLiteOwnerBindingSignerSource, options?: {
|
|
41
|
+
account?: Account | Address;
|
|
42
|
+
}): PersonalServerLiteOwnerBindingSigner;
|
|
43
|
+
export declare function buildPersonalServerLiteOwnerBindingSignature(input: BuildPersonalServerLiteOwnerBindingSignatureInput): Promise<PersonalServerLiteOwnerBindingSignature>;
|
|
44
|
+
export declare const signPersonalServerLiteOwnerBinding: typeof buildPersonalServerLiteOwnerBindingSignature;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isAddress
|
|
3
|
+
} from "viem";
|
|
4
|
+
const PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = "vana.account.v1";
|
|
5
|
+
const PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE = "ps-lite-owner";
|
|
6
|
+
const PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX = `${PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION}:${PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE}:`;
|
|
7
|
+
function assertAddress(value, name) {
|
|
8
|
+
if (!isAddress(value)) {
|
|
9
|
+
throw new Error(`${name} must be a valid EVM address`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function getAccountAddress(account) {
|
|
13
|
+
if (!account) {
|
|
14
|
+
return void 0;
|
|
15
|
+
}
|
|
16
|
+
return typeof account === "string" ? account : account.address;
|
|
17
|
+
}
|
|
18
|
+
function isPersonalServerLiteOwnerBindingSigner(source) {
|
|
19
|
+
return "address" in source && typeof source.signMessage === "function";
|
|
20
|
+
}
|
|
21
|
+
function buildPersonalServerLiteOwnerBindingMessage(ownerAddress) {
|
|
22
|
+
assertAddress(ownerAddress, "ownerAddress");
|
|
23
|
+
return `${PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX}${ownerAddress.toLowerCase()}`;
|
|
24
|
+
}
|
|
25
|
+
function createViemPersonalServerLiteOwnerBindingSigner(source, options = {}) {
|
|
26
|
+
if (isPersonalServerLiteOwnerBindingSigner(source)) {
|
|
27
|
+
return source;
|
|
28
|
+
}
|
|
29
|
+
const accountAddress = getAccountAddress(options.account) ?? getAccountAddress(source.account);
|
|
30
|
+
if (accountAddress) {
|
|
31
|
+
return {
|
|
32
|
+
address: accountAddress,
|
|
33
|
+
signMessage: ({ message }) => source.signMessage({
|
|
34
|
+
account: options.account ?? source.account ?? accountAddress,
|
|
35
|
+
message
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
throw new Error(
|
|
40
|
+
"Viem wallet client requires an account option or account property"
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
async function buildPersonalServerLiteOwnerBindingSignature(input) {
|
|
44
|
+
const message = buildPersonalServerLiteOwnerBindingMessage(
|
|
45
|
+
input.signer.address
|
|
46
|
+
);
|
|
47
|
+
const signature = await input.signer.signMessage({ message });
|
|
48
|
+
return {
|
|
49
|
+
signature,
|
|
50
|
+
signerAddress: input.signer.address,
|
|
51
|
+
message,
|
|
52
|
+
purpose: PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const signPersonalServerLiteOwnerBinding = buildPersonalServerLiteOwnerBindingSignature;
|
|
56
|
+
export {
|
|
57
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX,
|
|
58
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,
|
|
59
|
+
PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION,
|
|
60
|
+
buildPersonalServerLiteOwnerBindingMessage,
|
|
61
|
+
buildPersonalServerLiteOwnerBindingSignature,
|
|
62
|
+
createViemPersonalServerLiteOwnerBindingSigner,
|
|
63
|
+
signPersonalServerLiteOwnerBinding
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=personal-server-lite-owner-binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/protocol/personal-server-lite-owner-binding.ts"],"sourcesContent":["/**\n * PS Lite owner-binding message and signing helpers.\n *\n * PS Lite uses this replayable personal-sign message as a wallet-owned input\n * for opening the user's local encrypted runtime. This is intentionally\n * separate from Personal Server registration, which is EIP-712 typed data.\n *\n * @category Protocol\n */\n\nimport {\n isAddress,\n type Account,\n type Address,\n type Hex,\n type SignableMessage,\n} from \"viem\";\n\nexport const PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION = \"vana.account.v1\";\nexport const PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE = \"ps-lite-owner\";\nexport const PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX =\n `${PERSONAL_SERVER_LITE_OWNER_BINDING_VERSION}:${PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE}:` as const;\n\nexport type PersonalServerLiteOwnerBindingPurpose =\n typeof PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE;\n\nexport type PersonalServerLiteOwnerBindingMessage =\n `${typeof PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX}${Lowercase<Address>}`;\n\nexport interface PersonalServerLiteOwnerBindingSigner {\n address: Address;\n signMessage(input: {\n message: PersonalServerLiteOwnerBindingMessage;\n }): Promise<Hex> | Hex;\n}\n\nexport interface ViemPersonalServerLiteOwnerBindingWalletClient {\n account?: Account | Address | null;\n signMessage(input: {\n account?: Account | Address;\n message: SignableMessage;\n }): Promise<Hex>;\n}\n\nexport type ViemPersonalServerLiteOwnerBindingSignerSource =\n | PersonalServerLiteOwnerBindingSigner\n | ViemPersonalServerLiteOwnerBindingWalletClient;\n\nexport interface BuildPersonalServerLiteOwnerBindingSignatureInput {\n signer: PersonalServerLiteOwnerBindingSigner;\n}\n\nexport interface PersonalServerLiteOwnerBindingSignature {\n signature: Hex;\n signerAddress: Address;\n message: PersonalServerLiteOwnerBindingMessage;\n purpose: PersonalServerLiteOwnerBindingPurpose;\n}\n\nfunction assertAddress(value: Address, name: string): void {\n if (!isAddress(value)) {\n throw new Error(`${name} must be a valid EVM address`);\n }\n}\n\nfunction getAccountAddress(\n account: Account | Address | null | undefined,\n): Address | undefined {\n if (!account) {\n return undefined;\n }\n\n return typeof account === \"string\" ? account : account.address;\n}\n\nfunction isPersonalServerLiteOwnerBindingSigner(\n source: ViemPersonalServerLiteOwnerBindingSignerSource,\n): source is PersonalServerLiteOwnerBindingSigner {\n return \"address\" in source && typeof source.signMessage === \"function\";\n}\n\nexport function buildPersonalServerLiteOwnerBindingMessage(\n ownerAddress: Address,\n): PersonalServerLiteOwnerBindingMessage {\n assertAddress(ownerAddress, \"ownerAddress\");\n return `${PERSONAL_SERVER_LITE_OWNER_BINDING_PREFIX}${ownerAddress.toLowerCase()}` as PersonalServerLiteOwnerBindingMessage;\n}\n\nexport function createViemPersonalServerLiteOwnerBindingSigner(\n source: ViemPersonalServerLiteOwnerBindingSignerSource,\n options: { account?: Account | Address } = {},\n): PersonalServerLiteOwnerBindingSigner {\n if (isPersonalServerLiteOwnerBindingSigner(source)) {\n return source;\n }\n\n const accountAddress =\n getAccountAddress(options.account) ?? getAccountAddress(source.account);\n\n if (accountAddress) {\n return {\n address: accountAddress,\n signMessage: ({ message }) =>\n source.signMessage({\n account: options.account ?? source.account ?? accountAddress,\n message,\n }),\n };\n }\n\n throw new Error(\n \"Viem wallet client requires an account option or account property\",\n );\n}\n\nexport async function buildPersonalServerLiteOwnerBindingSignature(\n input: BuildPersonalServerLiteOwnerBindingSignatureInput,\n): Promise<PersonalServerLiteOwnerBindingSignature> {\n const message = buildPersonalServerLiteOwnerBindingMessage(\n input.signer.address,\n );\n const signature = await input.signer.signMessage({ message });\n\n return {\n signature,\n signerAddress: input.signer.address,\n message,\n purpose: PERSONAL_SERVER_LITE_OWNER_BINDING_PURPOSE,\n };\n}\n\nexport const signPersonalServerLiteOwnerBinding =\n buildPersonalServerLiteOwnerBindingSignature;\n"],"mappings":"AAUA;AAAA,EACE;AAAA,OAKK;AAEA,MAAM,6CAA6C;AACnD,MAAM,6CAA6C;AACnD,MAAM,4CACX,GAAG,0CAA0C,IAAI,0CAA0C;AAsC7F,SAAS,cAAc,OAAgB,MAAoB;AACzD,MAAI,CAAC,UAAU,KAAK,GAAG;AACrB,UAAM,IAAI,MAAM,GAAG,IAAI,8BAA8B;AAAA,EACvD;AACF;AAEA,SAAS,kBACP,SACqB;AACrB,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AAEA,SAAO,OAAO,YAAY,WAAW,UAAU,QAAQ;AACzD;AAEA,SAAS,uCACP,QACgD;AAChD,SAAO,aAAa,UAAU,OAAO,OAAO,gBAAgB;AAC9D;AAEO,SAAS,2CACd,cACuC;A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