### Install and Build SIWE Library (npm) Source: https://github.com/spruceid/siwe/blob/main/README.md Installs dependencies and builds the Sign-In with Ethereum TypeScript library using npm commands. Development can be done at the package level, with tests run per package. ```bash npm install npm run build npm run test ``` -------------------------------- ### SIWE Date-Time Grammar Source: https://github.com/spruceid/siwe/blob/main/packages/siwe-parser/lib/siwe-abnf.txt Defines the structure for full date and time, including optional fractional seconds and time zone offsets, compliant with RFC 3339. ```ABNF time-second = 2DIGIT ; 00-58, 00-59, 00-60 based on leap second ; rules time-secfrac = "." 1*DIGIT time-numoffset = ("+" / "-") time-hour ":" time-minute time-offset = "Z" / time-numoffset partial-time = time-hour ":" time-minute ":" time-second [time-secfrac] full-time = partial-time time-offset date-time = full-date "T" full-time ``` -------------------------------- ### RFC 3986 URI Specification Source: https://github.com/spruceid/siwe/blob/main/packages/siwe-parser/lib/siwe-abnf.txt Provides the ABNF grammar for Uniform Resource Identifiers (URIs) as defined in RFC 3986. This includes rules for scheme, hier-part, authority, path components, and specific host types like IPv4 addresses and domain names. ```ABNF URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] hier-part = "//" authority path-abempty / path-absolute / path-rootless / path-empty scheme = ALPHA "*" ( ALPHA / DIGIT / "%d43" / "%d45-46" ) authority = [ userinfo-at ] host [ ":" port ] path-abempty = "*" ( "/" segment ) path-absolute = "/" [ segment-nz "*" ( "/" segment ) ] path-rootless = segment-nz "*" ( "/" segment ) path-empty = "" userinfo-at = userinfo "%d64" ; userinfo redefined to include the "@" so that it will fail without it ; otherwise userinfo can match host and then the parser will backtrack ; incorrectly keeping the captured userinfo phrase userinfo = "*" (%d97-122 / %d65-90 / %d48-57 / pct-encoded / "%d33" / "%d36" / "%d38-46" / "%d58-59" / "%d61" / "%d95" / "%d126") host = IP-literal / (IPv4address !reg-name-char) / reg-name ; negative look-ahead required to prevent IPv4address from being recognized as first part of reg-name ; same fix as https://github.com/garycourt/uri-js/issues/4 IP-literal = "[" ( IPv6address / IPvFuture ")"] ``` -------------------------------- ### SIWE Message Format ABNF Source: https://github.com/spruceid/siwe/blob/main/packages/siwe-parser/lib/siwe-abnf.txt Defines the structure of a Sign-In with Ethereum message, including scheme, domain, address, statement, URI, version, chain ID, nonce, and timestamps. It also specifies optional fields like expiration time, not before, request ID, and resources. ```ABNF sign-in-with-ethereum = oscheme domain %s" wants you to sign in with your Ethereum account:" LF address LF ((LF statement LF LF) / empty-statement / (LF LF)) %s"URI: " URI LF %s"Version: " version LF %s"Chain ID: " chain-id LF %s"Nonce: " nonce LF %s"Issued At: " issued-at [ LF ex-title expiration-time ] [ LF nb-title not-before ] [ LF ri-title request-id ] [ LF re-title resources ] ex-title = %s"Expiration Time: " nb-title = %s"Not Before: " ri-title = %s"Request ID: " re-title = %s"Resources:" oscheme = [ ALPHA *( ALPHA / DIGIT / %d43 / %d45-46 ) "://" ] domain = authority-d address = "0x" 40*40HEXDIG ; Must also conform to captilization ; checksum encoding specified in EIP-55 ; where applicable (EOAs). statement = 1*( %d97-122 / %d65-90 / %d48-57 / %d32-33 / %d35-36 / %d38-59 / %d61 / %d93 / %d95 / %d126) ; The purpose is to exclude LF (line breaks). ; LDT 10/04/2023: Do you mean %d32-126? All printing characters empty-statement = LF LF LF version = "1" nonce = 8*( ALPHA / DIGIT ) issued-at = date-time expiration-time = date-time not-before = date-time request-id = *pchar chain-id = 1*DIGIT ; See EIP-155 for valid CHAIN_IDs. resources = *( LF resource ) resource = "- " URI-r ``` -------------------------------- ### RFC 5234 Basic ABNF Definitions Source: https://github.com/spruceid/siwe/blob/main/packages/siwe-parser/lib/siwe-abnf.txt Provides fundamental building blocks for Augmented Backus-Naur Form (ABNF) grammars, including alphabetic characters, line feeds, digits, and hexadecimal digits. ```ABNF ALPHA = %x41-5A / %x61-7A ; A-Z / a-z LF = %x0A ; linefeed DIGIT = %x30-39 ; 0-9 HEXDIG = %d48-57 / %d65-70 / %d97-102 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.