Skip to content
This repository has been archived by the owner on Nov 23, 2022. It is now read-only.

aviate-labs/principal-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Principal

Docs GoDoc

Principal are generic identifiers for canisters and users.

Usage

raw, _ := hex.DecodeString("abcd01")
p := principal.Principal(raw)
fmt.Println(p.Encode())
// Output:
// em77e-bvlzu-aq

Special Forms

Opaque Identifiers

These are always generated by the system and have no structure of interest outside the system. Typically, these end with the byte 0x01.

Self-Authenticating Identifiers

An external user can use these ids as the sender of a request if they own the corresponding private key.

sha224(public_key) 0x02

Derived Identifiers

Derived IDs are currently not explicitly used, but they may be used internally or in the future.

sha224(len(registering_principal) registering_principal derivation_nonce) 0x03

Anonymous Identifiers

Used for the anonymous caller. It can be used in call and query requests without a signature.