Categorygithub.com/aviate-labs/principal-go
repositorypackage
0.3.1
Repository: https://github.com/aviate-labs/principal-go.git
Documentation: pkg.go.dev

# README

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.