@solana/wallet-standard-util
Advanced tools
Comparing version 1.1.0-alpha.9 to 1.1.0-alpha.10
@@ -89,14 +89,15 @@ "use strict"; | ||
const DOMAIN = '(?<domain>[^\\n]+?) wants you to sign in with your Solana account:\\n'; | ||
const ADDRESS = '(?<address>[^\\n]+)\\n\\n'; | ||
const STATEMENT = '((?<statement>[^\\n]+)\\n)?'; | ||
const URI = '(\\nURI: (?<uri>[^\\n]+))?'; | ||
const VERSION = '(\\nVersion: (?<version>[^\\n]+))?'; | ||
const CHAIN_ID = '(\\nChain ID: (?<chainId>[^\\n]+))?'; | ||
const NONCE = '(\\nNonce: (?<nonce>[^\\n]+))?'; | ||
const ISSUED_AT = '(\\nIssued At: (?<issuedAt>[^\\n]+))?'; | ||
const EXPIRATION_TIME = '(\\nExpiration Time: (?<expirationTime>[^\\n]+))?'; | ||
const NOT_BEFORE = '(\\nNot Before: (?<notBefore>[^\\n]+))?'; | ||
const REQUEST_ID = '(\\nRequest ID: (?<requestId>[^\\n]+))?'; | ||
const RESOURCES = '(\\nResources:(?<resources>(\\n- [^\\n]+)*))?'; | ||
const MESSAGE = new RegExp(`^${DOMAIN}${ADDRESS}${STATEMENT}${URI}${VERSION}${CHAIN_ID}${NONCE}${ISSUED_AT}${EXPIRATION_TIME}${NOT_BEFORE}${REQUEST_ID}${RESOURCES}$`); | ||
const ADDRESS = '(?<address>[^\\n]+)(?:\\n|$)'; | ||
const FIELD = '(?:URI|Version|Chain ID|Nonce|Issued At|Expiration Time|Not Before|Request ID|Resources)'; | ||
const STATEMENT = `(?:\\n(?<statement>(?:(?!${FIELD}: [^\\n]+)[^\\n]*?\\n*?)*?)(?:\\n|$))?`; | ||
const URI = '(?:\\nURI: (?<uri>[^\\n]+))?'; | ||
const VERSION = '(?:\\nVersion: (?<version>[^\\n]+))?'; | ||
const CHAIN_ID = '(?:\\nChain ID: (?<chainId>[^\\n]+))?'; | ||
const NONCE = '(?:\\nNonce: (?<nonce>[^\\n]+))?'; | ||
const ISSUED_AT = '(?:\\nIssued At: (?<issuedAt>[^\\n]+))?'; | ||
const EXPIRATION_TIME = '(?:\\nExpiration Time: (?<expirationTime>[^\\n]+))?'; | ||
const NOT_BEFORE = '(?:\\nNot Before: (?<notBefore>[^\\n]+))?'; | ||
const REQUEST_ID = '(?:\\nRequest ID: (?<requestId>[^\\n]+))?'; | ||
const RESOURCES = '(?:\\nResources:(?<resources>(?:\\n- [^\\n]+)*))?'; | ||
const MESSAGE = new RegExp(`^${DOMAIN}${ADDRESS}${STATEMENT}${URI}${VERSION}${CHAIN_ID}${NONCE}${ISSUED_AT}${EXPIRATION_TIME}${NOT_BEFORE}${REQUEST_ID}${RESOURCES}\n*$`); | ||
/** | ||
@@ -162,36 +163,40 @@ * TODO: docs | ||
let message = `${input.domain} wants you to sign in with your Solana account:\n`; | ||
message += `${input.address}\n\n`; | ||
message += `${input.address}`; | ||
if (input.statement) { | ||
message += `${input.statement}\n`; | ||
message += `\n\n${input.statement}`; | ||
} | ||
const fields = []; | ||
if (input.uri) { | ||
message += `\nURI: ${input.uri}`; | ||
fields.push(`URI: ${input.uri}`); | ||
} | ||
if (input.version) { | ||
message += `\nVersion: ${input.version}`; | ||
fields.push(`Version: ${input.version}`); | ||
} | ||
if (input.chainId) { | ||
message += `\nChain ID: ${input.chainId}`; | ||
fields.push(`Chain ID: ${input.chainId}`); | ||
} | ||
if (input.nonce) { | ||
message += `\nNonce: ${input.nonce}`; | ||
fields.push(`Nonce: ${input.nonce}`); | ||
} | ||
if (input.issuedAt) { | ||
message += `\nIssued At: ${input.issuedAt}`; | ||
fields.push(`Issued At: ${input.issuedAt}`); | ||
} | ||
if (input.expirationTime) { | ||
message += `\nExpiration Time: ${input.expirationTime}`; | ||
fields.push(`Expiration Time: ${input.expirationTime}`); | ||
} | ||
if (input.notBefore) { | ||
message += `\nNot Before: ${input.notBefore}`; | ||
fields.push(`Not Before: ${input.notBefore}`); | ||
} | ||
if (input.requestId) { | ||
message += `\nRequest ID: ${input.requestId}`; | ||
fields.push(`Request ID: ${input.requestId}`); | ||
} | ||
if (input.resources) { | ||
message += `\nResources:`; | ||
fields.push(`Resources:`); | ||
for (const resource of input.resources) { | ||
message += `\n- ${resource}`; | ||
fields.push(`- ${resource}`); | ||
} | ||
} | ||
if (fields.length) { | ||
message += `\n\n${fields.join('\n')}`; | ||
} | ||
return message; | ||
@@ -198,0 +203,0 @@ } |
@@ -80,14 +80,15 @@ import { ed25519 } from '@noble/curves/ed25519'; | ||
const DOMAIN = '(?<domain>[^\\n]+?) wants you to sign in with your Solana account:\\n'; | ||
const ADDRESS = '(?<address>[^\\n]+)\\n\\n'; | ||
const STATEMENT = '((?<statement>[^\\n]+)\\n)?'; | ||
const URI = '(\\nURI: (?<uri>[^\\n]+))?'; | ||
const VERSION = '(\\nVersion: (?<version>[^\\n]+))?'; | ||
const CHAIN_ID = '(\\nChain ID: (?<chainId>[^\\n]+))?'; | ||
const NONCE = '(\\nNonce: (?<nonce>[^\\n]+))?'; | ||
const ISSUED_AT = '(\\nIssued At: (?<issuedAt>[^\\n]+))?'; | ||
const EXPIRATION_TIME = '(\\nExpiration Time: (?<expirationTime>[^\\n]+))?'; | ||
const NOT_BEFORE = '(\\nNot Before: (?<notBefore>[^\\n]+))?'; | ||
const REQUEST_ID = '(\\nRequest ID: (?<requestId>[^\\n]+))?'; | ||
const RESOURCES = '(\\nResources:(?<resources>(\\n- [^\\n]+)*))?'; | ||
const MESSAGE = new RegExp(`^${DOMAIN}${ADDRESS}${STATEMENT}${URI}${VERSION}${CHAIN_ID}${NONCE}${ISSUED_AT}${EXPIRATION_TIME}${NOT_BEFORE}${REQUEST_ID}${RESOURCES}$`); | ||
const ADDRESS = '(?<address>[^\\n]+)(?:\\n|$)'; | ||
const FIELD = '(?:URI|Version|Chain ID|Nonce|Issued At|Expiration Time|Not Before|Request ID|Resources)'; | ||
const STATEMENT = `(?:\\n(?<statement>(?:(?!${FIELD}: [^\\n]+)[^\\n]*?\\n*?)*?)(?:\\n|$))?`; | ||
const URI = '(?:\\nURI: (?<uri>[^\\n]+))?'; | ||
const VERSION = '(?:\\nVersion: (?<version>[^\\n]+))?'; | ||
const CHAIN_ID = '(?:\\nChain ID: (?<chainId>[^\\n]+))?'; | ||
const NONCE = '(?:\\nNonce: (?<nonce>[^\\n]+))?'; | ||
const ISSUED_AT = '(?:\\nIssued At: (?<issuedAt>[^\\n]+))?'; | ||
const EXPIRATION_TIME = '(?:\\nExpiration Time: (?<expirationTime>[^\\n]+))?'; | ||
const NOT_BEFORE = '(?:\\nNot Before: (?<notBefore>[^\\n]+))?'; | ||
const REQUEST_ID = '(?:\\nRequest ID: (?<requestId>[^\\n]+))?'; | ||
const RESOURCES = '(?:\\nResources:(?<resources>(?:\\n- [^\\n]+)*))?'; | ||
const MESSAGE = new RegExp(`^${DOMAIN}${ADDRESS}${STATEMENT}${URI}${VERSION}${CHAIN_ID}${NONCE}${ISSUED_AT}${EXPIRATION_TIME}${NOT_BEFORE}${REQUEST_ID}${RESOURCES}\n*$`); | ||
/** | ||
@@ -150,36 +151,40 @@ * TODO: docs | ||
let message = `${input.domain} wants you to sign in with your Solana account:\n`; | ||
message += `${input.address}\n\n`; | ||
message += `${input.address}`; | ||
if (input.statement) { | ||
message += `${input.statement}\n`; | ||
message += `\n\n${input.statement}`; | ||
} | ||
const fields = []; | ||
if (input.uri) { | ||
message += `\nURI: ${input.uri}`; | ||
fields.push(`URI: ${input.uri}`); | ||
} | ||
if (input.version) { | ||
message += `\nVersion: ${input.version}`; | ||
fields.push(`Version: ${input.version}`); | ||
} | ||
if (input.chainId) { | ||
message += `\nChain ID: ${input.chainId}`; | ||
fields.push(`Chain ID: ${input.chainId}`); | ||
} | ||
if (input.nonce) { | ||
message += `\nNonce: ${input.nonce}`; | ||
fields.push(`Nonce: ${input.nonce}`); | ||
} | ||
if (input.issuedAt) { | ||
message += `\nIssued At: ${input.issuedAt}`; | ||
fields.push(`Issued At: ${input.issuedAt}`); | ||
} | ||
if (input.expirationTime) { | ||
message += `\nExpiration Time: ${input.expirationTime}`; | ||
fields.push(`Expiration Time: ${input.expirationTime}`); | ||
} | ||
if (input.notBefore) { | ||
message += `\nNot Before: ${input.notBefore}`; | ||
fields.push(`Not Before: ${input.notBefore}`); | ||
} | ||
if (input.requestId) { | ||
message += `\nRequest ID: ${input.requestId}`; | ||
fields.push(`Request ID: ${input.requestId}`); | ||
} | ||
if (input.resources) { | ||
message += `\nResources:`; | ||
fields.push(`Resources:`); | ||
for (const resource of input.resources) { | ||
message += `\n- ${resource}`; | ||
fields.push(`- ${resource}`); | ||
} | ||
} | ||
if (fields.length) { | ||
message += `\n\n${fields.join('\n')}`; | ||
} | ||
return message; | ||
@@ -186,0 +191,0 @@ } |
{ | ||
"name": "@solana/wallet-standard-util", | ||
"version": "1.1.0-alpha.9", | ||
"version": "1.1.0-alpha.10", | ||
"author": "Solana Maintainers <maintainers@solana.foundation>", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/solana-labs/wallet-standard", |
@@ -104,15 +104,16 @@ import { ed25519 } from '@noble/curves/ed25519'; | ||
const DOMAIN = '(?<domain>[^\\n]+?) wants you to sign in with your Solana account:\\n'; | ||
const ADDRESS = '(?<address>[^\\n]+)\\n\\n'; | ||
const STATEMENT = '((?<statement>[^\\n]+)\\n)?'; | ||
const URI = '(\\nURI: (?<uri>[^\\n]+))?'; | ||
const VERSION = '(\\nVersion: (?<version>[^\\n]+))?'; | ||
const CHAIN_ID = '(\\nChain ID: (?<chainId>[^\\n]+))?'; | ||
const NONCE = '(\\nNonce: (?<nonce>[^\\n]+))?'; | ||
const ISSUED_AT = '(\\nIssued At: (?<issuedAt>[^\\n]+))?'; | ||
const EXPIRATION_TIME = '(\\nExpiration Time: (?<expirationTime>[^\\n]+))?'; | ||
const NOT_BEFORE = '(\\nNot Before: (?<notBefore>[^\\n]+))?'; | ||
const REQUEST_ID = '(\\nRequest ID: (?<requestId>[^\\n]+))?'; | ||
const RESOURCES = '(\\nResources:(?<resources>(\\n- [^\\n]+)*))?'; | ||
const ADDRESS = '(?<address>[^\\n]+)(?:\\n|$)'; | ||
const FIELD = '(?:URI|Version|Chain ID|Nonce|Issued At|Expiration Time|Not Before|Request ID|Resources)'; | ||
const STATEMENT = `(?:\\n(?<statement>(?:(?!${FIELD}: [^\\n]+)[^\\n]*?\\n*?)*?)(?:\\n|$))?`; | ||
const URI = '(?:\\nURI: (?<uri>[^\\n]+))?'; | ||
const VERSION = '(?:\\nVersion: (?<version>[^\\n]+))?'; | ||
const CHAIN_ID = '(?:\\nChain ID: (?<chainId>[^\\n]+))?'; | ||
const NONCE = '(?:\\nNonce: (?<nonce>[^\\n]+))?'; | ||
const ISSUED_AT = '(?:\\nIssued At: (?<issuedAt>[^\\n]+))?'; | ||
const EXPIRATION_TIME = '(?:\\nExpiration Time: (?<expirationTime>[^\\n]+))?'; | ||
const NOT_BEFORE = '(?:\\nNot Before: (?<notBefore>[^\\n]+))?'; | ||
const REQUEST_ID = '(?:\\nRequest ID: (?<requestId>[^\\n]+))?'; | ||
const RESOURCES = '(?:\\nResources:(?<resources>(?:\\n- [^\\n]+)*))?'; | ||
const MESSAGE = new RegExp( | ||
`^${DOMAIN}${ADDRESS}${STATEMENT}${URI}${VERSION}${CHAIN_ID}${NONCE}${ISSUED_AT}${EXPIRATION_TIME}${NOT_BEFORE}${REQUEST_ID}${RESOURCES}$` | ||
`^${DOMAIN}${ADDRESS}${STATEMENT}${URI}${VERSION}${CHAIN_ID}${NONCE}${ISSUED_AT}${EXPIRATION_TIME}${NOT_BEFORE}${REQUEST_ID}${RESOURCES}\n*$` | ||
); | ||
@@ -179,36 +180,42 @@ | ||
let message = `${input.domain} wants you to sign in with your Solana account:\n`; | ||
message += `${input.address}\n\n`; | ||
message += `${input.address}`; | ||
if (input.statement) { | ||
message += `${input.statement}\n`; | ||
message += `\n\n${input.statement}`; | ||
} | ||
const fields: string[] = []; | ||
if (input.uri) { | ||
message += `\nURI: ${input.uri}`; | ||
fields.push(`URI: ${input.uri}`); | ||
} | ||
if (input.version) { | ||
message += `\nVersion: ${input.version}`; | ||
fields.push(`Version: ${input.version}`); | ||
} | ||
if (input.chainId) { | ||
message += `\nChain ID: ${input.chainId}`; | ||
fields.push(`Chain ID: ${input.chainId}`); | ||
} | ||
if (input.nonce) { | ||
message += `\nNonce: ${input.nonce}`; | ||
fields.push(`Nonce: ${input.nonce}`); | ||
} | ||
if (input.issuedAt) { | ||
message += `\nIssued At: ${input.issuedAt}`; | ||
fields.push(`Issued At: ${input.issuedAt}`); | ||
} | ||
if (input.expirationTime) { | ||
message += `\nExpiration Time: ${input.expirationTime}`; | ||
fields.push(`Expiration Time: ${input.expirationTime}`); | ||
} | ||
if (input.notBefore) { | ||
message += `\nNot Before: ${input.notBefore}`; | ||
fields.push(`Not Before: ${input.notBefore}`); | ||
} | ||
if (input.requestId) { | ||
message += `\nRequest ID: ${input.requestId}`; | ||
fields.push(`Request ID: ${input.requestId}`); | ||
} | ||
if (input.resources) { | ||
message += `\nResources:`; | ||
fields.push(`Resources:`); | ||
for (const resource of input.resources) { | ||
message += `\n- ${resource}`; | ||
fields.push(`- ${resource}`); | ||
} | ||
} | ||
if (fields.length) { | ||
message += `\n\n${fields.join('\n')}`; | ||
} | ||
@@ -215,0 +222,0 @@ return message; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65126
1029