Add Extism JS Async Lib and State #1
16
internal/types/exec.go
Normal file
16
internal/types/exec.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package types
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// ExecInput represents the input for the exec function
|
||||
type ExecInput struct {
|
||||
Filter string `json:"filter"` // GitHub-style filter: "resource:accounts action:sign"
|
||||
Token string `json:"token"` // UCAN token for authorization
|
||||
}
|
||||
|
||||
// ExecOutput represents the output of the exec function
|
||||
type ExecOutput struct {
|
||||
Success bool `json:"success"`
|
||||
Result json.RawMessage `json:"result,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
9
internal/types/filters.go
Normal file
9
internal/types/filters.go
Normal file
@@ -0,0 +1,9 @@
|
||||
// Package types contains the types used by the enclave.
|
||||
package types
|
||||
|
||||
// FilterParams parsed from GitHub-style filter syntax
|
||||
type FilterParams struct {
|
||||
Resource string
|
||||
Action string
|
||||
Subject string
|
||||
}
|
||||
12
internal/types/generate.go
Normal file
12
internal/types/generate.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package types
|
||||
|
||||
// GenerateInput represents the input for the generate function
|
||||
type GenerateInput struct {
|
||||
Credential string `json:"credential"` // Base64-encoded PublicKeyCredential
|
||||
}
|
||||
|
||||
// GenerateOutput represents the output of the generate function
|
||||
type GenerateOutput struct {
|
||||
DID string `json:"did"`
|
||||
Database []byte `json:"database"`
|
||||
}
|
||||
13
internal/types/load.go
Normal file
13
internal/types/load.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package types
|
||||
|
||||
// LoadInput represents the input for the load function
|
||||
type LoadInput struct {
|
||||
Database []byte `json:"database"`
|
||||
}
|
||||
|
||||
// LoadOutput represents the output of the load function
|
||||
type LoadOutput struct {
|
||||
Success bool `json:"success"`
|
||||
DID string `json:"did,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
11
internal/types/ping.go
Normal file
11
internal/types/ping.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package types
|
||||
|
||||
type PingInput struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type PingOutput struct {
|
||||
Success bool `json:"success"`
|
||||
Message string `json:"message"`
|
||||
Echo string `json:"echo"`
|
||||
}
|
||||
46
internal/types/query.go
Normal file
46
internal/types/query.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package types
|
||||
|
||||
// QueryInput represents the input for the query function
|
||||
type QueryInput struct {
|
||||
DID string `json:"did"`
|
||||
}
|
||||
|
||||
// QueryOutput represents the output of the query function
|
||||
type QueryOutput struct {
|
||||
DID string `json:"did"`
|
||||
Controller string `json:"controller"`
|
||||
VerificationMethods []VerificationMethod `json:"verification_methods"`
|
||||
Accounts []Account `json:"accounts"`
|
||||
Credentials []Credential `json:"credentials"`
|
||||
}
|
||||
|
||||
// VerificationMethod represents a DID verification method
|
||||
type VerificationMethod struct {
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Controller string `json:"controller"`
|
||||
PublicKey string `json:"public_key"`
|
||||
Purpose string `json:"purpose"`
|
||||
}
|
||||
|
||||
// Account represents a derived blockchain account
|
||||
type Account struct {
|
||||
Address string `json:"address"`
|
||||
ChainID string `json:"chain_id"`
|
||||
CoinType int `json:"coin_type"`
|
||||
AccountIndex int `json:"account_index"`
|
||||
AddressIndex int `json:"address_index"`
|
||||
Label string `json:"label"`
|
||||
IsDefault bool `json:"is_default"`
|
||||
}
|
||||
|
||||
// Credential represents a WebAuthn credential
|
||||
type Credential struct {
|
||||
CredentialID string `json:"credential_id"`
|
||||
DeviceName string `json:"device_name"`
|
||||
DeviceType string `json:"device_type"`
|
||||
Authenticator string `json:"authenticator"`
|
||||
Transports []string `json:"transports"`
|
||||
CreatedAt string `json:"created_at"`
|
||||
LastUsed string `json:"last_used"`
|
||||
}
|
||||
Reference in New Issue
Block a user