-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c98ec86
commit 2ede41c
Showing
8 changed files
with
106 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Anoma.Identity.External; | ||
|
||
import Stdlib.Prelude open; | ||
import Stdlib.Trait.Ord.Eq open using {fromOrdToEq}; | ||
|
||
--- A fixed-size data type describing an external identity. | ||
axiom ExternalIdentity : Type; | ||
|
||
module ExternalIdentityInternal; | ||
--- Compares two ;ExternalIdentity; objects. | ||
axiom compare : (lhs rhs : ExternalIdentity) -> Ordering; | ||
|
||
--- Implements the ;Ord; trait for ;ExternalIdentity;. | ||
instance | ||
ExternalIdentity-Ord : Ord ExternalIdentity := mkOrd compare; | ||
|
||
--- Implements the ;Eq; trait for ;ExternalIdentity;. | ||
instance | ||
ExternalIdentity-Eq : Eq ExternalIdentity := fromOrdToEq; | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Anoma.Identity.Index; | ||
|
||
import Anoma.Identity.External open using {ExternalIdentity} public; | ||
import Anoma.Identity.Internal open using {InternalIdentity} public; | ||
import Anoma.Identity.Signing.Types open using {Signature; sign; verify} public; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module Anoma.Identity.Internal; | ||
|
||
import Stdlib.Prelude open; | ||
import Stdlib.Trait.Ord.Eq open using {fromOrdToEq}; | ||
|
||
--- A fixed-size data type describing an internal identity. | ||
axiom InternalIdentity : Type; | ||
|
||
module InternalIdentityInternal; | ||
--- Compares two ;InternalIdentity; objects. | ||
axiom compare : (lhs rhs : InternalIdentity) -> Ordering; | ||
|
||
--- Implements the ;Ord; trait for ;InternalIdentity;. | ||
instance | ||
InternalIdentity-Ord : Ord InternalIdentity := mkOrd compare; | ||
|
||
--- Implements the ;Eq; trait for ;InternalIdentity;. | ||
instance | ||
InternalIdentity-Eq : Eq InternalIdentity := fromOrdToEq; | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Anoma.Identity.Signing.Types; | ||
|
||
import Stdlib.Prelude open; | ||
import Anoma.Identity.Internal open; | ||
import Anoma.Identity.External open; | ||
|
||
axiom Signature : Type; | ||
|
||
axiom verify : {Message : Type} | ||
-> (signature : Signature) | ||
-> (message : Message) | ||
-> (external : ExternalIdentity) | ||
-> Bool; | ||
|
||
axiom sign : {Message : Type} -> (message : Message) -> (internal : InternalIdentity) -> Signature; | ||
|
||
module NonDetached; | ||
axiom SignedMessage : Type; | ||
|
||
axiom verify : (signedMessage : SignedMessage) -> (external : ExternalIdentity) -> Bool; | ||
|
||
axiom verifyWithMessage : {Message : Type} | ||
-> (signedMessage : SignedMessage) | ||
-> (external : ExternalIdentity) | ||
-> Maybe Message; | ||
|
||
axiom sign : {Message : Type} | ||
-> (message : Message) | ||
-> (internal : InternalIdentity) | ||
-> SignedMessage; | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module Anoma.Identity.Types; | ||
|
||
import Stdlib.Prelude open; | ||
import Stdlib.Trait.Ord.Eq open using {fromOrdToEq}; | ||
import Anoma.Identity.External open; | ||
import Anoma.Identity.Internal open; | ||
|
||
--- A record describing an identity. | ||
--- NOTE: For the private testnet, this deviates from the specs https://specs.anoma.net/v2/system_architecture/identity/identity.html. | ||
type Identity := | ||
mkIdentity { | ||
external : ExternalIdentity; | ||
internal : InternalIdentity | ||
}; | ||
|
||
module IdentityInternal; | ||
--- Compares two ;Identity; objects. | ||
compare (lhs rhs : Identity) : Ordering := | ||
Ord.cmp (Identity.external lhs) (Identity.external rhs); | ||
|
||
--- Implements the ;Ord; trait for ;Identity;. | ||
instance | ||
Identity-Ord : Ord Identity := mkOrd compare; | ||
|
||
--- Implements the ;Eq; trait for ;Identity;. | ||
instance | ||
Identity-Eq : Eq Identity := fromOrdToEq; | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters