Compare commits

...
34 Commits
Author SHA1 Message Date
github-actions[bot] 4e98504813 bump: version 0.5.8 → 0.5.9 2024-10-06 16:17:52 +00:00
Prad Nukala ab0bd3a5e1 fix: Update source directory for asset publishing 2024-10-06 12:16:37 -04:00
Prad Nukala 62628ed0d8 feat: add Motr support 2024-10-06 11:39:23 -04:00
Prad Nukala b1e5464843 feat: update UIUX PKL to utilize optional fields 2024-10-05 12:41:47 -04:00
github-actions[bot] 8e1359f126 bump: version 0.5.7 → 0.5.8 2024-10-04 09:36:56 +00:00
Prad Nukala f84a87574c Merge branch 'develop' 2024-10-04 05:35:42 -04:00
Prad Nukala 1c16d367ed refactor: Remove unused logs configuration 2024-10-04 05:35:37 -04:00
github-actions[bot] dc191fdbba bump: version 0.5.6 → 0.5.7 2024-10-04 09:29:25 +00:00
Prad Nukala 875c410443 feat(devbox): use process-compose for testnet services 2024-10-04 05:27:51 -04:00
Prad Nukala bcf5dfa70c refactor: update issue template headings 2024-10-04 02:01:12 -04:00
Prad Nukala 77d76938a3 feat: remove motr.mjs dependency 2024-10-04 01:57:43 -04:00
Prad Nukala 1267bc426a docs: add markdown rendering for objective description 2024-10-04 00:18:53 -04:00
Prad Nukala 5e74045f3d <no value> 2024-10-04 00:16:21 -04:00
Prad Nukala 3adf42925d feat: add markdown rendering to issue templates 2024-10-04 00:05:55 -04:00
Prad Nukala f95fa2c906 feat: update issue templates for better clarity 2024-10-04 00:02:52 -04:00
Prad Nukala ac2f65844c refactor: rename bug-report issue template to bug 2024-10-03 23:58:56 -04:00
Prad Nukala 546dd7b4ad feat: add issue templates for tracking and task issues 2024-10-03 23:47:37 -04:00
Prad Nukala fcf4ab5b4f feat: add issue templates for bug report and tracking 2024-10-03 23:39:43 -04:00
Prad NukalaandGitHub c57d5e8f1a feature/macaroon ante handler (#1105)
- **feat: add dstlled-diff workflow**
- **feat: Add Sonr community support and security bug bounty links**
2024-10-03 23:20:21 -04:00
Prad Nukala cd57226a45 Merge branch 'master' into develop 2024-10-03 20:47:25 -04:00
Prad Nukala f5a11061ac feat: introduce docker-compose based setup 2024-10-03 20:47:21 -04:00
github-actions[bot] 93a3d814d6 bump: version 0.5.5 → 0.5.6 2024-10-03 23:26:56 +00:00
Prad Nukala a0e24880c3 Merge branch 'develop' 2024-10-03 19:25:57 -04:00
Prad Nukala e63ec7f22a feat: add hway and sonr processes to dev environment 2024-10-03 19:25:42 -04:00
github-actions[bot] 6910a415a2 bump: version 0.5.4 → 0.5.5 2024-10-03 21:53:36 +00:00
Prad Nukala fccb42761c feat: add rudimentary DidController table 2024-10-03 17:49:29 -04:00
Prad Nukala f75ff0d3be refactor: reorganize pkl files for better separation of concerns 2024-10-03 01:01:49 -04:00
Prad Nukala 931ac2308d feat: update home section with new features 2024-10-02 20:37:18 -04:00
Prad Nukala 42c5ab642e feat: introduce Home model and refactor views 2024-10-02 20:23:28 -04:00
Prad Nukala 8d8935c045 feat(nebula): create Home model for home page 2024-10-02 18:01:30 -04:00
Prad Nukala 3baec2745b refactor: rename msg_server_test.go to rpc_test.go 2024-10-02 16:30:48 -04:00
github-actions[bot] df72b55fe3 bump: version 0.5.3 → 0.5.4 2024-10-02 19:04:16 +00:00
Prad Nukala cbc5a35bcd Merge branch 'develop' 2024-10-02 15:02:42 -04:00
Prad Nukala 959562c5ff chore: configure telegram release announcements 2024-10-02 15:02:31 -04:00
82 changed files with 1678 additions and 964 deletions
+1 -1
View File
@@ -2,6 +2,6 @@
name = "cz_conventional_commits"
tag_format = "v$version"
version_scheme = "semver"
version = "0.5.3"
version = "0.5.9"
update_changelog_on_bump = true
major_version_zero = true
+38
View File
@@ -0,0 +1,38 @@
name: Bug Report
description: File a bug report.
title: "ERROR: "
labels: ["#BUG", "#HELP"]
projects: ["onsonr/39"]
body:
- type: textarea
attributes:
label: Operating System
description: What operating system are you using?
placeholder: "Example: macOS Big Sur"
value: operating system
validations:
required: true
- type: dropdown
attributes:
label: Network
description: What network are you using?
multiple: false
options:
- LocalNet
- TestNet
- MainNet
default: 0
validations:
required: true
- type: checkboxes
attributes:
label: Code of Conduct
description:
The Code of Conduct helps create a safe space for everyone. We require
that everyone agrees to it.
options:
- label: I agree to follow this project's [Code of Conduct](link/to/coc)
required: true
- type: markdown
attributes:
value: "Thanks for completing our form!"
+5
View File
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Community Discussions
url: https://github.com/orgs/onsonr/discussions
about: Please submit ideas and suggestions here.
+30
View File
@@ -0,0 +1,30 @@
name: Tracking issue
description: Use this template for tracking new features.
title: "(v0.6): FEATURE NAME"
labels: ["#TRACK", "#OKR"]
assignees: ["prnk28"]
projects: ["onsonr/37"]
body:
- type: checkboxes
attributes:
label: Is this associated with a milestone?
description: This is a tracking issue for tracking a new feature for a given milestone.
options:
- label: I have confirmed this is an OKR tracking issue
required: true
- type: textarea
attributes:
label: Objective
description: Explain the objective of the feature and add any relevant links.
render: markdown
validations:
required: false
- type: textarea
attributes:
label: Task List
description: |
Break down the objective into a list of tasks to be completed.
value: |
- [ ]
validations:
required: false
+22
View File
@@ -0,0 +1,22 @@
---
name: Default Todo
about: Break down feature requirements into tasks.
title: "Name of the new task"
labels:
- "#TODO"
- "#OKR"
assignees: "prnk28"
projects: "onsonr/37"
---
### Description
The expected deliverable of the task.
### Associated Files
These files will be modified by this task.
### References
Use these documents to help you complete the task.
+1 -3
View File
@@ -55,7 +55,7 @@ release:
github:
owner: onsonr
name: sonr
name_template: '{{.Now.Format "2006.01.02"}}'
name_template: "Release {{.Version}}"
draft: false
replace_existing_draft: true
replace_existing_artifacts: true
@@ -63,7 +63,6 @@ release:
- glob: ./CHANGELOG*
- glob: ./README*
- glob: ./LICENSE*
- glob: ./pkl/*
brews:
- name: sonr
@@ -137,4 +136,3 @@ announce:
telegram:
enabled: true
chat_id: -1002222617755
parse_mode: MarkdownV2
+56
View File
@@ -1,3 +1,59 @@
## v0.5.9 (2024-10-06)
### Feat
- add Motr support
- update UIUX PKL to utilize optional fields
### Fix
- Update source directory for asset publishing
## v0.5.8 (2024-10-04)
### Refactor
- Remove unused logs configuration
## v0.5.7 (2024-10-04)
### Feat
- **devbox**: use process-compose for testnet services
- remove motr.mjs dependency
- add markdown rendering to issue templates
- update issue templates for better clarity
- add issue templates for tracking and task issues
- add issue templates for bug report and tracking
- introduce docker-compose based setup
### Refactor
- update issue template headings
- rename bug-report issue template to bug
## v0.5.6 (2024-10-03)
### Feat
- add hway and sonr processes to dev environment
## v0.5.5 (2024-10-03)
### Feat
- add rudimentary DidController table
- update home section with new features
- introduce Home model and refactor views
- **nebula**: create Home model for home page
### Refactor
- reorganize pkl files for better separation of concerns
- rename msg_server_test.go to rpc_test.go
## v0.5.4 (2024-10-02)
## v0.5.3 (2024-10-02)
### Fix
+5 -6
View File
@@ -94,7 +94,7 @@ endif
install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/sonrd
go install -mod=readonly $(BUILD_FLAGS) ./cmd/motr
go install -mod=readonly $(BUILD_FLAGS) ./cmd/hway
########################################
### Tools & dependencies
@@ -307,7 +307,6 @@ motr:
templ:
@echo "(templ) Generating templ files"
go install github.com/a-h/templ/cmd/templ@latest
templ generate
nebula:
@@ -316,10 +315,10 @@ nebula:
pkl:
@echo "(pkl) Building PKL"
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/dwn.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/orm.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/txns.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/uiux.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/DWN.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/ORM.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/Txns.pkl
go run github.com/apple/pkl-go/cmd/pkl-gen-go ./pkl/UIUX.pkl
start-caddy:
@echo "(start-caddy) Starting caddy"
-1
View File
@@ -29,7 +29,6 @@ func New() *Server {
s.GET("/login", pages.Login)
s.GET("/register", pages.Register)
s.GET("/profile", pages.Profile)
s.GET("/allocate", pages.Profile)
return s
}
-1
View File
@@ -1 +0,0 @@
{}
+3 -2
View File
@@ -13,13 +13,14 @@ processes:
namespace: testnet
command: "devbox run start:testnet"
restart: on_failure
env:
max_restarts: 1
depends:
- ipfs
motr:
hway:
namespace: testnet
command: "devbox run start:motr"
command: "hway start"
restart: on_failure
max_restarts: 1
depends:
+8 -25
View File
@@ -4,14 +4,16 @@
"go@1.22",
"air@latest",
"bun@latest",
"gum@latest",
"ipfs@latest",
"skate@latest",
"templ@latest",
"cloudflared@latest",
"process-compose@latest"
],
"env": {
"GOPATH": "$HOME/go",
"PATH": "$HOME/go/bin:$PATH",
"PATH": "./build:$HOME/go/bin:$PATH",
"CHAIN_ID": "sonr-testnet-1",
"DENOM": "usnr",
"KEYRING": "test",
@@ -41,6 +43,9 @@
"build:nebula": [
"make nebula"
],
"build:motr": [
"make motr"
],
"build:sonrd": [
"make motr",
"make build"
@@ -59,33 +64,11 @@
"gen:templ": [
"make templ"
],
"start:hway": [
"make templ",
"make hway",
"make start-hway"
],
"start:testnet": [
"make templ",
"make install",
"make sh-testnet"
],
"start": [
"process-compose up -d"
"process-compose up -f ./deploy/testnet/process-compose.yaml"
],
"stop": [
"process-compose down"
],
"test:e2e": [
"make templ",
"make test-e2e"
],
"test:unit": [
"make templ",
"make test-unit"
],
"test": [
"make templ",
"make test"
"process-compose down -f ./deploy/testnet/process-compose.yaml"
]
}
}
+96
View File
@@ -193,6 +193,54 @@
}
}
},
"gum@latest": {
"last_modified": "2024-09-10T15:01:03Z",
"resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#gum",
"source": "devbox-search",
"version": "0.14.5",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/n1gqffrwdzr3vpsmwmwx3hmw814c1k6g-gum-0.14.5",
"default": true
}
],
"store_path": "/nix/store/n1gqffrwdzr3vpsmwmwx3hmw814c1k6g-gum-0.14.5"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/ggp10jr3l6higs0gqibp6ypjlf7yakpc-gum-0.14.5",
"default": true
}
],
"store_path": "/nix/store/ggp10jr3l6higs0gqibp6ypjlf7yakpc-gum-0.14.5"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/jq8shghha81s1wg67fcjrfnf4hbliimn-gum-0.14.5",
"default": true
}
],
"store_path": "/nix/store/jq8shghha81s1wg67fcjrfnf4hbliimn-gum-0.14.5"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/f199acwir08z47f3d5kf1fhmhajmd1ig-gum-0.14.5",
"default": true
}
],
"store_path": "/nix/store/f199acwir08z47f3d5kf1fhmhajmd1ig-gum-0.14.5"
}
}
},
"ipfs@latest": {
"last_modified": "2023-02-24T09:01:09Z",
"resolved": "github:NixOS/nixpkgs/7d0ed7f2e5aea07ab22ccb338d27fbe347ed2f11#ipfs",
@@ -294,6 +342,54 @@
"store_path": "/nix/store/6zbyhj72wh0645lj6b9c392aqqg11a84-skate-1.0.0"
}
}
},
"templ@latest": {
"last_modified": "2024-09-10T15:01:03Z",
"resolved": "github:NixOS/nixpkgs/5ed627539ac84809c78b2dd6d26a5cebeb5ae269#templ",
"source": "devbox-search",
"version": "0.2.778",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/n3yqslisz9v81k4w4vhci1v2bl1sqf9s-templ-0.2.778",
"default": true
}
],
"store_path": "/nix/store/n3yqslisz9v81k4w4vhci1v2bl1sqf9s-templ-0.2.778"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/i4xjiw0vc25qpr3g01q0x401351w28hr-templ-0.2.778",
"default": true
}
],
"store_path": "/nix/store/i4xjiw0vc25qpr3g01q0x401351w28hr-templ-0.2.778"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/77w522agb5fgsr36jkifcccr9x4xwkf9-templ-0.2.778",
"default": true
}
],
"store_path": "/nix/store/77w522agb5fgsr36jkifcccr9x4xwkf9-templ-0.2.778"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/1g5ji5930j03cycpcjy12z6lr24l9c65-templ-0.2.778",
"default": true
}
],
"store_path": "/nix/store/1g5ji5930j03cycpcjy12z6lr24l9c65-templ-0.2.778"
}
}
}
}
}
+5 -5
View File
@@ -2,13 +2,13 @@
package dwn
type Config struct {
Ipfs *IPFS `pkl:"ipfs" json:"ipfs,omitempty"`
Ipfs *IPFS `pkl:"ipfs"`
Sonr *Sonr `pkl:"sonr" json:"sonr,omitempty"`
Sonr *Sonr `pkl:"sonr"`
Motr *Motr `pkl:"motr" json:"motr,omitempty"`
Motr *Motr `pkl:"motr"`
Schema *Schema `pkl:"schema" json:"schema,omitempty"`
Schema *Schema `pkl:"schema"`
ProxyUrl string `pkl:"proxyUrl" json:"proxyUrl,omitempty"`
ProxyUrl string `pkl:"proxyUrl"`
}
+2 -2
View File
@@ -2,7 +2,7 @@
package dwn
type IPFS struct {
ApiUrl string `pkl:"apiUrl" json:"apiUrl,omitempty"`
ApiUrl string `pkl:"apiUrl"`
GatewayUrl string `pkl:"gatewayUrl" json:"gatewayUrl,omitempty"`
GatewayUrl string `pkl:"gatewayUrl"`
}
+3 -3
View File
@@ -2,9 +2,9 @@
package dwn
type Motr struct {
Keyshare string `pkl:"keyshare" json:"keyshare,omitempty"`
Keyshare string `pkl:"keyshare"`
Address string `pkl:"address" json:"address,omitempty"`
Address string `pkl:"address"`
Origin string `pkl:"origin" json:"origin,omitempty"`
Origin string `pkl:"origin"`
}
+8 -8
View File
@@ -4,19 +4,19 @@ package dwn
type Schema struct {
Version int `pkl:"version"`
Account string `pkl:"account" json:"account,omitempty"`
Account string `pkl:"account"`
Asset string `pkl:"asset" json:"asset,omitempty"`
Asset string `pkl:"asset"`
Chain string `pkl:"chain" json:"chain,omitempty"`
Chain string `pkl:"chain"`
Credential string `pkl:"credential" json:"credential,omitempty"`
Credential string `pkl:"credential"`
Jwk string `pkl:"jwk" json:"jwk,omitempty"`
Jwk string `pkl:"jwk"`
Grant string `pkl:"grant" json:"grant,omitempty"`
Grant string `pkl:"grant"`
Keyshare string `pkl:"keyshare" json:"keyshare,omitempty"`
Keyshare string `pkl:"keyshare"`
Profile string `pkl:"profile" json:"profile,omitempty"`
Profile string `pkl:"profile"`
}
+5 -5
View File
@@ -2,13 +2,13 @@
package dwn
type Sonr struct {
ApiUrl string `pkl:"apiUrl" json:"apiUrl,omitempty"`
ApiUrl string `pkl:"apiUrl"`
GrpcUrl string `pkl:"grpcUrl" json:"grpcUrl,omitempty"`
GrpcUrl string `pkl:"grpcUrl"`
RpcUrl string `pkl:"rpcUrl" json:"rpcUrl,omitempty"`
RpcUrl string `pkl:"rpcUrl"`
WebSocketUrl string `pkl:"webSocketUrl" json:"webSocketUrl,omitempty"`
WebSocketUrl string `pkl:"webSocketUrl"`
ChainId string `pkl:"chainId" json:"chainId,omitempty"`
ChainId string `pkl:"chainId"`
}
BIN
View File
Binary file not shown.
+31
View File
@@ -0,0 +1,31 @@
amends "https://pkl.sh/DWN.pkl";
dwn = new Config {
ipfs = new IPFS {
apiUrl = "https://api.sonr-ipfs.land";
gatewayUrl = "https://ipfs.sonr.land";
};
sonr = new Sonr {
apiUrl = "https://api.sonr.land";
grpcUrl = "https://grpc.sonr.land";
rpcUrl = "https://rpc.sonr.land";
webSocketUrl = "wss://rpc.sonr.land/ws";
chainId = "sonr";
};
motr = new Motr {
keyshare = JSON.parse(keyshare);
address = address;
origin = "sonr.id";
};
schema = new Schema {
version = 1;
account = "account";
asset = "asset";
chain = "chain";
credential = "credential";
jwk = "jwk";
grant = "grant";
keyshare = "keyshare";
profile = "profile";
};
};
-5
View File
@@ -13,15 +13,11 @@ import (
//go:embed app.wasm
var dwnWasmData []byte
//go:embed motr.mjs
var motrMJSData []byte
//go:embed sw.js
var swJSData []byte
var (
dwnWasmFile = files.NewBytesFile(dwnWasmData)
motrMJSFile = files.NewBytesFile(motrMJSData)
swJSFile = files.NewBytesFile(swJSData)
)
@@ -43,7 +39,6 @@ func NewVaultDirectory(cnfg *Config) (files.Node, error) {
}
fileMap := map[string]files.Node{
"config.json": files.NewBytesFile(dwnJSON),
"motr.mjs": motrMJSFile,
"sw.js": swJSFile,
"app.wasm": dwnWasmFile,
"index.html": files.NewBytesFile(w.Bytes()),
-253
View File
@@ -1,253 +0,0 @@
// motr.mjs
import Dexie from "dexie";
export class Motr {
constructor(config) {
this.config = config;
this.vault = null;
this.initializeVault();
}
initializeVault() {
const { schema } = this.config;
this.vault = new Dexie("Vault");
this.vault.version(schema.version).stores(schema);
}
// Account methods
async insertAccount(accountData) {
return this.vault.account.add(accountData);
}
async getAccount(id) {
return this.vault.account.get(id);
}
async updateAccount(id, accountData) {
return this.vault.account.update(id, accountData);
}
async deleteAccount(id) {
return this.vault.account.delete(id);
}
// Asset methods
async insertAsset(assetData) {
return this.vault.asset.add(assetData);
}
async getAsset(id) {
return this.vault.asset.get(id);
}
async updateAsset(id, assetData) {
return this.vault.asset.update(id, assetData);
}
async deleteAsset(id) {
return this.vault.asset.delete(id);
}
// Chain methods
async insertChain(chainData) {
return this.vault.chain.add(chainData);
}
async getChain(id) {
return this.vault.chain.get(id);
}
async updateChain(id, chainData) {
return this.vault.chain.update(id, chainData);
}
async deleteChain(id) {
return this.vault.chain.delete(id);
}
// Credential methods
async insertCredential(credentialData) {
const publicKey = await this.createPublicKeyCredential(credentialData);
credentialData.credentialId = publicKey.id;
credentialData.publicKey = publicKey.publicKey;
return this.vault.credential.add(credentialData);
}
async getCredential(id) {
return this.vault.credential.get(id);
}
async updateCredential(id, credentialData) {
return this.vault.credential.update(id, credentialData);
}
async deleteCredential(id) {
return this.vault.credential.delete(id);
}
// JWK methods
async insertJwk(jwkData) {
return this.vault.jwk.add(jwkData);
}
async getJwk(id) {
return this.vault.jwk.get(id);
}
async updateJwk(id, jwkData) {
return this.vault.jwk.update(id, jwkData);
}
async deleteJwk(id) {
return this.vault.jwk.delete(id);
}
// Grant methods
async insertGrant(grantData) {
return this.vault.grant.add(grantData);
}
async getGrant(id) {
return this.vault.grant.get(id);
}
async updateGrant(id, grantData) {
return this.vault.grant.update(id, grantData);
}
async deleteGrant(id) {
return this.vault.grant.delete(id);
}
// Keyshare methods
async insertKeyshare(keyshareData) {
return this.vault.keyshare.add(keyshareData);
}
async getKeyshare(id) {
return this.vault.keyshare.get(id);
}
async updateKeyshare(id, keyshareData) {
return this.vault.keyshare.update(id, keyshareData);
}
async deleteKeyshare(id) {
return this.vault.keyshare.delete(id);
}
// PublicKey methods
async insertPublicKey(publicKeyData) {
return this.vault.publicKey.add(publicKeyData);
}
async getPublicKey(id) {
return this.vault.publicKey.get(id);
}
async updatePublicKey(id, publicKeyData) {
return this.vault.publicKey.update(id, publicKeyData);
}
async deletePublicKey(id) {
return this.vault.publicKey.delete(id);
}
// Profile methods
async insertProfile(profileData) {
return this.vault.profile.add(profileData);
}
async getProfile(id) {
return this.vault.profile.get(id);
}
async updateProfile(id, profileData) {
return this.vault.profile.update(id, profileData);
}
async deleteProfile(id) {
return this.vault.profile.delete(id);
}
// WebAuthn methods
async createPublicKeyCredential(options) {
const publicKeyCredentialCreationOptions = {
challenge: new Uint8Array(32),
rp: {
name: this.config.motr.origin,
id: new URL(this.config.motr.origin).hostname,
},
user: {
id: new TextEncoder().encode(options.subject),
name: options.subject,
displayName: options.label,
},
pubKeyCredParams: [
{ alg: -7, type: "public-key" },
{ alg: -257, type: "public-key" },
],
authenticatorSelection: {
authenticatorAttachment: "platform",
userVerification: "required",
},
timeout: 60000,
attestation: "direct",
};
try {
const credential = await navigator.credentials.create({
publicKey: publicKeyCredentialCreationOptions,
});
const publicKeyJwk = await crypto.subtle.exportKey(
"jwk",
credential.response.getPublicKey(),
);
return {
id: credential.id,
publicKey: publicKeyJwk,
type: credential.type,
transports: credential.response.getTransports(),
};
} catch (error) {
console.error("Error creating credential:", error);
throw error;
}
}
async getPublicKeyCredential(options) {
const publicKeyCredentialRequestOptions = {
challenge: new Uint8Array(32),
rpId: new URL(this.config.motr.origin).hostname,
allowCredentials: options.allowCredentials || [],
userVerification: "required",
timeout: 60000,
};
try {
const assertion = await navigator.credentials.get({
publicKey: publicKeyCredentialRequestOptions,
});
return {
id: assertion.id,
type: assertion.type,
rawId: new Uint8Array(assertion.rawId),
response: {
authenticatorData: new Uint8Array(
assertion.response.authenticatorData,
),
clientDataJSON: new Uint8Array(assertion.response.clientDataJSON),
signature: new Uint8Array(assertion.response.signature),
userHandle: new Uint8Array(assertion.response.userHandle),
},
};
} catch (error) {
console.error("Error getting credential:", error);
throw error;
}
}
}
File diff suppressed because it is too large Load Diff
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
package home
templ MarketingFooter() {
templ Footer() {
<!-- Site footer -->
<footer>
<div class="max-w-5xl mx-auto px-4 sm:px-6">
+1 -1
View File
@@ -8,7 +8,7 @@ package home
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func MarketingFooter() templ.Component {
func Footer() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+1 -1
View File
@@ -1,6 +1,6 @@
package home
templ MarketingHeader() {
templ Header() {
<!-- Site header -->
<header class="absolute top-2 md:top-6 w-full z-30">
<div class="px-4 sm:px-6">
+1 -1
View File
@@ -8,7 +8,7 @@ package home
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func MarketingHeader() templ.Component {
func Header() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
+8 -9
View File
@@ -1,6 +1,9 @@
package home
import "github.com/onsonr/sonr/pkg/nebula/models"
import (
"github.com/onsonr/sonr/pkg/nebula/components/ui"
"github.com/onsonr/sonr/pkg/nebula/models"
)
templ SectionHero(hero *models.Hero) {
<!-- Hero -->
@@ -24,12 +27,8 @@ templ SectionHero(hero *models.Hero) {
{ hero.Subtitle }
</p>
<div class="max-w-xs mx-auto sm:max-w-none sm:inline-flex sm:justify-center space-y-4 sm:space-y-0 sm:space-x-4">
<div>
<div class="btn cursor-pointer text-zinc-100 bg-zinc-900 hover:bg-zinc-800 w-full shadow" hx-swap="afterend" hx-get={ hero.PrimaryButton.Href }>{ hero.PrimaryButton.Text }</div>
</div>
<div>
<div class="btn cursor-pointer text-zinc-600 bg-white hover:text-zinc-900 w-full shadow" hx-swap="afterend" hx-get={ hero.SecondaryButton.Href }>{ hero.SecondaryButton.Text }</div>
</div>
@ui.PrimaryButton(hero.PrimaryButton.Href, hero.PrimaryButton.Text)
@ui.SecondaryButton(hero.SecondaryButton.Href, hero.SecondaryButton.Text)
</div>
</div>
</div>
@@ -42,9 +41,9 @@ templ SectionHero(hero *models.Hero) {
templ heroImage(hero *models.Hero) {
<!-- Image -->
<div class="max-w-5xl mx-auto px-4 sm:px-6 flex justify-center pb-12 md:pb-20 relative before:absolute before:-top-12 before:w-96 before:h-96 before:bg-zinc-900 before:opacity-[.15] before:rounded-full before:blur-3xl before:-z-10 from-zinc-100 to-white">
<div class="max-w-5xl motion-preset-slide-up mx-auto px-4 sm:px-6 flex justify-center pb-12 md:pb-20 relative before:absolute before:-top-12 before:w-96 before:h-96 before:bg-zinc-900 before:opacity-[.15] before:rounded-full before:blur-3xl before:-z-10 from-zinc-100 to-white">
<img
class="rounded-lg"
class="rounded-lg "
src={ hero.Image.Src }
width={ hero.Image.Width }
height={ hero.Image.Height }
+31 -68
View File
@@ -8,7 +8,10 @@ package home
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "github.com/onsonr/sonr/pkg/nebula/models"
import (
"github.com/onsonr/sonr/pkg/nebula/components/ui"
"github.com/onsonr/sonr/pkg/nebula/models"
)
func SectionHero(hero *models.Hero) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
@@ -38,7 +41,7 @@ func SectionHero(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleFirst)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 14, Col: 24}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 17, Col: 24}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@@ -51,7 +54,7 @@ func SectionHero(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleEmphasis)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 16, Col: 28}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 19, Col: 28}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@@ -64,7 +67,7 @@ func SectionHero(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(hero.TitleSecond)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 21, Col: 25}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 24, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
@@ -77,65 +80,25 @@ func SectionHero(hero *models.Hero) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Subtitle)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 24, Col: 22}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 27, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p><div class=\"max-w-xs mx-auto sm:max-w-none sm:inline-flex sm:justify-center space-y-4 sm:space-y-0 sm:space-x-4\"><div><div class=\"btn cursor-pointer text-zinc-100 bg-zinc-900 hover:bg-zinc-800 w-full shadow\" hx-swap=\"afterend\" hx-get=\"")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p><div class=\"max-w-xs mx-auto sm:max-w-none sm:inline-flex sm:justify-center space-y-4 sm:space-y-0 sm:space-x-4\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(hero.PrimaryButton.Href)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 28, Col: 149}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
templ_7745c5c3_Err = ui.PrimaryButton(hero.PrimaryButton.Href, hero.PrimaryButton.Text).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
templ_7745c5c3_Err = ui.SecondaryButton(hero.SecondaryButton.Href, hero.SecondaryButton.Text).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hero.PrimaryButton.Text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 28, Col: 177}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div><div><div class=\"btn cursor-pointer text-zinc-600 bg-white hover:text-zinc-900 w-full shadow\" hx-swap=\"afterend\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hero.SecondaryButton.Href)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 31, Col: 150}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hero.SecondaryButton.Text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 31, Col: 180}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div></div></div>")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -171,21 +134,21 @@ func heroImage(hero *models.Hero) templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var10 := templ.GetChildren(ctx)
if templ_7745c5c3_Var10 == nil {
templ_7745c5c3_Var10 = templ.NopComponent
templ_7745c5c3_Var6 := templ.GetChildren(ctx)
if templ_7745c5c3_Var6 == nil {
templ_7745c5c3_Var6 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!-- Image --><div class=\"max-w-5xl mx-auto px-4 sm:px-6 flex justify-center pb-12 md:pb-20 relative before:absolute before:-top-12 before:w-96 before:h-96 before:bg-zinc-900 before:opacity-[.15] before:rounded-full before:blur-3xl before:-z-10 from-zinc-100 to-white\"><img class=\"rounded-lg\" src=\"")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!-- Image --><div class=\"max-w-5xl motion-preset-slide-up mx-auto px-4 sm:px-6 flex justify-center pb-12 md:pb-20 relative before:absolute before:-top-12 before:w-96 before:h-96 before:bg-zinc-900 before:opacity-[.15] before:rounded-full before:blur-3xl before:-z-10 from-zinc-100 to-white\"><img class=\"rounded-lg \" src=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Src)
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Src)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 48, Col: 23}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 47, Col: 23}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -193,12 +156,12 @@ func heroImage(hero *models.Hero) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Width)
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Width)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 49, Col: 27}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 48, Col: 27}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -206,12 +169,12 @@ func heroImage(hero *models.Hero) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var13 string
templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Height)
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(hero.Image.Height)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 50, Col: 29}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/home/hero.templ`, Line: 49, Col: 29}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -239,9 +202,9 @@ func stats() templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var14 := templ.GetChildren(ctx)
if templ_7745c5c3_Var14 == nil {
templ_7745c5c3_Var14 = templ.NopComponent
templ_7745c5c3_Var10 := templ.GetChildren(ctx)
if templ_7745c5c3_Var10 == nil {
templ_7745c5c3_Var10 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!-- Stats --><div class=\"max-w-4xl mx-auto px-4 sm:px-6 justify-center items-center\"><div class=\"max-w-sm mx-auto grid gap-12 sm:grid-cols-2 md:grid-cols-4 md:-mx-5 md:gap-0 items-end md:max-w-none\"><!-- 1st item --><div class=\"relative text-center md:px-5 after:hidden md:after:block after:absolute after:right-0 after:top-1/2 after:-translate-y-1/2 after:w-px after:h-8 after:border-l after:border-zinc-300 after:border-dashed last:after:hidden\"><h4 class=\"font-inter-tight text-2xl md:text-3xl font-bold tabular-nums mb-2\"><span x-data=\"counter(476)\" x-text=\"counterValue\">0</span>K</h4><p class=\"text-sm text-zinc-500\">Assets packed with power beyond your imagination.</p></div><!-- 2nd item --><div class=\"relative text-center md:px-5 after:hidden md:after:block after:absolute after:right-0 after:top-1/2 after:-translate-y-1/2 after:w-px after:h-8 after:border-l after:border-zinc-300 after:border-dashed last:after:hidden\"><h4 class=\"font-inter-tight text-2xl md:text-3xl font-bold tabular-nums mb-2\"><span x-data=\"counter(1.44)\" x-text=\"counterValue\">0</span>K</h4><p class=\"text-sm text-zinc-500\">Assets packed with power beyond your imagination.</p></div><!-- 3rd item --><div class=\"relative text-center md:px-5 after:hidden md:after:block after:absolute after:right-0 after:top-1/2 after:-translate-y-1/2 after:w-px after:h-8 after:border-l after:border-zinc-300 after:border-dashed last:after:hidden\"><h4 class=\"font-inter-tight text-2xl md:text-3xl font-bold tabular-nums mb-2\"><span x-data=\"counter(1.5)\" x-text=\"counterValue\">0</span>M+</h4><p class=\"text-sm text-zinc-500\">Assets packed with power beyond your imagination.</p></div><!-- 4th item --><div class=\"relative text-center md:px-5 after:hidden md:after:block after:absolute after:right-0 after:top-1/2 after:-translate-y-1/2 after:w-px after:h-8 after:border-l after:border-zinc-300 after:border-dashed last:after:hidden\"><h4 class=\"font-inter-tight text-2xl md:text-3xl font-bold tabular-nums mb-2\"><span x-data=\"counter(750)\" x-text=\"counterValue\">0</span>K</h4><p class=\"text-sm text-zinc-500\">Assets packed with power beyond your imagination.</p></div></div>")
@@ -144,14 +144,6 @@ templ Highlights() {
height="360"
alt="Feature 01"
/>
<img
class="absolute top-0 left-full mix-blend-exclusion -translate-x-[70%] -mr-20 max-md:w-[45%]"
src="https://cdn.sonr.id/img/secure-keys.svg"
width="224"
height="224"
alt="Illustration"
aria-hidden="true"
/>
</div>
</div>
<!-- Item 2 -->
@@ -173,14 +165,6 @@ templ Highlights() {
height="360"
alt="Feature 02"
/>
<img
class="absolute top-0 left-full mix-blend-exclusion -translate-x-[70%] -mr-20 max-md:w-[45%]"
src="https://cdn.sonr.id/img/secure-keys.svg"
width="224"
height="224"
alt="Illustration"
aria-hidden="true"
/>
</div>
</div>
<!-- Item 3 -->
@@ -202,14 +186,6 @@ templ Highlights() {
height="360"
alt="Feature 03"
/>
<img
class="absolute top-0 left-full mix-blend-exclusion -translate-x-[70%] -mr-20 max-md:w-[45%]"
src="https://cdn.sonr.id/img/secure-keys.svg"
width="224"
height="224"
alt="Illustration"
aria-hidden="true"
/>
</div>
</div>
<!-- Item 4 -->
@@ -231,14 +207,6 @@ templ Highlights() {
height="360"
alt="Feature 04"
/>
<img
class="absolute top-0 left-full mix-blend-exclusion -translate-x-[70%] -mr-20 max-md:w-[45%]"
src="https://cdn.sonr.id/img/secure-keys.svg"
width="224"
height="224"
alt="Illustration"
aria-hidden="true"
/>
</div>
</div>
</div>
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -5,15 +5,15 @@ import (
"github.com/onsonr/sonr/pkg/nebula/models"
)
templ View(hero *models.Hero) {
templ View(home *models.Home) {
@blocks.LayoutNoBody("Sonr.ID", true) {
@MarketingHeader()
@SectionHero(hero)
@Header()
@SectionHero(home.Hero)
@Highlights()
@Features()
@Bento()
@Lowlights()
@CallToAction()
@MarketingFooter()
@Footer()
}
}
+4 -4
View File
@@ -13,7 +13,7 @@ import (
"github.com/onsonr/sonr/pkg/nebula/models"
)
func View(hero *models.Hero) templ.Component {
func View(home *models.Home) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
@@ -46,7 +46,7 @@ func View(hero *models.Hero) templ.Component {
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = MarketingHeader().Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = Header().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -54,7 +54,7 @@ func View(hero *models.Hero) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = SectionHero(hero).Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = SectionHero(home.Hero).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -102,7 +102,7 @@ func View(hero *models.Hero) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = MarketingFooter().Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = Footer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
+1 -2
View File
@@ -3,7 +3,6 @@ package register
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/blocks"
"github.com/onsonr/sonr/pkg/nebula/models/formstate"
)
templ Modal(c echo.Context) {
@@ -47,7 +46,7 @@ templ Modal(c echo.Context) {
<p>Enter your account information below to create your account.</p>
</div>
@blocks.Breadcrumbs()
@basicInfoForm(formstate.Initial)
@basicInfoForm()
@blocks.Spacer()
<div class="flex flex-col-reverse sm:flex-row sm:justify-between sm:space-x-2">
<button @click="modalOpen=false" type="button" class="inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium transition-colors border rounded-md focus:outline-none focus:ring-2 focus:ring-neutral-100 focus:ring-offset-2">Cancel</button>
@@ -11,7 +11,6 @@ import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/blocks"
"github.com/onsonr/sonr/pkg/nebula/models/formstate"
)
func Modal(c echo.Context) templ.Component {
@@ -43,7 +42,7 @@ func Modal(c echo.Context) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = basicInfoForm(formstate.Initial).Render(ctx, templ_7745c5c3_Buffer)
templ_7745c5c3_Err = basicInfoForm().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
+8 -28
View File
@@ -1,31 +1,11 @@
package register
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/blocks"
"github.com/onsonr/sonr/pkg/nebula/models/formstate"
)
templ View(c echo.Context) {
@blocks.Layout("Sonr.ID", true) {
@blocks.Card("register-view", blocks.SizeMedium) {
@blocks.Spacer()
@blocks.Breadcrumbs()
@basicInfoForm(formstate.Initial)
@blocks.Spacer()
}
}
}
templ basicInfoForm(state formstate.FormState) {
switch (state) {
default:
<div class="border rounded-lg shadow-sm bg-card text-zinc-900">
<div class="flex flex-col space-y-1.5 p-6"></div>
<div class="p-6 pt-0 space-y-2">
<div class="space-y-1"><label class="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="name">Name</label><input type="text" id="name" placeholder="Adam Wathan" class="flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"/></div>
<div class="space-y-1"><label class="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="username">Handle</label><input type="text" id="handle" placeholder="angelo.snr" class="flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"/></div>
</div>
</div>
}
templ basicInfoForm() {
<div class="border rounded-lg shadow-sm bg-card text-zinc-900">
<div class="flex flex-col space-y-1.5 p-6"></div>
<div class="p-6 pt-0 space-y-2">
<div class="space-y-1"><label class="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="name">Name</label><input type="text" id="name" placeholder="Adam Wathan" class="flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"/></div>
<div class="space-y-1"><label class="text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" for="username">Handle</label><input type="text" id="handle" placeholder="angelo.snr" class="flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50"/></div>
</div>
</div>
}
+2 -100
View File
@@ -8,13 +8,7 @@ package register
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/blocks"
"github.com/onsonr/sonr/pkg/nebula/models/formstate"
)
func View(c echo.Context) templ.Component {
func basicInfoForm() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
@@ -35,67 +29,7 @@ func View(c echo.Context) templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var3 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Err = blocks.Spacer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = blocks.Breadcrumbs().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = basicInfoForm(formstate.Initial).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = blocks.Spacer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = blocks.Card("register-view", blocks.SizeMedium).Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = blocks.Layout("Sonr.ID", true).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"border rounded-lg shadow-sm bg-card text-zinc-900\"><div class=\"flex flex-col space-y-1.5 p-6\"></div><div class=\"p-6 pt-0 space-y-2\"><div class=\"space-y-1\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"name\">Name</label><input type=\"text\" id=\"name\" placeholder=\"Adam Wathan\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div><div class=\"space-y-1\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"username\">Handle</label><input type=\"text\" id=\"handle\" placeholder=\"angelo.snr\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -103,36 +37,4 @@ func View(c echo.Context) templ.Component {
})
}
func basicInfoForm(state formstate.FormState) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var4 := templ.GetChildren(ctx)
if templ_7745c5c3_Var4 == nil {
templ_7745c5c3_Var4 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
switch state {
default:
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"border rounded-lg shadow-sm bg-card text-zinc-900\"><div class=\"flex flex-col space-y-1.5 p-6\"></div><div class=\"p-6 pt-0 space-y-2\"><div class=\"space-y-1\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"name\">Name</label><input type=\"text\" id=\"name\" placeholder=\"Adam Wathan\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div><div class=\"space-y-1\"><label class=\"text-xs font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\" for=\"username\">Handle</label><input type=\"text\" id=\"handle\" placeholder=\"angelo.snr\" class=\"flex w-full h-10 px-3 py-2 text-sm bg-white border rounded-md peer border-zinc-300 ring-offset-background placeholder:text-zinc-400 focus:border-zinc-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 disabled:cursor-not-allowed disabled:opacity-50\"></div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate
+13
View File
@@ -0,0 +1,13 @@
package ui
templ PrimaryButton(href string, text string) {
<div>
<div class="btn cursor-pointer text-zinc-100 bg-zinc-900 hover:bg-zinc-800 w-full shadow" hx-swap="afterend" hx-get={ href }>{ text }</div>
</div>
}
templ SecondaryButton(href string, text string) {
<div>
<div class="btn cursor-pointer text-zinc-600 bg-white hover:text-zinc-900 w-full shadow" hx-swap="afterend" hx-get={ href }>{ text }</div>
</div>
}
+121
View File
@@ -0,0 +1,121 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package ui
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
func PrimaryButton(href string, text string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><div class=\"btn cursor-pointer text-zinc-100 bg-zinc-900 hover:bg-zinc-800 w-full shadow\" hx-swap=\"afterend\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(href)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/ui/button.templ`, Line: 5, Col: 124}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/ui/button.templ`, Line: 5, Col: 133}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
func SecondaryButton(href string, text string) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var4 := templ.GetChildren(ctx)
if templ_7745c5c3_Var4 == nil {
templ_7745c5c3_Var4 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><div class=\"btn cursor-pointer text-zinc-600 bg-white hover:text-zinc-900 w-full shadow\" hx-swap=\"afterend\" hx-get=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(href)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/ui/button.templ`, Line: 11, Col: 123}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/nebula/components/ui/button.templ`, Line: 11, Col: 132}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate
+12
View File
@@ -0,0 +1,12 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Bento struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
PrimaryButton *Button `pkl:"primaryButton"`
SecondaryButton *Button `pkl:"secondaryButton"`
}
+12
View File
@@ -0,0 +1,12 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type CallToAction struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
PrimaryButton *Button `pkl:"primaryButton"`
SecondaryButton *Button `pkl:"secondaryButton"`
}
+12
View File
@@ -0,0 +1,12 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Feature struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Icon *string `pkl:"icon"`
Image *Image `pkl:"image"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Features struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Image *Image `pkl:"image"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Form interface {
GetTitle() string
GetDescription() string
GetInputs() []*Input
}
+2
View File
@@ -15,4 +15,6 @@ type Hero struct {
SecondaryButton *Button `pkl:"secondaryButton"`
Image *Image `pkl:"image"`
Stats []*Stat `pkl:"stats"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Highlight struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Image *Image `pkl:"image"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Highlights struct {
Heading string `pkl:"heading"`
Subheading string `pkl:"subheading"`
Highlights []*Feature `pkl:"highlights"`
}
+6
View File
@@ -0,0 +1,6 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Home struct {
Hero *Hero `pkl:"hero"`
}
+4 -2
View File
@@ -1,10 +1,12 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
import "github.com/onsonr/sonr/pkg/nebula/models/inputtype"
type Input struct {
Label string `pkl:"label"`
Type string `pkl:"type"`
Type inputtype.InputType `pkl:"type"`
Placeholder string `pkl:"placeholder"`
@@ -14,5 +16,5 @@ type Input struct {
Help *string `pkl:"help"`
Required bool `pkl:"required"`
Required *bool `pkl:"required"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type Lowlights struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Image *Image `pkl:"image"`
}
+1 -3
View File
@@ -8,9 +8,7 @@ import (
)
type Models struct {
Hero *Hero `pkl:"hero"`
Stats *Stats `pkl:"stats"`
Home *Home `pkl:"home"`
}
// LoadFromPath loads the pkl module at the given path and evaluates it into a Models
+28
View File
@@ -0,0 +1,28 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
type RegisterFormData interface {
Form
}
var _ RegisterFormData = (*RegisterFormDataImpl)(nil)
type RegisterFormDataImpl struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
Inputs []*Input `pkl:"inputs"`
}
func (rcv *RegisterFormDataImpl) GetTitle() string {
return rcv.Title
}
func (rcv *RegisterFormDataImpl) GetDescription() string {
return rcv.Description
}
func (rcv *RegisterFormDataImpl) GetInputs() []*Input {
return rcv.Inputs
}
-14
View File
@@ -1,14 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package models
import "github.com/onsonr/sonr/pkg/nebula/models/formstate"
type RegistrationForm struct {
Title string `pkl:"title"`
Description string `pkl:"description"`
State formstate.FormState `pkl:"state"`
Inputs []*Input `pkl:"inputs"`
}
@@ -1,40 +0,0 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package formstate
import (
"encoding"
"fmt"
)
type FormState string
const (
Initial FormState = "initial"
Error FormState = "error"
Success FormState = "success"
Warning FormState = "warning"
)
// String returns the string representation of FormState
func (rcv FormState) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(FormState)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for FormState.
func (rcv *FormState) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "initial":
*rcv = Initial
case "error":
*rcv = Error
case "success":
*rcv = Success
case "warning":
*rcv = Warning
default:
return fmt.Errorf(`illegal: "%s" is not a valid FormState`, str)
}
return nil
}
+5 -4
View File
@@ -5,13 +5,14 @@ import "github.com/apple/pkl-go/pkl"
func init() {
pkl.RegisterMapping("models", Models{})
pkl.RegisterMapping("models#Home", Home{})
pkl.RegisterMapping("models#Hero", Hero{})
pkl.RegisterMapping("models#Button", Button{})
pkl.RegisterMapping("models#Image", Image{})
pkl.RegisterMapping("models#Stats", Stats{})
pkl.RegisterMapping("models#Stat", Stat{})
pkl.RegisterMapping("models#Input", Input{})
pkl.RegisterMapping("models#Link", Link{})
pkl.RegisterMapping("models#SocialLink", SocialLink{})
pkl.RegisterMapping("models#Input", Input{})
pkl.RegisterMapping("models#Footer", Footer{})
pkl.RegisterMapping("models#RegistrationForm", RegistrationForm{})
pkl.RegisterMapping("models#Feature", Feature{})
pkl.RegisterMapping("models#Highlights", Highlights{})
}
@@ -0,0 +1,43 @@
// Code generated from Pkl module `models`. DO NOT EDIT.
package inputtype
import (
"encoding"
"fmt"
)
type InputType string
const (
Text InputType = "text"
Password InputType = "password"
Email InputType = "email"
Credential InputType = "credential"
File InputType = "file"
)
// String returns the string representation of InputType
func (rcv InputType) String() string {
return string(rcv)
}
var _ encoding.BinaryUnmarshaler = new(InputType)
// UnmarshalBinary implements encoding.BinaryUnmarshaler for InputType.
func (rcv *InputType) UnmarshalBinary(data []byte) error {
switch str := string(data); str {
case "text":
*rcv = Text
case "password":
*rcv = Password
case "email":
*rcv = Email
case "credential":
*rcv = Credential
case "file":
*rcv = File
default:
return fmt.Errorf(`illegal: "%s" is not a valid InputType`, str)
}
return nil
}
+36 -27
View File
@@ -1,30 +1,39 @@
amends "https://pkl.sh/uiux.pkl";
amends "https://pkl.sh/UIUX.pkl";
hero = new Hero {
titleFirst = "Simplified";
titleEmphasis = "self-custody";
titleSecond = "for everyone";
subtitle = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
primaryButton = new Button {
text = "Get Started";
href = "/register";
};
secondaryButton = new Button {
text = "Learn More";
href = "/about";
};
image = new Image {
src = "https://cdn.sonr.id/img/hero-clipped.svg";
width = "500";
height = "500";
home = new Home {
// Hero
hero = new Hero {
titleFirst = "Simplified";
titleEmphasis = "self-custody";
titleSecond = "for everyone";
subtitle = "Sonr is a modern re-imagination of online user identity, empowering users to take ownership of their digital footprint and unlocking a new era of self-sovereignty.";
primaryButton = new Button {
text = "Get Started";
href = "/register";
};
secondaryButton = new Button {
text = "Learn More";
href = "/about";
};
image = new Image {
src = "https://cdn.sonr.id/img/hero-clipped.svg";
width = "500";
height = "500";
};
stats {
new Stat {
value = "476K";
label = "Assets packed with power beyond your imagination.";
};
new Stat {
value = "1.44K";
label = "Assets packed with power beyond your imagination.";
};
new Stat {
value = "1.5M+";
label = "Assets packed with power beyond your imagination.";
}
};
};
};
stats = new Stats {
firstValue = "476K";
firstLabel = "Assets packed with power beyond your imagination.";
secondValue = "1.44K";
secondLabel = "Assets packed with power beyond your imagination.";
thirdValue = "1.5M+";
thirdLabel = "Assets packed with power beyond your imagination.";
};
+4 -3
View File
@@ -11,11 +11,12 @@
"watch": "bun run watch:ts & bun run watch:css"
},
"devDependencies": {
"htmx.org": "^1.9.12",
"alpinejs": "^3.14.1",
"@tailwindcss/typography": "^0.5.15",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.15",
"alpinejs": "^3.14.1",
"htmx.org": "^1.9.12",
"tailwindcss": "^3.3.0",
"tailwindcss-motion": "^0.3.0-beta",
"typescript": "^4.9.0"
},
"dependencies": {
-11
View File
@@ -1,11 +0,0 @@
package pages
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/grant"
)
func Authorize(c echo.Context) error {
return echoResponse(c, grant.View(c))
}
-15
View File
@@ -1,15 +0,0 @@
package pages
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/home"
"github.com/onsonr/sonr/pkg/nebula/models"
)
func Home(c echo.Context) error {
mdls, err := models.GetModels()
if err != nil {
return err
}
return echoResponse(c, home.View(mdls.Hero))
}
-11
View File
@@ -1,11 +0,0 @@
package pages
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/login"
)
func Login(c echo.Context) error {
return echoResponse(c, login.Modal(c))
}
+60
View File
@@ -0,0 +1,60 @@
package pages
import (
"bytes"
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/grant"
"github.com/onsonr/sonr/pkg/nebula/components/home"
"github.com/onsonr/sonr/pkg/nebula/components/login"
"github.com/onsonr/sonr/pkg/nebula/components/profile"
"github.com/onsonr/sonr/pkg/nebula/components/register"
"github.com/onsonr/sonr/pkg/nebula/models"
)
func Authorize(c echo.Context) error {
return echoResponse(c, grant.View(c))
}
func Home(c echo.Context) error {
mdls, err := models.GetModels()
if err != nil {
return err
}
return echoResponse(c, home.View(mdls.Home))
}
func Login(c echo.Context) error {
return echoResponse(c, login.Modal(c))
}
func Profile(c echo.Context) error {
return echoResponse(c, profile.View(c))
}
func Register(c echo.Context) error {
return echoResponse(c, register.Modal(c))
}
// ╭───────────────────────────────────────────────────────────╮
// │ Helper Methods │
// ╰───────────────────────────────────────────────────────────╯
func echoResponse(c echo.Context, cmp templ.Component) error {
// Create a buffer to store the rendered HTML
buf := &bytes.Buffer{}
// Render the component to the buffer
err := cmp.Render(c.Request().Context(), buf)
if err != nil {
return err
}
// Set the content type
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
// Write the buffered content to the response
_, err = c.Response().Write(buf.Bytes())
return err
}
-11
View File
@@ -1,11 +0,0 @@
package pages
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/profile"
)
func Profile(c echo.Context) error {
return echoResponse(c, profile.View(c))
}
-11
View File
@@ -1,11 +0,0 @@
package pages
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/components/register"
)
func Register(c echo.Context) error {
return echoResponse(c, register.Modal(c))
}
-25
View File
@@ -1,25 +0,0 @@
package pages
import (
"bytes"
"github.com/a-h/templ"
"github.com/labstack/echo/v4"
)
func echoResponse(c echo.Context, cmp templ.Component) error {
// Create a buffer to store the rendered HTML
buf := &bytes.Buffer{}
// Render the component to the buffer
err := cmp.Render(c.Request().Context(), buf)
if err != nil {
return err
}
// Set the content type
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
// Write the buffered content to the response
_, err = c.Response().Write(buf.Bytes())
return err
}
+1 -1
View File
@@ -41,5 +41,5 @@ module.exports = {
},
},
},
plugins: [require("@tailwindcss/typography"), require("@tailwindcss/forms")],
plugins: [require("@tailwindcss/typography"), require("@tailwindcss/forms"), require('tailwindcss-motion')],
};
+30 -30
View File
@@ -1,39 +1,39 @@
package orm
const SCHEMA_VERSION = 1
import (
"reflect"
"strings"
)
func AccountSchema() string {
return "++, id, name, address, publicKey, chainCode, index, controller, createdAt"
const SchemaVersion = 1
func toCamelCase(s string) string {
if s == "" {
return s
}
if len(s) == 1 {
return strings.ToLower(s)
}
return strings.ToLower(s[:1]) + s[1:]
}
func AssetSchema() string {
return "++, id, name, symbol, decimals, chainCode, createdAt"
}
func GetSchema(structType interface{}) string {
t := reflect.TypeOf(structType)
if t.Kind() == reflect.Ptr {
t = t.Elem()
}
func ChainSchema() string {
return "++, id, name, networkId, chainCode, createdAt"
}
if t.Kind() != reflect.Struct {
return ""
}
func CredentialSchema() string {
return "++, id, subject, controller, attestationType, origin, label, deviceId, credentialId, publicKey, transport, signCount, userPresent, userVerified, backupEligible, backupState, cloneWarning, createdAt, updatedAt"
}
var fields []string
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
fieldName := toCamelCase(field.Name)
fields = append(fields, fieldName)
}
func DIDSchema() string {
return "++, id, role, algorithm, encoding, curve, key_type, raw, jwk"
}
func JwkSchema() string {
return "++, kty, crv, x, y, n, e"
}
func GrantSchema() string {
return "++, subject, controller, origin, token, scopes, createdAt, updatedAt"
}
func KeyshareSchema() string {
return "++, id, data, role, createdAt, lastRefreshed"
}
func ProfileSchema() string {
return "++, id, subject, controller, originUri, publicMetadata, privateMetadata, createdAt, updatedAt"
// Add "++" at the beginning, separated by a comma
return "++, " + strings.Join(fields, ", ")
}
+1 -50
View File
@@ -6,92 +6,43 @@ import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
typealias JSON = String
class JsonField extends go.Field {
structTags {
["json"] = "%{name},omitempty"
}
}
class Config {
@JsonField
ipfs: IPFS
@JsonField
sonr: Sonr
@JsonField
motr: Motr
@JsonField
schema: Schema
@JsonField
proxyUrl: String
}
class IPFS {
@JsonField
apiUrl: String
@JsonField
gatewayUrl: String
}
class Motr {
@JsonField
keyshare: JSON
@JsonField
address: String
@JsonField
origin: String
}
class Schema {
version: Int
@JsonField
account: String
@JsonField
asset: String
@JsonField
chain: String
@JsonField
credential: String
@JsonField
jwk: String
@JsonField
grant: String
@JsonField
keyshare: String
@JsonField
profile: String
}
class Sonr {
@JsonField
apiUrl: String
@JsonField
grpcUrl: String
@JsonField
rpcUrl: String
@JsonField
webSocketUrl: String
@JsonField
chainId: String
}
dwn : Config
View File
View File
+44 -43
View File
@@ -5,10 +5,21 @@ module models
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
// ╭───────────────────────────────────────────────────────────╮
// │ General Components
// │ General State
// ╰───────────────────────────────────────────────────────────╯
typealias FormState = "initial" | "error" | "success" | "warning"
typealias InputType = "text" | "password" | "email" | "credential" | "file"
class Button {
text: String
href: String
}
abstract class Form {
title: String
description: String
inputs: List<Input>
}
class Image {
src: String
@@ -16,6 +27,16 @@ class Image {
height: String
}
class Input {
label: String
type: InputType
placeholder: String
value: String?
error: String?
help: String?
required: Boolean?
}
class Link {
text: String
href: String
@@ -26,34 +47,26 @@ class SocialLink {
icon: String
}
class Button {
text: String
href: String
// ╭───────────────────────────────────────────────────────────╮
// │ Data Models │
// ╰───────────────────────────────────────────────────────────╯
class Feature {
title: String
description: String
icon: String?
image: Image?
}
class Input {
class Stat {
value: String
label: String
type: String
placeholder: String
value: String?
error: String?
help: String?
required: Boolean
}
// ╭───────────────────────────────────────────────────────────╮
// │ Homepage Components
// │ Homepage View Model
// ╰───────────────────────────────────────────────────────────╯
class Stats {
firstValue: String
firstLabel: String
secondValue: String
secondLabel: String
thirdValue: String
thirdLabel: String
}
class Hero {
titleFirst: String
titleEmphasis: String
@@ -62,29 +75,17 @@ class Hero {
primaryButton: Button
secondaryButton: Button
image: Image
stats: Listing<Stat>
}
class Footer {
logo: Image
mediumLink: SocialLink
twitterLink: SocialLink
discordLink: SocialLink
githubLink: SocialLink
companyLinks: List<Link>
resourcesLinks: List<Link>
class Highlights {
heading: String
subheading: String
highlights: Listing<Feature>
}
class Home {
hero: Hero
}
hero : Hero
stats : Stats
// ╭───────────────────────────────────────────────────────────╮
// │ Registration Components │
// ╰───────────────────────────────────────────────────────────╯
class RegistrationForm {
title: String
description: String
state: FormState
inputs: List<Input>
}
home : Home
+27
View File
@@ -0,0 +1,27 @@
package keeper
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/onsonr/crypto/mpc"
"github.com/onsonr/sonr/x/did/types"
)
func (k Keeper) NewController(ctx sdk.Context) (uint64, types.ControllerI, error) {
shares, err := mpc.GenerateKeyshares()
if err != nil {
return 0, nil, err
}
controller, err := types.NewController(shares)
if err != nil {
return 0, nil, err
}
entry, err := controller.GetTableEntry()
if err != nil {
return 0, nil, err
}
num, err := k.OrmDB.ControllerTable().InsertReturningNumber(ctx, entry)
if err != nil {
return 0, nil, err
}
return num, controller, nil
}
-46
View File
@@ -1,22 +1,16 @@
package keeper
import (
"crypto/sha256"
"fmt"
"cosmossdk.io/collections"
storetypes "cosmossdk.io/core/store"
"cosmossdk.io/log"
"cosmossdk.io/orm/model/ormdb"
nftkeeper "cosmossdk.io/x/nft/keeper"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
"github.com/onsonr/crypto/mpc"
"gopkg.in/macaroon.v2"
apiv1 "github.com/onsonr/sonr/api/did/v1"
"github.com/onsonr/sonr/x/did/types"
@@ -91,43 +85,3 @@ func NewKeeper(
k.Schema = schema
return k
}
func (k Keeper) NewController(ctx sdk.Context) (uint64, types.ControllerI, error) {
shares, err := mpc.GenerateKeyshares()
if err != nil {
return 0, nil, err
}
controller, err := types.NewController(shares)
if err != nil {
return 0, nil, err
}
entry, err := controller.GetTableEntry()
if err != nil {
return 0, nil, err
}
num, err := k.OrmDB.ControllerTable().InsertReturningNumber(ctx, entry)
if err != nil {
return 0, nil, err
}
return num, controller, nil
}
// IssueMacaroon creates a macaroon with the specified parameters.
func (k Keeper) IssueMacaroon(ctx sdk.Context, sharedMPCPubKey, location, id string, blockExpiry uint64) (*macaroon.Macaroon, error) {
// Derive the root key by hashing the shared MPC public key
rootKey := sha256.Sum256([]byte(sharedMPCPubKey))
// Create the macaroon
m, err := macaroon.New(rootKey[:], []byte(id), location, macaroon.LatestVersion)
if err != nil {
return nil, err
}
// Add the block expiry caveat
caveat := fmt.Sprintf("block-expiry=%d", blockExpiry)
err = m.AddFirstPartyCaveat([]byte(caveat))
if err != nil {
return nil, err
}
return m, nil
}
+29
View File
@@ -0,0 +1,29 @@
package keeper
import (
"crypto/sha256"
"fmt"
sdk "github.com/cosmos/cosmos-sdk/types"
"gopkg.in/macaroon.v2"
)
// IssueMacaroon creates a macaroon with the specified parameters.
func (k Keeper) IssueMacaroon(ctx sdk.Context, sharedMPCPubKey, location, id string, blockExpiry uint64) (*macaroon.Macaroon, error) {
// Derive the root key by hashing the shared MPC public key
rootKey := sha256.Sum256([]byte(sharedMPCPubKey))
// Create the macaroon
m, err := macaroon.New(rootKey[:], []byte(id), location, macaroon.LatestVersion)
if err != nil {
return nil, err
}
// Add the block expiry caveat
caveat := fmt.Sprintf("block-expiry=%d", blockExpiry)
err = m.AddFirstPartyCaveat([]byte(caveat))
if err != nil {
return nil, err
}
return m, nil
}
+1 -5
View File
@@ -8,6 +8,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ipfs/boxo/path"
"github.com/ipfs/kubo/client/rpc"
"github.com/onsonr/sonr/x/vault/types"
)
@@ -74,8 +75,3 @@ func (k Keeper) HasPathInIPFS(ctx sdk.Context, cid string) (bool, error) {
}
return true, nil
}
// validateSubjectOrigin checks if the subject and origin are valid
func (k Keeper) validateSubjectOrigin(ctx sdk.Context, subject string, origin string) error {
return nil
}
+8 -9
View File
@@ -34,14 +34,13 @@ func (p Params) Validate() error {
// DefaultSchema returns the default schema
func DefaultSchema() *Schema {
return &Schema{
Version: orm.SCHEMA_VERSION,
Account: orm.AccountSchema(),
Asset: orm.AssetSchema(),
Chain: orm.ChainSchema(),
Credential: orm.CredentialSchema(),
Jwk: orm.JwkSchema(),
Grant: orm.GrantSchema(),
Keyshare: orm.KeyshareSchema(),
Profile: orm.ProfileSchema(),
Version: orm.SchemaVersion,
Account: orm.GetSchema(&orm.Account{}),
Asset: orm.GetSchema(&orm.Asset{}),
Chain: orm.GetSchema(&orm.Chain{}),
Credential: orm.GetSchema(&orm.Credential{}),
Grant: orm.GetSchema(&orm.Grant{}),
Keyshare: orm.GetSchema(&orm.Keyshare{}),
Profile: orm.GetSchema(&orm.Profile{}),
}
}